View Single Post
Old 07-15-2012, 01:16 AM   #145
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
Quote:
Originally Posted by cyclops0000 View Post
so would the waitforkey command or whatever i end up using to shutdown the player, how would i implement it into the kindle? would i ave to repack the videoplayer or something, or would i just need to add a command to execute the script when i launch the videoplayer?
You can use "waitforkey" in a script, but it stalls waiting for input. I ran it (in a script) in the background by appending an "&" (to the script) and piped waitforkey output "> /tmp/keypress". It ran in a loop so it would restart after storing a keycode.The foreground script would read /tmp/keypress with "cat /tmp/keypress" and then after seeing a keypress write a "0 0" for "no keypress" back to the file. It would periodically check that file during its main run loop (which also contained a sleep call and only checked for keypresses about 10 times per second). Yes a hack, but it worked well for my needs. I am sure there is a better way, but sometimes getting a hack working quickly is better than giving up in frustration while trying to figure out "the RIGHT way" to do something.

You can also process keypresses by reading the binary /dev/event* device data for the keyboard (using hexdump from a script, or in a C program).

There are other ways to, but they would require more research.

Last edited by geekmaster; 07-15-2012 at 09:20 AM.
geekmaster is offline   Reply With Quote