Skip to content

Commit

Permalink
Add lower level touch, add wake up, fix whitespace,
Browse files Browse the repository at this point in the history
But because of the lower level touch, now there is a problem when the
screen is upside down...

Landscape was fixable because I can check the system, but upsidedown is
ugly and forced... tricky.
  • Loading branch information
llakssz committed Sep 30, 2016
1 parent 49f9813 commit dc3052b
Show file tree
Hide file tree
Showing 11 changed files with 361 additions and 265 deletions.
2 changes: 1 addition & 1 deletion bin/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"key_brightness_up" : [ 115 ],
"key_next_page" : [ 104, 103, 106 ],
"key_prev_page" : [ 109, 108, 105 ],
"reverse_direction" : false
"key_wake" : [ 15 ]
}
Binary file modified bin/kindlelazy
Binary file not shown.
25 changes: 0 additions & 25 deletions bin/restart-flip.sh

This file was deleted.

16 changes: 16 additions & 0 deletions bin/start-reverse.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

#start KindleLazy by inserting modules and running background app

cd "$(dirname "$0")"

insmod hid.ko 2>&1
sleep 1
insmod usbhid.ko 2>&1
sleep 1
insmod mousedev.ko 2>&1
sleep 1

killall kindlelazy > /dev/null 2>&1
sleep 3
./kindlelazy -reverse &
15 changes: 10 additions & 5 deletions bin/start-upsidedown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@
#mount and remount (makes the read only work) - read only so that makexconfig doesn't overwrite our CW change
#kill lxinit, it will restart X
#set the input flipped so the touch screen is comfortable upside down.
#set book page view to portrait. if view setting is landscape, even if we rotated upside down, when book is opened kindle will fix itself and stop upsidedown.


#these changes are not permenant, reboot will restore rotation and input rotation.
#input rotation does not survive lxinit, so we do it afterwards

#maybe good idea to check if everything was successful and THEN fix the touch input... :)

cd "$(dirname "$0")"

umount /var/local/xorg.conf
cp /var/local/xorg.conf /mnt/us/extensions/kindlelazy/bin/xorg.conf
sed -i 's/ Option "Rotate" "CCW"/ Option "Rotate" "CW"/g' /mnt/us/extensions/kindlelazy/bin/xorg.conf
mount --bind /mnt/us/extensions/kindlelazy/bin/xorg.conf /var/local/xorg.conf
cp /var/local/xorg.conf xorg.conf
sed -i 's/ Option "Rotate" "CCW"/ Option "Rotate" "CW"/g' xorg.conf
mount --bind xorg.conf /var/local/xorg.conf
mount -o remount,ro,bind /var/local/xorg.conf
killall lxinit
sleep 10
/mnt/us/extensions/kindlelazy/bin/xinput set-prop 'multitouch' 'Multitouch Device Orientation' 1
sleep 15
./xinput set-prop 'multitouch' 'Multitouch Device Orientation' 1
lipc-set-prop com.lab126.winmgr orientationLock U
4 changes: 3 additions & 1 deletion bin/stop-upsidedown.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#kill lxinit and it will restart X
#not needed to restore xinput touch screen orientation because lxinit fixes that

cd "$(dirname "$0")"

umount /var/local/xorg.conf
rm /mnt/us/extensions/kindlelazy/bin/xorg.conf
rm xorg.conf
killall lxinit
1 change: 1 addition & 0 deletions bin/stop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

#stop KindleLazy by killing app and removing modules
cd "$(dirname "$0")"

killall kindlelazy 2>&1
sleep 2
rmmod mousedev.ko
Expand Down
2 changes: 1 addition & 1 deletion config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<extension>
<information>
<name>KindleLazy</name>
<version>0.5</version>
<version>0.9</version>
<author>cearp</author>
<id>KindleLazy</id>
</information>
Expand Down
28 changes: 19 additions & 9 deletions menu.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,39 @@
{
"name": "KindleLazy",
"items": [
{
"name": "*Insert device before starting KindleLazy*",
"action": "",
"exitmenu": false
},
{
"name": "Start KindleLazy",
"priority": 0,
"action": "bin/start.sh"
},
{
"name": "Start KindleLazy (reversed page direction)",
"action": "bin/start-reverse.sh"
},
{
"name": "Stop KindleLazy",
"priority": 0,
"action": "bin/stop.sh"
},
{
"name": "(re)Start + Swap page turn direction",
"priority": 0,
"action": "bin/restart-flip.sh"
"name": "*The below actions stop KindleLazy...*",
"action": "",
"exitmenu": false
},
{
"name": "*Run KindleLazy afterwards if you want both*",
"action": "",
"exitmenu": false
},
{
"name": "Rotate screen upside down (until next reboot)",
"priority": 0,
"name": "Screen upside down (until reboot)",
"action": "bin/start-upsidedown.sh"
},
{
"name": "Restore normal upright screen",
"priority": 0,
"name": "Stop upside down",
"action": "bin/stop-upsidedown.sh"
}
]
Expand Down
10 changes: 7 additions & 3 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
KindleLazy 0.5 - cearp
KindleLazy 0.9 - cearp

Only tested on PW3, nothing else!

Expand All @@ -7,7 +7,7 @@ This should be improved later.

There is no hotplugging, have the device inserted before starting. If the device is removed, this app may quit.

The page turn direction can be reversed, so that your 'forward' button can still advance you to the next page.
The page turn direction can be reversed (pass argument '-reverse'), so that your 'forward' button can still advance you to the next page.
For example, with books that are 'right to left', where the next page is on the left, you would reverse the direction.

The program will not work without a config file named 'config.json' in the same directory.
Expand All @@ -20,7 +20,7 @@ Here is a sample (and the default) config file:
"key_brightness_up" : [ 114 ],
"key_next_page" : [ 104, 103, 106 ],
"key_prev_page" : [ 109, 108, 105 ],
"reverse_direction" : false
"key_wake" : [ 15 ]
}

Errors in the config file are not handled, it will probably crash.
Expand All @@ -42,6 +42,10 @@ For the config above, the key codes represent:
114 = VOLUME_DOWN
115 = VOLUME_UP

15 = TAB


I can see some keycodes here, I am not sure if some devices produce different ones.
https://android.googlesource.com/platform/frameworks/base/+/cd92588/data/keyboards/Generic.kl

It is best to run 'evtest /dev/input/mydevice', and press buttons and see what values are given.
Loading

0 comments on commit dc3052b

Please sign in to comment.