Custom action on lid close
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.
Last edited by zylak007; 02-02-2013 at 12:27 AM.