View Single Post
Old 07-15-2012, 10:01 AM   #12
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 PoP View Post
I always wanted to be able to detect the jack. How? On my K3 cat /dev/input/event0 shows the keyboard cat /dev/input/event1 shows the fiveway cat /dev/input/event2 shows the volume but none of these events show insertion or removal ot the headphone jack.

And waitforkey just sits waiting as you plug in and out the jack. Different version? Bad doc?
Code:
[root@kindle root]# ls -all /usr/bin/waitforkey
-rwxr-xr-x    1 root     root         4604 Jul 31  2010 /usr/bin/waitforkey
[root@kindle root]# cat /usr/bin/waitforkey | md5sum
3d0e60680eba05a8f88667eb31b7c197  -
[root@kindle root]#
Does waitforkey return a keycode for headphone events on your K3?

Because waitforkey does WAIT for an event, I ran it in a background loop and piped its output to a temp file. Then a foreground script could periodically check that file to see if any new keycodes had been generated.

Firmware 5.0.x also returned rotation events for waitforkey. Perhaps 5.1.0 removed headphone events too, when they removed accelerometer events.

UPDATE: I just tested this from K5 diags SSH, and waitforkey DOES return headphone keycodes (insert=60 remove=59). It is not reliably seeing all events though (but my headphone jack seems "loose and sloppy" so maybe the switch is not working right). I used to test my scripts in diags because it has a lot more free ram than main with cvm and Xorg running.

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