sleep/wake hinge function?


segaprophet

Member
Joined
Apr 19, 2009
Messages
77
Location
The People's Technocratic Republic of Vinnland
I was wondering if it's currently planned for the DP to include a sleep/wake or suspend function for the hinge, in order to provide similar behavior as other clamshell consoles, such as 3DS.

If not, how complicated or technically involved would it be to design a sensor that detects the position of the hinge and can trigger some software calls to sleep and then wake the DP?
 
We have this capability already on the Pandora.. Its kinda of a given that it will be on the pyra as well.
 
It's a configuration option on the Pandora - by default it just turns off the screen, but it can be configured to turn pretty much everything off. I don't use that setting though, as I often use it as a music player with the lid closed.


I hope the Pyra case means the hinge detection thing is a bit more robust, or at least the software is more immune to the lid being opened momentarily, and shutting off the screen when it closes again. Nearly every time I carry my Pandora without a case in my back pocket around the house, when I pull it out again the lid is still closed, yet the screen is now on eating the battery up. I've no idea how that happens, as the only way I can reproduce that is to open the lid a few centimeters before closing it again almost immediately, and in my pocket it certainly can't open that far. Perhaps the case it getting deformed in some other way, causing the magnet to move too far from the sensor in another way, or hopefully less drastically, there are some significant localised magnetic fields around my house which counteract the lid speaker magnet, although I don't make a habit of walking behind my big loudspeakers, so I don't know where they'd be otherwise.
 
By default the action is to just blank the screen, but the lid actions can be changed to sleep mode.


Edit: Ninja'd by Levi.
 
Last edited by a moderator:
I've just been having a poke around in the /usr/pandora/scripts folder, but it seems the magic numbers to poll the state of the hall-effect sensor is not to be found there (guess I'll have to go through the git source at some point then). But it strikes me that my woes might be alleviated by some sort of cron job or the likes that checks the lid state every fifteen minutes or whatever while the screen is on, and invokes the lid closed operation if it's found to be actually closed then.
 
The hall sensor is treated as a button, you can poll it just like any other button but I forget what its code is.

What you are looking for is in either the pndnotifyd or pndevmapperd, I forget which. Get a copy of the source and you should be able to find it.

You could probably also do up an SDL app that just reads full keyboard state and tells you which one changed, close and open the lid a few times.
 
AFAIK There is a Pandora lid close option somewhere in he settings menu already.
 
The hall sensor is treated as a button, you can poll it just like any other button but I forget what its code is.

What you are looking for is in either the pndnotifyd or pndevmapperd, I forget which. Get a copy of the source and you should be able to find it.

You could probably also do up an SDL app that just reads full keyboard state and tells you which one changed, close and open the lid a few times.
What DraStic does:

Code:
struct input_event event;

read_bytes = read(device_handle_gpio_keys, &event, sizeof(event));

...

if((event.type == EV_SW) && (event.code == SW_LID))
{
  read_data++;

  if(event.value == 1)
    input->hinge_closed = 1;
  else
    input->hinge_closed = 0;
}
device_gpio_keys is whichever /dev/input/eventX that has the device_probe_name "gpio-keys" (the one you read the buttons from)
 
Back
Top