View Single Post
Old 03-28-2012, 04:37 PM   #23
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: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
@jmseight: The "killall" statements pause and resume the framework on my kindle, however some of the keypress events do remain in the keyboard input buffer so that after pressing Enter they show up in the search bar. I also had to pause the "launchpad" app I have running, or it "eats" spacebar presses.

I think there is a /proc to lock the keyboard for exclusive use, but that needs some research. The "myts" program locks the keyboard with with a C ioctl() call...

I was thinking about using a buffer string and supporting the Del key later (like you did), but I needed to stop for sleep when I was writing that.

Does "${ST%?}" work on the K3? A lot of other similar string processing that works on newer kindles does not work on the K3.

[[ $K -eq 14 ]]&& ST="$(echo ${ST%?})" && continue # del

For example, where I used ${ST:$K:1} on newer kindles I had to change to the older "echo|cut" for the K3 in this script. I will test the "%?" thing you did later when I get time...

[[ $K -le 52 ]]&& L="$(echo \"$KM\"|cut -b$K-$K)"

Question: Why are you using Aa for Enter?

# [[ $K -eq 28 ]]&& break # enter
[[ $K -eq 190 ]]&& break # use Aa for enter

The spacebar (keycode 57) worked for me:

[[ $K -eq 57 ]]&& L=" " # space

I think that this is eating your space:

ST="$(echo $ST$L)"

When passing parameters that may contain spaces, you should wrap them in quotes like this:

ST="$(echo \"$ST$L\")"

In this case, the escaped quotes become part of the echo command, and they protect any trailing space that is contained in the expansion of $L.

However in this particular case, why bother with an external command? Just do this instead:

ST="$ST$L"

Last edited by geekmaster; 03-28-2012 at 04:56 PM.
geekmaster is offline   Reply With Quote