LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   Custom action on lid close (https://www.linuxquestions.org/questions/linux-hardware-18/custom-action-on-lid-close-4175448216/)

zylak007 02-01-2013 02:26 PM

Custom action on lid close
 
Hello,
I'm having an issue with my lid "button". Normally it would detect a little magnet in the top of my screen when it is closed - this part works great. Unfortunately it also triggers randomly when there is a slight press on the area where the "button" is located. I have set action "nothing" on lid close in system settings (it's quite better than suspend) still my screen goes blank. This way from time to time my screen starts to flicker - really annoying.

I decided that I'm not going to solve this in hardware - instead I'd like to set a custom action for lid close event. More specifically I'd like to turn the screen off when the lid is closed for more than a second. This should work, as false signals from lid button last just for fractions of a second. Setting action to true "do nothing" would satisfy me just as well.

I'm running Ubuntu 12.04.1 LTS 64 bit with kernel 3.2.0-37-generic on Acer Aspire 7741G. The problem is irrelevant to OS - the button also behaves badly in Windows and BIOS. It started more than 1.5 years ago, but it wouldn't happen as often as now.

I don't know if this is going to help but I can check the current state of lid by reading '/proc/acpi/button/lid/LID0/state' - it is either "state: open" or "state: closed". I'm sure there is a way to control the behavior on lid close. I've had a situation, when somehow ACPI control functions of Linux got screwed - the file listed above would output "state: unsupported" instead and it seemed that BIOS took over the work of turning the screen off (it started to flicker instantly, without any lag - just as it does in BIOS). After restarting computer it was back to normal again. This shows that OS does control action on lid close - I need to find a way to change it.

business_kid 02-02-2013 01:32 PM

go at it the old fashioned way: Stop acpid; restart at once with acpid -l; tail -f on syslog, and you'll notice the acpi events show in the log.

Find your lidbutton event. That will probably be an event in /etc/acpi/events, which will call a script in /etc/acpi. Hack that script to your taste.


All times are GMT -5. The time now is 08:52 PM.