배터리 삽입 감지 지연

배터리 삽입 감지 지연

배터리가 삽입되는 시기를 알아야 하는 Python 스크립트를 작성 중입니다. 나는 사용한다pyudev그런 이유로.

질문:

  • AC 어댑터를 연결하기만 하면 노트북을 켤 수 있습니다.
  • 내가 실행하면 ls /sys/class/power_supply/BAT0응답은 다음과 같습니다.
    ls: cannot access '/sys/class/power_supply/BAT0': No such file or directory
    
    여태까지는 그런대로 잘됐다
  • 하지만 배터리를 삽입한 다음 동일한 명령을 실행하면나는 같은 결과를 얻습니다.! 배터리를 감지하는 데 20초 정도 걸립니다.
  • 나도 시도했다
    udevadm monitor -u
    
    역시 20초가 걸립니다.

예상 동작: 즉시 감지될 것으로 예상합니다.

AC 어댑터를 연결했다가 분리한 후(배터리를 연결한 상태에서) 실행하면 udevadm monitor -u즉시 AC 어댑터 이벤트를 감지하고 배터리 지연 이벤트를 감지합니다.

시스템 메시지

$ inxi --admin --verbosity=7 --filter --no-host --width 

    System:
      Kernel: 6.1.38-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 13.1.1
        parameters: BOOT_IMAGE=/@/boot/vmlinuz-6.1-x86_64
        root=UUID=d18277d5-35dd-426d-b08f-1698012272b1 rw rootflags=subvol=@
        apparmor=1 security=apparmor udev.log_priority=3 fastboot
      Desktop: KDE Plasma v: 5.27.6 tk: Qt v: 5.15.10 wm: kwin_x11 vt: 2 dm:
        1: GDM v: 44.1 note: stopped 2: LightDM v: 1.32.0 note: stopped 3: SDDM
      Distro: Manjaro Linux base: Arch Linux
    Machine:
      Type: Laptop System: Dell product: Inspiron 5558 v: N/A
        serial: <superuser required> Chassis: type: 9 serial: <superuser required>
      Mobo: Dell model: 086DKN v: A00 serial: <superuser required> UEFI: Dell
        v: A18 date: 12/30/2019
    Memory:
      System RAM: total: 8 GiB available: 7.67 GiB used: 4.83 GiB (62.9%)
      RAM Report: permissions: Unable to run dmidecode. Root privileges required.
    CPU:
      Info: model: Intel Core i7-5500U bits: 64 type: MT MCP arch: Broadwell
        gen: core 5 level: v3 note: check built: 2015-18 process: Intel 14nm
        family: 6 model-id: 0x3D (61) stepping: 4 microcode: 0x2F
      Topology: cpus: 1x cores: 2 tpc: 2 threads: 4 smt: enabled cache:
        L1: 128 KiB desc: d-2x32 KiB; i-2x32 KiB L2: 512 KiB desc: 2x256 KiB
        L3: 4 MiB desc: 1x4 MiB
      Speed (MHz): avg: 2295 high: 2297 min/max: 500/3000 scaling:
        driver: intel_cpufreq governor: performance cores: 1: 2296 2: 2297 3: 2295
        4: 2294 bogomips: 19161
      Flags: 3dnowprefetch abm acpi adx aes aperfmperf apic arat arch_perfmon
        avx avx2 bmi1 bmi2 bts clflush cmov constant_tsc cpuid cpuid_fault cx16
        cx8 de ds_cpl dtes64 dtherm dts epb ept ept_ad erms est f16c flexpriority
        flush_l1d fma fpu fsgsbase fxsr ht ibpb ibrs ida intel_pt invpcid
        invpcid_single lahf_lm lm mca mce md_clear mmx monitor movbe msr mtrr
        nonstop_tsc nopl nx pae pat pbe pcid pclmulqdq pdcm pdpe1gb pebs pge pln
        pni popcnt pse pse36 pti pts rdrand rdseed rdtscp rep_good sdbg sep smap
        smep ss ssbd sse sse2 sse4_1 sse4_2 ssse3 stibp syscall tm tm2 tpr_shadow
        tsc tsc_adjust tsc_deadline_timer vme vmx vnmi vpid x2apic xsave xsaveopt
        xtopology xtpr
      Vulnerabilities:
      Type: itlb_multihit status: KVM: VMX disabled
      Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
        vulnerable
      Type: mds mitigation: Clear CPU buffers; SMT vulnerable
      Type: meltdown mitigation: PTI
      Type: mmio_stale_data status: Unknown: No mitigations
      Type: retbleed status: Not affected
      Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
        prctl
      Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
        sanitization
      Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, IBRS_FW,
        STIBP: conditional, RSB filling, PBRSB-eIBRS: Not affected
      Type: srbds mitigation: Microcode
      Type: tsx_async_abort status: Not affected
    Graphics:
      Device-1: Intel HD Graphics 5500 vendor: Dell driver: i915 v: kernel
        arch: Gen-8 process: Intel 14nm built: 2014-15 ports: active: eDP-1
        empty: HDMI-A-1 bus-ID: 00:02.0 chip-ID: 8086:1616 class-ID: 0300
      Device-2: NVIDIA GK208BM [GeForce 920M] vendor: Dell driver: nvidia
        v: 470.199.02 alternate: nouveau,nvidia_drm non-free: series: 470.xx+
        status: legacy-active (EOL~2023/24) arch: Kepler code: GKxxx
        process: TSMC 28nm built: 2012-18 pcie: gen: 1 speed: 2.5 GT/s lanes: 4
        link-max: gen: 2 speed: 5 GT/s lanes: 8 bus-ID: 08:00.0 chip-ID: 10de:1299
        class-ID: 0302
      Device-3: Suyin Integrated_Webcam_HD driver: uvcvideo type: USB rev: 2.0
        speed: 480 Mb/s lanes: 1 mode: 2.0 bus-ID: 2-5:2 chip-ID: 064e:920b
        class-ID: 0e02 serial: <filter>
      Display: x11 server: X.Org v: 21.1.8 with: Xwayland v: 23.1.2
        compositor: kwin_x11 driver: X: loaded: modesetting,nvidia dri: iris
        gpu: i915 display-ID: :0 screens: 1
      Screen-1: 0 s-res: 1366x768 s-dpi: 96 s-size: 361x203mm (14.21x7.99")
        s-diag: 414mm (16.31")
      Monitor-1: eDP-1 model: ChiMei InnoLux 0x15dc built: 2015 res: 1366x768
        hz: 60 dpi: 101 gamma: 1.2 size: 344x193mm (13.54x7.6") diag: 394mm (15.5")
        ratio: 16:9 modes: 1366x768
      API: OpenGL v: 4.6 Mesa 23.0.4 renderer: Mesa Intel HD Graphics 5500 (BDW
        GT2) direct-render: Yes
    Audio:
      Device-1: Intel Broadwell-U Audio vendor: Dell driver: snd_hda_intel
        v: kernel bus-ID: 00:03.0 chip-ID: 8086:160c class-ID: 0403
      Device-2: Intel Wildcat Point-LP High Definition Audio vendor: Dell
        driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:9ca0
        class-ID: 0403
      Device-3: NVIDIA GK208 HDMI/DP Audio driver: snd_hda_intel v: kernel pcie:
        gen: 1 speed: 2.5 GT/s lanes: 4 link-max: gen: 2 speed: 5 GT/s lanes: 8
        bus-ID: 08:00.1 chip-ID: 10de:0e0f class-ID: 0403
      API: ALSA v: k6.1.38-1-MANJARO status: kernel-api with: aoss
        type: oss-emulator tools: alsactl,alsamixer,amixer
      Server-1: JACK v: 1.9.22 status: off tools: N/A
      Server-2: PipeWire v: 0.3.74 status: active with: 1: pipewire-pulse
        status: active 2: pipewire-media-session status: active
        tools: pactl,pw-cat,pw-cli
    Network:
      Device-1: Intel Wireless 3160 driver: iwlwifi v: kernel pcie: gen: 1
        speed: 2.5 GT/s lanes: 1 bus-ID: 06:00.0 chip-ID: 8086:08b3 class-ID: 0280
      IF: wlp6s0 state: up mac: <filter>
      IP v4: <filter> type: dynamic noprefixroute scope: global
        broadcast: <filter>
      IP v6: <filter> type: dynamic noprefixroute scope: global
      IP v6: <filter> type: noprefixroute scope: link
      Device-2: Realtek RTL810xE PCI Express Fast Ethernet vendor: Dell
        driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: e000
        bus-ID: 07:00.0 chip-ID: 10ec:8136 class-ID: 0200
      IF: enp7s0 state: down mac: <filter>
      WAN IP: <filter>
    Bluetooth:
      Device-1: Intel Bluetooth wireless interface driver: btusb v: 0.8 type: USB
        rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 2-6:3 chip-ID: 8087:07dc
        class-ID: e001
      Report: rfkill ID: hci0 rfk-id: 2 state: down bt-service: disabled
        rfk-block: hardware: no software: yes address: see --recommends
    Logical:
      Message: No logical block device data found.
    RAID:
      Message: No RAID data found.
    Drives:
      Local Storage: total: 685.61 GiB used: 596.02 GiB (86.9%)
      SMART Message: Unable to run smartctl. Root privileges required.
      ID-1: /dev/sda maj-min: 8:0 vendor: Crucial model: CT480BX500SSD1
        size: 447.13 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
        tech: SSD serial: <filter> fw-rev: 054 scheme: GPT
      ID-2: /dev/sdb maj-min: 8:16 vendor: Lexar model: 256GB SSD
        size: 238.47 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
        tech: SSD serial: <filter> fw-rev: 117D scheme: GPT
      Message: No optical or floppy data found.
    Partition:
      ID-1: / raw-size: 82.98 GiB size: 82.98 GiB (100.00%) used: 71.98 GiB (86.7%)
        fs: btrfs dev: /dev/sda4 maj-min: 8:4 label: Manjaro
        uuid: d18277d5-35dd-426d-b08f-1698012272b1
      ID-2: /home raw-size: 82.98 GiB size: 82.98 GiB (100.00%)
        used: 71.98 GiB (86.7%) fs: btrfs dev: /dev/sda4 maj-min: 8:4 label: Manjaro
        uuid: d18277d5-35dd-426d-b08f-1698012272b1
      ID-3: /home/<filter>/mnt/Files raw-size: 355.96 GiB
        size: 355.96 GiB (100.00%) used: 312.24 GiB (87.7%) fs: btrfs dev: /dev/sda3
        maj-min: 8:3 label: Files uuid: 907a1476-33f5-4632-ac05-620c8142c6c2
      ID-4: /home/<filter>/mnt/Files/Desktop/Games raw-size: 238.47 GiB
        size: 234.17 GiB (98.20%) used: 211.78 GiB (90.4%) fs: ext4 dev: /dev/sdb3
        maj-min: 8:19 label: Gamez uuid: 180ef44c-2aad-4868-9a2d-64129e419121
      ID-5: /var/cache raw-size: 82.98 GiB size: 82.98 GiB (100.00%)
        used: 71.98 GiB (86.7%) fs: btrfs dev: /dev/sda4 maj-min: 8:4 label: Manjaro
        uuid: d18277d5-35dd-426d-b08f-1698012272b1
      ID-6: /var/log raw-size: 82.98 GiB size: 82.98 GiB (100.00%)
        used: 71.98 GiB (86.7%) fs: btrfs dev: /dev/sda4 maj-min: 8:4 label: Manjaro
        uuid: d18277d5-35dd-426d-b08f-1698012272b1
    Swap:
      Kernel: swappiness: 10 (default 60) cache-pressure: 100 (default)
      ID-1: swap-1 type: partition size: 8 GiB used: 16.2 MiB (0.2%) priority: -2
        dev: /dev/sda5 maj-min: 8:5 label: SWAP
        uuid: b0a37840-1afd-4537-8e1d-90330ec62d9e
    Unmounted:
      ID-1: /dev/sda1 maj-min: 8:1 size: 100 MiB fs: vfat label: SYSTEM
        uuid: 5456-1C08
    USB:
      Hub-1: 1-0:1 info: full speed or root hub ports: 2 rev: 2.0
        speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
        class-ID: 0900
      Hub-2: 1-1:2 info: Intel Integrated Hub ports: 8 rev: 2.0
        speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 8087:8001
        class-ID: 0900
      Hub-3: 2-0:1 info: hi-speed hub with single TT ports: 11 rev: 2.0
        speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0 chip-ID: 1d6b:0002
        class-ID: 0900
      Device-1: 2-5:2 info: Suyin Integrated_Webcam_HD type: video
        driver: uvcvideo interfaces: 2 rev: 2.0 speed: 480 Mb/s (57.2 MiB/s) lanes: 1
        mode: 2.0 power: 500mA chip-ID: 064e:920b class-ID: 0e02 serial: <filter>
      Device-2: 2-6:3 info: Intel Bluetooth wireless interface type: bluetooth
        driver: btusb interfaces: 2 rev: 2.0 speed: 12 Mb/s (1.4 MiB/s) lanes: 1
        mode: 1.1 power: 100mA chip-ID: 8087:07dc class-ID: e001
      Device-3: 2-8:4 info: Realtek RTS5129 Card Reader Controller
        type: <vendor specific> driver: rtsx_usb,rtsx_usb_ms,rtsx_usb_sdmmc
        interfaces: 1 rev: 2.0 speed: 480 Mb/s (57.2 MiB/s) lanes: 1 mode: 2.0
        power: 500mA chip-ID: 0bda:0129 class-ID: ff00 serial: <filter>
      Hub-4: 3-0:1 info: super-speed hub ports: 4 rev: 3.0
        speed: 5 Gb/s (596.0 MiB/s) lanes: 1 mode: 3.2 gen-1x1 chip-ID: 1d6b:0003
        class-ID: 0900
    Sensors:
      System Temperatures: cpu: 55.0 C mobo: N/A sodimm: SODIMM C
      Fan Speeds (RPM): cpu: 2200
    Info:
      Processes: 297 Uptime: 4h 25m wakeups: 10 Init: systemd v: 253
      default: graphical tool: systemctl Compilers: gcc: 13.1.1 clang: 15.0.7
      Packages: 1901 pm: pacman pkgs: 1858 libs: 538 tools: octopi,pamac,yay
      pm: pkg pkgs: 0 pm: flatpak pkgs: 43 Shell: Zsh v: 5.9 running-in: yakuake
      inxi: 3.3.28

관련 정보