Nubs Joystick Mode - Best Practice?


crow_riot

Well-Known Member
Joined
Sep 21, 2009
Messages
1,763
Location
.at
in audiorace, i set the nub to joystick mode at the very beginning in the startup script, and reset them back to their original values afterward.
this - from what i've encountered - only works if the app closes correctly, if it crashes, not.

is there any other way to safely set the nubs to the joystick mode and they magically reset back to the users defaults? how'd you solve that problem?

i don't know if it's possible, could there be something like a per-process based nub state or something?
or just an additional mode in libpnd, reading out the absolute values despite the nub mode settings?
 
If the app crashes, your script can set the modes back.
That is the recommended practice -- so that if the app crashes, the wrapper script can clean up things.

ie: it should always be ..

User runs pnd
pnd_run.sh kicks up the run-script
run-script sets anything up
run-script runs the app
run-script unsets anything up
pnd_run.sh exits

If the app exits normally or crashes should be the same to the run-script, it should clean up.

Some apps need no run-script (no LD_LIBRARY_PATH stuff, no setup, no reporting to user that roms are missing or the like, etc etc), and so just have the PXML specify the bary to run; but I think most use a run-script which in turn runs the app -- that is best practice.

If that doesn't work you're implying the /proc interfaces aren't updating if something recently had them open? race condition? drop a 'sleep 1' in there after app closes/crashes?

The nub-mode changes how the kernel reports the data; making it per process would be lots of work .. over to notaz :)

jeff
 
thanks for clearing it up!
seems i'm doing everything correct in "pnd" space - just wanted to be safe :)

i think i recall what the real problem was ...
i was play/testing the game and the battery warning led started blinking;
lazy as i am i just kept ignoring it and when the pandora shutdown forcibly, the nub mode was still set absolute. :rolleyes:
 
I believe if the application freezes and you are forced to kill it by holding the Pandora button for 4 seconds, that will kill the entire process including the run script which would have reset everything back, but that should happen so rarely it's probably not worth hacking around.
 
Back
Top