WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: [Solved] acpid does not recognize Thinkpad's sleep button  (Read 1571 times)

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 12629
Re: acpid does not recognize Thinkpad's sleep button
« Reply #45 on: November 20, 2020, 05:27:04 AM »
It might be something to do with using xf86-input-libinput versus xf86-input-evdev?

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 8393
Re: acpid does not recognize Thinkpad's sleep button
« Reply #46 on: November 20, 2020, 05:36:36 AM »
Hi GNUser
I wonder if another application (window manager, gnome, ... ??) is grabbing that key combination for it's own use.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 668
Re: acpid does not recognize Thinkpad's sleep button
« Reply #47 on: November 20, 2020, 05:53:42 AM »
I noticed that if I boot with an empty  onboot.lst  then /dev/input/event0 exists.

If I add just these two lines to onboot.lst, then there is no /dev/input/event0 when booting is complete:
Code: [Select]
Xorg-7.7.tcz
xf86-video-intel.tcz

I will try editing Xorg-7.7.tcz.dep so that it pulls in xf86-input-evdev instead of xf86-input-libinput and will report back.
« Last Edit: November 20, 2020, 06:03:14 AM by GNUser »

Offline GNUser

  • Hero Member
  • *****
  • Posts: 668
Re: acpid does not recognize Thinkpad's sleep button
« Reply #48 on: November 20, 2020, 06:04:38 AM »
Using xf86-input-evdev made no difference. Some other part of the Xorg/video stack is to blame.

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 8393
Re: acpid does not recognize Thinkpad's sleep button
« Reply #49 on: November 20, 2020, 06:05:19 AM »
Hi GNUse
I noticed that if I boot with an empty  onboot.lst  then /dev/input/event0 exists. ...
Yes, but is that event tied to the sleep key? Or maybe it's just part of the default root file system included in the  initrd.
If you unpack  rootfs64.gz  or  corepure64.gz  found here:
http://tinycorelinux.net/11.x/x86_64/release/distribution_files/
you will find they contain a pre-populated  /dev  directory.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 668
Re: acpid does not recognize Thinkpad's sleep button
« Reply #50 on: November 20, 2020, 06:26:22 AM »
Hi, Rich. Yes, /dev/input/event0 exists when onboot.lst is empty, and catting it shows output when (and only when) sleep button is pressed.

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 12629
Re: acpid does not recognize Thinkpad's sleep button
« Reply #51 on: November 20, 2020, 07:39:08 AM »
I wonder if another application (window manager, gnome, ... ??) is grabbing that key combination for it's own use.

gnome-session automatically invokes sleep after a set period when run on CorePure64, but I can't recall if the sleep button works or not.

Offline GNUser

  • Hero Member
  • *****
  • Posts: 668
Re: acpid does not recognize Thinkpad's sleep button
« Reply #52 on: November 20, 2020, 08:40:44 AM »
It wasn't the "base" boot command that was making the problem go away; it was the "norestore" boot command. I had a startup shell script in ~/.X.d/ to disable my Lid Switch. Unfortunately, the script was a bit heavy-handed and was also disabling the Sleep Button with this line:

Code: [Select]
sudo sh -c 'echo PNP0C0E:00 >/sys/bus/acpi/drivers/button/unbind'
Commenting-out that line made all the problems go away. Please forgive me for the noise. I'm so embarrassed...  :-[

Thread may be marked as "Solved".

Offline GNUser

  • Hero Member
  • *****
  • Posts: 668
Re: acpid does not recognize Thinkpad's sleep button
« Reply #53 on: November 20, 2020, 08:53:26 AM »
So it turns out that no extensions are needed for the Sleep Button to be detected on my X200 ThinkPad (neither acpid.tcz nor acpitool.tcz nor thinkpad-acpi-KERNEL.tcz).

udev detects the button at boot and creates /dev/input/eventX (in my case, /dev/input/event0). After that, Xorg automatically detects the button as an xinput device (both "cat /var/log/Xorg.0.log" and "xinput --list" confirm this). It is curious that a single button is treated as its own separate input device, but the udev/Xorg creators must have had their reasons.

Now all I have to do is to bind  XF86Sleep  to some action. I use  sxhkd.tcz  to manage my keyboard shortcuts, so will associate  XF86Sleep  with sudo sh -c "echo mem >/sys/power/state" in  ~/.config/sxhkd/sxhkdrc  and all will be well :)

And the Sleep Button (Fn+F4) lived happily ever after.
« Last Edit: November 20, 2020, 08:55:35 AM by GNUser »

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 8393
Re: [Solved] acpid does not recognize Thinkpad's sleep button
« Reply #54 on: November 20, 2020, 09:12:59 AM »
Hi GNUse
I wonder if another application (window manager, gnome, ... ??) is grabbing that key combination for it's own use.
So in a way I was right, except it wasn't an application grabbing the key, it was your script. ;D

Offline GNUser

  • Hero Member
  • *****
  • Posts: 668
Re: [Solved] acpid does not recognize Thinkpad's sleep button
« Reply #55 on: November 20, 2020, 09:35:36 AM »
Yes, absolutely. It was your comment that caused me to scrutinize my startup applications and scripts. As always, thank you very much! Your resourcefulness has helped me get on the right track (after going around in circles) time and again.