lid-close/lid-open signals?


F_Slim

IDDQD
Joined
Aug 25, 2010
Messages
1,429
Age
44
Location
Germany
Hi,

is there a way to catch the lid-close/lid-open signals from the system from within Python?

It's for my Xplanet frontend  http://boards.openpandora.org/index.php/topic/11408-application-xplanet-with-custom-frontendlauncher/

The frontend uses pygtk. I'm running Xplanet as a subprocess with gogo=subprocess.Popen(...) when a toggle-button is pressed, and would like to stop it with gogo.terminate() when the lid is closed or re-start it when the lid is opened again.

I'd also be gratefull for additional hints on how to implement this, since I have no idea how I would go about monitoring for a signal or even key-press in python ...

thanks!
 
Last edited by a moderator:
oh man ... after hours I finally managed to at least somehow unpack and read some those event* files in /dev/input/, but all I get is numbers. No idea how to figure out which file even holds the info I need from that! :blink: I was expecting to at least find a string like "SW_LID", "KEY_0" or whatever to make some sense out of this ...

I learned that the Raspberry-Pi has a python module to give you access to whatever button(s) it has ... looks like figuring this out will be enough work to just write such a module for the Pandora from scratch (at least for me)?

Not sure if this feature is high enough on my priority-list to take up on such a task though :p

Is there really no other way?
 
I get more and more respect for those of you who regulary port and/or write software for the Pandora (already had huge respect before though).

This is now the second evening I'm trying to "just pack it up as PND and upload a beta or testing". :blink:

I had everything working smoothly, so no problem, right? I wish it was that easy, but I'm failing on every possible level :(

First I thought I could just write to "./" and things would end up in the appdata folder (after all this was perfectly fine with the two Java-apps I packed up as .PNDs), but obviously that's not how it works.

Creating a HOME folder in /mtn/utmp/<application-id>/ does enable me to write things to .../appdata/<application-id>/home ... at least something, but I had to go through my code and change most of the paths (since for some reason relative paths may cause problems, too ... another thing that cost me a day or to to figure out). Now I face other path-related problems, because my application-id is xplanet.fs.000 (to make sure is unique, following the suggestions in the wiki), but of course while setting everything up I had just "xplanet" in mind as name ... I guess an easy fix would be to just edit the PXML. Not sure if the application-id and the "other" application-id you have to set has to be the same, and which one is for the repo and which one names your folders. I'm going figure it out somehow ... I may have to think of another way to set up my folders now anyway ...

Still, if you have a normal job and go to work every day, something like this causes delays of several days and feels like a huge setback. You only have a few hours in the evening on just a few days in the week to do things (weekends are also filled) and it's easy to get frustrated if after a long day even what you are doing "for fun" isn't working right, and everything you build up and tested and bugfixed for weeks suddenly stops working or causes problems. :unsure:

(It's just a simple GUI, how hard can it be, right? :p )

Still looking for a way to catch the lid-close signal without writing an entire python-module to catch arbitrary key-events for the Pandora by the way ;)

http://boards.openpandora.org/index.php/topic/11808-lid-closelid-open-signals/
 
Last edited by a moderator:
I cannot help you with the lid, but I do feel the same about the fustration of PNDing things and the time it takes, and the weedend flyies and so on !
 
If you have a look into sebt3's toolchain and if you can use his scripts like pndmakeauto, genpxml etc., the task becomes less timeconsuming.


Did you incorporate them into your pnd btw?
 
-ups-

I intended to put my last post in the Xplanet post in the Dragonbox-Compo sub-forum ... how did it get here? :ph34r:

Currently I'm using an old version of Foxblock's PNDTools ... maybe I should have a look at Sebt3's toolchain, but that's for cross-compiling, right? I do almost everything directly on my Pandora.

Back to topic:

I finally found out that pygtk has some means of event-handling: http://www.pygtk.org/pygtk2tutorial/sec-EventHandling.html but I still have no idea if and/or how this can get the lid-events. I'll report back if I find out. (Looks like this only works for an active window though.)
 
Back
Top