Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 07-14-2012, 11:58 PM   #1
inuxy
Junior Member
inuxy began at the beginning.
 
Posts: 8
Karma: 12
Join Date: Jul 2012
Device: kindle touch
Simulating Button Presses Externally

I have a kindle touch and I was wondering what would be required to send button press events externally with a cable. Ideally I would want to be able to send these through a microcontroller.

Not sure how it works but it would be awesome if it was just a serial connection.

Any input or ideas would be helpful, thanks.
inuxy is offline   Reply With Quote
Old 07-15-2012, 12:06 AM   #2
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 inuxy View Post
I have a kindle touch and I was wondering what would be required to send button press events externally with a cable. Ideally I would want to be able to send these through a microcontroller.

Not sure how it works but it would be awesome if it was just a serial connection.

Any input or ideas would be helpful, thanks.
On the K5, the serial port is inside and uses a somewhat uncommon connector (with difficult to attach wires without a special $300USD tool) and the cover is glued on, and the serial I/O is 1.8v TTL (which may need voltage level conversion to talk to a microcontroller), and you may need to cut a notch in the back cover through which to feed a serial cable (unless you leave the back cover partially detached), and then you would have a semi-permanent cable always dangling from it. And feeding "keypresses" to a K5 is complicated by the fact that it only has ONE key (the home key) so you would need to simulate a touchscreen keypad. Not pretty.

It would be much easier to talk to your kindle through USB or wifi. There is now a free USB Host stack in software for microprocessors so it could talk to the kindle. Or use the kindle OTG as a USB host so the microprocessor can use smaller simpler USB device mode. Once you have that all figured out, you still need to know how to feed keypresses to the K5. This procedure is documented for a DX and K3, but I have not seen how to do it on a K5 yet.

If somebody knows how to force (native mode) keypresses on a K5, please post that info (or a link to it) here. Thanks.

Last edited by geekmaster; 07-15-2012 at 01:00 AM.
geekmaster is offline   Reply With Quote
Old 07-15-2012, 12:08 AM   #3
inuxy
Junior Member
inuxy began at the beginning.
 
Posts: 8
Karma: 12
Join Date: Jul 2012
Device: kindle touch
Quote:
Originally Posted by geekmaster View Post
On the K5, the serial port is inside and uses a somewhat uncommon connector (with difficult to attach wires without a special $300USD tool) and the cover is glued on, and the serial I/O is 1.8v TTL (which may need voltage level conversion to talk to a microcontroller).

It would be much easier to talk to it through USB or wifi.
Okay if I emulated a USB host with V-USB how would I simulate buttons then?
inuxy is offline   Reply With Quote
Old 07-15-2012, 12:19 AM   #4
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 inuxy View Post
Okay if I emulated a USB host with V-USB how would I simulate buttons then?
That has not been determined in our community yet, as far as I know. I only know how to do it on kindles that had a full keypad and not an onscreen keypad that only works inside the framework (GUI menu). Lack of a native mode keyboard has slowed down native mode app development significantly. There are native mode onscreen keyboards that are a dedicated component of a terminal app (JoppyTerm) but NOT general purpose, and even they do not force keypresses that can be used by other apps.

It can be done, but at this time you would have to do the basic research yourself (or wait for somebody else to do it).
geekmaster is offline   Reply With Quote
Old 07-15-2012, 12:48 AM   #5
inuxy
Junior Member
inuxy began at the beginning.
 
Posts: 8
Karma: 12
Join Date: Jul 2012
Device: kindle touch
Quote:
Originally Posted by geekmaster View Post
That has not been determined in our community yet, as far as I know. I only know how to do it on kindles that had a full keypad and not an onscreen keypad that only works inside the framework (GUI menu). Lack of a native mode keyboard has slowed down native mode app development significantly. There are native mode onscreen keyboards that are a dedicated component of a terminal app (JoppyTerm) but NOT general purpose, and even they do not force keypresses that can be used by other apps.

It can be done, but at this time you would have to do the basic research yourself (or wait for somebody else to do it).
I have one of the kindles with the 2.5mm port. Is there any way to issue serial commands to this?
inuxy is offline   Reply With Quote
Old 07-15-2012, 12:54 AM   #6
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 inuxy View Post
I have one of the kindles with the 2.5mm port. Is there any way to issue serial commands to this?
AFAIK the headphone jack's only INPUT feature is "insertion" and "removal" events (which just happen to generate keycodes on a K3, according to the "waitforkey" program). Otherwise it is just analog sound output on that jack.

If you really feel up to opening the kindle and soldering wires to it (or to the special micro plug it needs to use its serial connector), then you can do 1.8v TTL serial I/O if you really want to. But that port is also used to show syslog events, so your microprocessor would have to deal with all that extra output (or could just ignore it). Stuff sent to that port would also be sent to the serial "console", so you would need to reconfigure that serial port com device to use it for a dedicated application.

Last edited by geekmaster; 07-15-2012 at 12:59 AM.
geekmaster is offline   Reply With Quote
Old 07-15-2012, 12:57 AM   #7
inuxy
Junior Member
inuxy began at the beginning.
 
Posts: 8
Karma: 12
Join Date: Jul 2012
Device: kindle touch
Quote:
Originally Posted by geekmaster View Post
AFAIK the headphone jack's only INPUT feature is "insertion" and "removal" events (which just happen to generate keycodes on a K3, according to the "waitforkey" program). Otherwise it is just analog sound output on that jack.
Okay final question. If I were to do this through a linux computer (or mcu) is there a command reference for different events (swipe left, swipe right, etc)
inuxy is offline   Reply With Quote
Old 07-15-2012, 01:04 AM   #8
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 inuxy View Post
Okay final question. If I were to do this through a linux computer (or mcu) is there a command reference for different events (swipe left, swipe right, etc)
No manual as such, but I did document how to read gesture engine events from the Xorg log awhile back. I will see if I can find it... Found it:
https://www.mobileread.com/forums/sho....php?p=1932094

Also, you can read the touchscreen linux event device and process its raw binary data directly. There is an example of that in the "geekmaster signature capture script" here:
https://www.mobileread.com/forums/sho...d.php?t=178356

Of course, the GPL source code for the K5 is the best source of information. You can download that for free from the links in the "source code" sticky thread.

That is about all the relevant information that I am aware of at this time...

Last edited by geekmaster; 07-15-2012 at 01:18 AM.
geekmaster is offline   Reply With Quote
Old 07-15-2012, 01:08 AM   #9
inuxy
Junior Member
inuxy began at the beginning.
 
Posts: 8
Karma: 12
Join Date: Jul 2012
Device: kindle touch
Quote:
Originally Posted by geekmaster View Post
No manual as such, but I did document how to read gesture engine events from the Xorg log awhile back. I will see if I can find it... Found it:
https://www.mobileread.com/forums/sho....php?p=1932094

Also, you can read the touchscreen linux event device and process its raw binary data directly. There is an example of that in the "geekmaster signature capture script" here:
https://www.mobileread.com/forums/sho...d.php?t=178356

That is about all that I am aware of at this time...

Of course, the GPL source code for the K5 is the best source of information. You can download that for free from the links in the "source code" sticky thread.

Awesome, you have been a gigantic help! I am really going to try to document any progress I make on this front so I can give back to this awesome community.
inuxy is offline   Reply With Quote
Old 07-15-2012, 01:31 AM   #10
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
Beware that when disabling Xorg (as many native mode apps do, especially when using the touchscreen), then the Xorg log file will not get new gesture events. You would need to deal with that somehow. Or do your own gesture recognition from raw touchscreen data. Or discover the "right" way. Good luck.
geekmaster is offline   Reply With Quote
Old 07-15-2012, 09:48 AM   #11
PoP
 curly᷂͓̫̙᷊̥̮̾ͯͤͭͬͦͨ ʎʌɹnɔ
PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.PoP ought to be getting tired of karma fortunes by now.
 
PoP's Avatar
 
Posts: 3,002
Karma: 50506927
Join Date: Dec 2010
Location: ♁ ᴺ₄₅°₃₀' ᵂ₇₃°₃₇' ±₆₀"
Device: K3₃.₄.₃ PW3&4₅.₁₃.₃
headphone jack

Quote:
Originally Posted by geekmaster View Post
AFAIK the headphone jack's only INPUT feature is "insertion" and "removal" events (which just happen to generate keycodes on a K3, according to the "waitforkey" program). Otherwise it is just analog sound output on that jack.[/COLOR]
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]#
PoP is offline   Reply With Quote
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
Old 07-15-2012, 10:05 AM   #13
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
Hmm... It seems that waiforkey no longer returns a keycode for headphone events (on my K3 or my K5). I am certain that it did in the past. Why would amazon change that?

K5 waitforkey returns headphone and rotation events while booted from diags, but not from main.

Last edited by geekmaster; 07-15-2012 at 10:24 AM.
geekmaster is offline   Reply With Quote
Old 07-15-2012, 12:08 PM   #14
knc1
Going Viral
knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.knc1 ought to be getting tired of karma fortunes by now.
 
knc1's Avatar
 
Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
Quote:
Originally Posted by geekmaster View Post
Hmm... It seems that waiforkey no longer returns a keycode for headphone events (on my K3 or my K5). I am certain that it did in the past. Why would amazon change that?

K5 waitforkey returns headphone and rotation events while booted from diags, but not from main.
Do a:
lsmod
in both environments, see if maybe "main" is not loading a module for it.
knc1 is offline   Reply With Quote
Old 07-15-2012, 12:16 PM   #15
inuxy
Junior Member
inuxy began at the beginning.
 
Posts: 8
Karma: 12
Join Date: Jul 2012
Device: kindle touch
What about detecting the usb being powered?
inuxy is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[KT]Turn store button on search bar to browser button aditya3098 Kindle Developer's Corner 74 05-19-2017 08:33 PM
DIY Kindle voice control (simulating key presses) Acorn Kindle Developer's Corner 35 10-07-2012 01:36 PM
Filling a memory card externally to the reader lininjim Sony Reader 4 10-27-2011 08:21 PM
DR800 updating metadata externally Mr. X iRex 7 04-10-2010 12:14 PM
The Clerkenwell Presses ShortNCuddlyAm Writers' Corner 16 01-30-2010 06:21 PM


All times are GMT -4. The time now is 06:53 AM.


MobileRead.com is a privately owned, operated and funded community.