Share your knowledge at the LQ Wiki.
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 02-01-2013, 02:26 PM   #1
LQ Newbie
Registered: Feb 2013
Posts: 1

Rep: Reputation: Disabled
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-01-2013 at 11:27 PM.
Old 02-02-2013, 01:32 PM   #2
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,869

Rep: Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913Reputation: 913
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
No suspend on lid close AllanP Linux - Laptop and Netbook 26 05-19-2012 12:38 PM
Do nothing on close lid hda7 Debian 2 01-03-2012 10:15 AM
[SOLVED] How can I close lid without sleep? tquang Linux - Laptop and Netbook 5 07-12-2011 02:42 AM
Lid Close = Sleep mangogreg Linux - Hardware 2 08-28-2008 03:17 PM
lid action with different kernels terran4000 Linux - Laptop and Netbook 1 05-18-2004 10:45 PM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 03:16 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration