You are not logged in.

#1 2012-12-19 04:45:01

ninjaaron
Member
Registered: 2010-12-10
Posts: 296

made solution to HP Folio 13 lid issue. Add to wiki?

I've never edited the wiki (I figured I would generally leave that to the CS students/professionals), but I have this laptop, and it says there:

Suspending manually (pm-suspend) works, comes back with all devices OK. Lid switch ACPI events do not work.

This is true. However, I made a stupid workaround. There is a file, /proc/acpi/button/lid/LID0/state, and it tells whether the lid is opened or closed. I wrote a bash script that reads this file every two-and-a-half seconds (tail -f doesn't seem to work because the file doesn't get longer, it is overwritten), and if the lid is closed, it suspends.

I'm not sure if there is a better way to do this, or if it is worth adding to the wiki even with improvements. Most likely, If I got this information (about this file) to the right person, someone could make it so acpid would register an event when the lid closes. I just don't really know anything about this stuff, but I did get suspend on lid close to work (it already wakes up on lid open, which is kinda funny (it registers as button with xev, unlike lid close), so there was no need to do anything with that).

anyway, here is the script. criticisms welcome:

#!/bin/bash

while true ; do
var=( $(</proc/acpi/button/lid/LID0/state) )
[[ ${var[1]} = "closed" ]] && sudo pm-suspend
sleep 2.5
done

I added this to .xinitrc cause I'm too cluelessi/lazy to figure out how to write daemons for systmed. rc.local doesn't do anything, and the workaround I use to make it work doesn't work unless my system takes longer than 3.5s to boot (cool, right?), which is basically impossible with systemd+SSD.

Last edited by ninjaaron (2012-12-25 21:06:30)

Offline

#2 2012-12-19 19:11:00

ConnorBehan
Package Maintainer (PM)
From: Long Island NY
Registered: 2007-07-05
Posts: 1,359
Website

Re: made solution to HP Folio 13 lid issue. Add to wiki?

It looks like there is a better way: getting acpid to check the same /proc file instead of a dedicated bash script with an infinite loop.


6EA3 F3F3 B908 2632 A9CB E931 D53A 0445 B47A 0DAB
Great things come in tar.xz packages.

Offline

#3 2012-12-20 21:12:36

ninjaaron
Member
Registered: 2010-12-10
Posts: 296

Re: made solution to HP Folio 13 lid issue. Add to wiki?

I just tried this, but it doesn't work. As the wiki says, acpid doesn't register an event with the lid, so handler.sh isn't run when the lid closes. xev registers a button on open, but not on close, so a keybinding doesn't work either.

Also tried it with inotifywait to avoid using cat every two seconds, but it didn't work on this file (because it's in /proc?)

Any other ideas before we give in to the tantalizing power of the infinite loop?

For what it's worth, the script doesn't even register a blip on my cpu. It's nothing compared to conky.

Last edited by ninjaaron (2012-12-20 21:16:51)

Offline

#4 2012-12-24 18:38:31

ninjaaron
Member
Registered: 2010-12-10
Posts: 296

Re: made solution to HP Folio 13 lid issue. Add to wiki?

So, I guess the consensus is that this is a terrible solution, but nothing else works?

Offline

#5 2012-12-24 19:13:18

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: made solution to HP Folio 13 lid issue. Add to wiki?

You can add it to the wiki with a note that it is a bit of a hack and people can use it under advisement.

Slightly OT, but

var=( $(</proc/acpi/button/lid/LID0/state) )

makes kitty happy...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#6 2012-12-25 21:04:07

ninjaaron
Member
Registered: 2010-12-10
Posts: 296

Re: made solution to HP Folio 13 lid issue. Add to wiki?

alright, I added it to the wiki. The write up is probably horrible, but there it is.

Last edited by ninjaaron (2012-12-25 22:11:16)

Offline

Board footer

Powered by FluxBB