You are not logged in.
Pages: 1
I am trying to run a udev rule for charge plugged or unplugged it is working but multiple times.
I read the guide on writing udev rules (http://reactivated.net/writing_udev_rules.html) and found followed the procedure, and created rule by writing properties of the target device and choose one parent and write its properties in the udev rule
rule for charger plugged looks like this:
KERNEL=="BAT0", SUBSYSTEM=="power_supply", ATTR{status}=="Charging", SUBSYSTEMS=="acpi", DRIVERS=="battery", RUN+="/home/username/scripts/udev/cnchr.sh"and its attributes look like this (https://paste.rs/IgD) This url contains the all attributes for BAT0, ones which i have used are below
looking at device '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:01/PNP0C0A:03/power_supply/BAT0':
KERNEL=="BAT0"
SUBSYSTEM=="power_supply"
DRIVER==""
ATTR{alarm}=="4215000"
ATTR{capacity}=="95"
ATTR{capacity_level}=="Normal"
ATTR{charge_control_end_threshold}=="100"
ATTR{cycle_count}=="233"
ATTR{energy_full}=="30330000"
ATTR{energy_full_design}=="42157000"
ATTR{energy_now}=="29002000"
ATTR{manufacturer}=="ASUSTeK"
ATTR{model_name}=="ASUS Battery"
ATTR{power/control}=="auto"
ATTR{power/runtime_active_time}=="0"
ATTR{power/runtime_status}=="unsupported"
ATTR{power/runtime_suspended_time}=="0"
ATTR{power_now}=="4954000"
ATTR{present}=="1"
ATTR{serial_number}==" "
ATTR{status}=="Charging"
ATTR{technology}=="Li-ion"
ATTR{type}=="Battery"
ATTR{voltage_min_design}=="11550000"
ATTR{voltage_now}=="11550000"
looking at parent device '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:19/PNP0C09:01/PNP0C0A:03':
KERNELS=="PNP0C0A:03"
SUBSYSTEMS=="acpi"
DRIVERS=="battery"
ATTRS{hid}=="PNP0C0A"
ATTRS{path}=="\_SB_.PCI0.LPCB.EC0_.BAT0"
ATTRS{power/control}=="auto"
ATTRS{power/runtime_active_time}=="0"
ATTRS{power/runtime_status}=="unsupported"
ATTRS{power/runtime_suspended_time}=="0"
ATTRS{power/wakeup}=="enabled"
ATTRS{power/wakeup_abort_count}=="0"
ATTRS{power/wakeup_active}=="0"
ATTRS{power/wakeup_active_count}=="0"
ATTRS{power/wakeup_count}=="0"
ATTRS{power/wakeup_expire_count}=="0"
ATTRS{power/wakeup_last_time_ms}=="0"
ATTRS{power/wakeup_max_time_ms}=="0"
ATTRS{power/wakeup_total_time_ms}=="0"
ATTRS{status}=="31"
ATTRS{uid}=="0"the udev rules are working fine but running twice. but i want it to run ones only. How can i correct my udev rule so that it will run once only
Last edited by lucifier13 (2021-05-21 18:25:51)
Offline
You're aware of https://wiki.archlinux.org/title/Acpid ?
There's also an example in the wiki that handles ac/battery changes: https://wiki.archlinux.org/title/Udev#T … _udev_rule
=> What (edit: "event") are you really interested in?
Last edited by seth (2021-05-21 20:41:41)
Offline
Pages: 1