op_power.sh and unsuspend with the lid closed.


FBnil

They'll own everything and be miserable.
Joined
Dec 14, 2012
Messages
5,118
Location
Yurp
I have a problem sinds the latest patch. When I resume my pandora, with the lid closed, the display light goes on.

The culprit is /usr/pandora/scripts/op_power.sh it does not hold a single state for "buttonlowpower", from "liddisplayoff" or "on", so there is no powerstate called "buttonlowpower_liddisplayoff".

The solution would be writing a second bit of information in /tmp/powerstate. I've fiddled with a /tmp/led and so far it works, only, I am intrigued by:


if [[ "$1" == 0 ]]; then # lid was opened
if [[ "$powerstate" == lid* ]]; then

which I had to change to


if [[ "$1" == 0 ]]; then # lid was opened
echo "open" > /tmp/lid
if [[ "$powerstate" == * ]]; then

My question here is why "lid*" ? Am I breaking something here for other configurations?

Also, is there a way I can read the lid status without having to write my own files to the internal disk?

op_power.sh.zip
 

Attachments

  • op_power.sh.zip
    3.5 KB · Views: 226
oof.

Explaining a bit here: I want to be able to read the state of the lid. Unfortunately, that is like a keypress, and can only be read by code that looks like the pandora input tester: http://git.openpandora.org/cgi-bin/gitweb.cgi?p=pandora-misc.git;a=blob;f=op_test_inputs.c;hb=HEAD

Now, if you remark /usr/pandora/scripts/op_lid.sh (this file is triggered to enable/disable the display), so it does nothing. Now you open the Input Tester program (menu/system/Pandora Input-Tester or just /usr/bin/op_test_inputs , which is just 328 bytes), and using a magnet, like the one in your earphone, put your earphone next to the letter P.

The "LID" becomes green and stays green, which means while the lid is closed, the "lid key" is pressed. So, this is our way to test this.

To test it, I first used a python script, where you need to ennumerate the filename = "/dev/input/event{ :D }".format(devnum), find the "gpio-keys" and get EVIOCGBIT, but man... I'd rather have files created on the nand (just one extra line in op_lid.sh which is triggered by the lid close/open) than creating a C script that reads the value.

Nevertheless, a nice project for another weekend... compile under the pandora...
 
Last edited by a moderator:
Back
Top