Ubuntu

Comment 30 for bug 261084

binary.koala (binary-koala) wrote :

confirm the bug on Thinkpad x200 and x61s, both machines behave the same way on intrepid 8.10 (all latest).
when i press Fn+F4 suspend happens, but on the next resume machine suspends again.

INTERESTING - if Transmission (bittorrent) is running g-p-m shows two messages about "policy preventing suspend"
LOOKS like acpid and g-p-m are both catching the same events.
HOWEVER, I was digging into the problem, and here are my findings:

1. running acpid in debug shows only one ACPI event and only one run of /etc/acpi/sleepbtn.sh
---
acpid: received event "ibm/hotkey HKEY 00000080 00001004"
acpid: rule from 5589[0:0] matched
acpid: notifying client 5589[0:0]
acpid: rule from 5509[111:123] matched
acpid: notifying client 5509[111:123]
acpid: rule from /etc/acpi/events/ibm-sleepbtn matched
acpid: executing action "/etc/acpi/sleepbtn.sh"
BEGIN HANDLER MESSAGES
END HANDLER MESSAGES
---

2. g-p-m in verbose mode shows _twice_ "Button press event type=sleep"
---
TI:22:30:55 TH:0x91ad640 FI:gpm-button.c FN:hal_device_condition_cb,430
 - condition=ButtonPressed, details=sleep
TI:22:30:55 TH:0x91ad640 FI:gpm-button.c FN:emit_button_pressed,374
 - emitting button-pressed : sleep
TI:22:30:55 TH:0x91ad640 FI:gpm-manager.c FN:button_pressed_cb,1020
 - Button press event type=sleep
[snip]
 - Button press event type=sleep
TI:22:31:11 TH:0x91ad640 FI:gpm-backlight.c FN:gpm_backlight_button_pressed_cb,536
 - Button press event type=sleep
TI:22:31:11 TH:0x91ad640 FI:gpm-info.c FN:button_pressed_cb,679
 - Button press event type=sleep
TI:22:31:11 TH:0x91ad640 FI:gpm-button.c FN:gpm_button_filter_x_events,122

3. when acpid triggers sleepbtn.sh it sends 'acpi_fakekey $KEY_SLEEP' . in my system $KEY_SLEEP has code 142
and if i do manually 'sudo acpi_fakekey 142' my system suspends and resumes correctly.

4. if i stop acpid with 'sudo /etc/init.d/acpid stop' and then suspend it also works correctly.

THE QUESTION IS why g-p-m works correctly without acpid ? If that is intended why both are running doubling like this the events?

My fix for now is just to comment out "acpi_fakekey $KEY_SLEEP" in /etc/acpi/sleepbtn.sh:
---
test -f /usr/share/acpi-support/key-constants || exit 0

. /usr/share/acpi-support/key-constants
# acpi_fakekey $KEY_SLEEP
---