You are not logged in.

#1 2016-12-27 18:24:52

heliumtt
Member
Registered: 2016-12-27
Posts: 27

ACPI battery wake up events

Hello,
First post so forgive the syntax, please...

When on Sleep, I would like to wake up the computer when battery runs low so as to go to hibernate.

I know there is a hybrid suspend. However it takes some time to save to disk.

There are many posts on the web to wake up on RTC. However, I wanted to avoid waking up the computer periodically and drain battery for that if it could stay on sleep longer.

So is there any battery triggered event for that ?

I did not see any event for that in
/proc/acpi/wakeup:

Device  S-state   Status   Sysfs node
LID0      S4    *enabled   platform:PNP0C0D:00
LANC      S5    *enabled   pci:0000:02:00.0
USB1      S3    *enabled   pci:0000:00:1d.0
USB2      S3    *enabled   pci:0000:00:1d.1
USB7      S3    *enabled   pci:0000:00:1d.7

When I look inside the battery folder (see below), I do not see anything like a wakeup file that I could activate hoping it would populate the /proc/acpi/wakeup.

So is there any way to create an event for that ?
Or if it is not shown, that just means my BIOS does not support it ?
Or does it just exist on no laptop ?

Thanks in advance !


Btw: Running Linux xxxx 4.8.13-1-ARCH #1 SMP PREEMPT Fri Dec 9 07:43:17 CET 2016 i686 GNU/Linux

In /sys/device/:

./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/charge_full
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/manufacturer
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/cycle_count
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/device
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/capacity_level
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/model_name
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/voltage_min_design
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/present
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/charge_now
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/subsystem
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/capacity
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/technology
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/charge_full_design
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/power
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/power/runtime_active_kids
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/power/runtime_suspended_time
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/power/autosuspend_delay_ms
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/power/runtime_enabled
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/power/runtime_active_time
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/power/control
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/power/async
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/power/runtime_usage
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/power/runtime_status
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/type
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/status
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/serial_number
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/voltage_now
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/alarm
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/current_now
./LNXSYBUS:00/PNP0C0A:00/power_supply/BAT1/uevent

Offline

#2 2016-12-30 16:55:49

heliumtt
Member
Registered: 2016-12-27
Posts: 27

Re: ACPI battery wake up events

Hi, I found the following:

kernel code: drivers/battery.c 
.....
 	return device_create_file(battery->bat.dev, &alarm_attr);
......


+	 * Wakeup the system if battery is critical low
+	 * or lower than the alarm level
+	 */
+	if ((battery->state & ACPI_BATTERY_STATE_CRITICAL) ||
+	    (test_bit(ACPI_BATTERY_ALARM_PRESENT, &battery->flags) &&
+            (battery->capacity_now <= battery->alarm)))
+		pm_wakeup_event(&battery->device->dev, 0);

Can some code be executed when suspended ?!
If my /sys tree and /proc/acpi/wakeup does not show the battery, does it mean the even is not supported by my hardware (so cannot trigger BIOS wake up) ?
Or is there always something I can do to register the device in  /proc/wakeup ?

Thanks in advance !

Offline

Board footer

Powered by FluxBB