You are not logged in.

#26 2013-02-13 12:28:01

eruditorum
Member
Registered: 2012-11-12
Posts: 130

Re: Auto hibernate on low battery W/O laptop-mode or pm-utils

Do a find for a "BAT" in /sys:

:find /sys|grep BAT

On my system there is BAT1 entry and battery sends udev event on discharging by 1 percent.

Last edited by eruditorum (2013-02-13 12:40:54)

Offline

#27 2013-02-13 12:39:30

Lockheed
Member
Registered: 2010-03-16
Posts: 1,440

Re: Auto hibernate on low battery W/O laptop-mode or pm-utils

Ok, so I have BAT0

  looking at device '/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0A08:00/device:00/PNP0C09:00/PNP0C0A:00/power_supply/BAT0':
    KERNEL=="BAT0"
    SUBSYSTEM=="power_supply"
    DRIVER==""
    ATTR{type}=="Battery"
    ATTR{power_now}=="0"
    ATTR{alarm}=="2045000"
    ATTR{capacity}=="97"
    ATTR{status}=="Unknown"
    ATTR{voltage_now}=="12471000"
    ATTR{energy_now}=="40080000"
    ATTR{model_name}=="42T5233"
    ATTR{manufacturer}=="Panasonic"
    ATTR{technology}=="Li-ion"
    ATTR{cycle_count}=="0"
    ATTR{energy_full_design}=="51830000"
    ATTR{voltage_min_design}=="10800000"
    ATTR{serial_number}==" 1954"
    ATTR{energy_full}=="40900000"
    ATTR{present}=="1"

and I wrote the rule
/etc/udev/rules.d/85-autohibernate.rules

## SLEEP/HIBERNATE IF BATTERY IS LOW
SUBSYSTEM=="power_supply", ATTR{type}=="Battery", ATTR{status}=="Discharging", ATTR{capacity}=="95", RUN+="/usr/bin/systemctl suspend"

but it does not sleep on or below 95%.


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#28 2013-02-13 12:45:25

eruditorum
Member
Registered: 2012-11-12
Posts: 130

Re: Auto hibernate on low battery W/O laptop-mode or pm-utils

Did you forget to do udevadm control --reload as root after writing the rule?

If that really doesn't work, try to remove ATTR{status} from the rule (as I see "Unknown" in your udev info), and instead of systemd provide your own script.
In the script you determine whether ac is on or not and then hibernate.

Last edited by eruditorum (2013-02-13 12:50:01)

Offline

#29 2013-02-13 13:23:47

Lockheed
Member
Registered: 2010-03-16
Posts: 1,440

Re: Auto hibernate on low battery W/O laptop-mode or pm-utils

eruditorum wrote:

Did you forget to do udevadm control --reload as root after writing the rule?

Yes, I did. But as I run it now with battery at 55%, the system still not hibernates, which bares the question whether it is because the rule runs only on = instaed of <=.


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

#30 2013-02-13 14:05:34

eruditorum
Member
Registered: 2012-11-12
Posts: 130

Re: Auto hibernate on low battery W/O laptop-mode or pm-utils

only on "==" or "!=".

You can use "!=" or completely remove ATTR{capacity}=="95", and check the charge in script instead!

Last edited by eruditorum (2013-02-13 14:10:25)

Offline

#31 2013-02-13 16:08:54

Lockheed
Member
Registered: 2010-03-16
Posts: 1,440

Re: Auto hibernate on low battery W/O laptop-mode or pm-utils

I changed it to != and computer did not sleep on 95%. Instead, it went to sleep at 80%...
What's going on?


Laptop: ThinkPad W500, C2D P9500, 8GB, Radeon RV635 (HD3650), Arch | Server/fw: Zotac AQ01, A4-5000 Kabini, 4GB, Arch/pfSense VM

Offline

Board footer

Powered by FluxBB