08-04-2012, 06:13 PM | #1 |
Senior Altruist
Posts: 82
Karma: 600554
Join Date: Jun 2012
Device: Onyx Boox C67ML, Onyx Boox Note Pro
|
Hack: App-dependent Left/Right button mapping
Buttonmap: Use the Left / Right keys in all reader apps
Various reader apps recognize different buttons for turning to the next or previous page. The wiki offers various static button mappings for the Left / Right keys, but none of the static mappings is sufficient for all reader apps. Inspired by this hack on the XDA forum, I've modified the pgdn program provided there to work for the PRS-T1. With this hack, it's possible to remap the Left / Right keys dynamically, depending on which app is currently running, to Dpad Left/Right, Volume Up/Down, nothing (needed for Sony's built-in reader app), or whichever other key is needed. The Buttonmap app wraps the pgdn daemon and the default configuration file into an easily installable package. The default configuration file allows using the Left / Right keys for the following apps (tested): Reader (built-in), Browser (built-in), Aldiko Reader, Amazon Kindle for Android, FBReader, InstaFetch Pro, Google Reader, Google Books (old 1.x versions), CoolReader. Installation:
The pgdn configuration file is /sdcard/.pgdn. Buttonmap creates an example configuration file as /sdcard/.pgdn.dist. It also creates a new /sdcard/.pgdn file if it does not yet exist, but it does not overwrite an existing one. When you upgrade, you can copy the contents of .pgdn.dist to .pgdn or simply delete your the old .pgdn. When you change the .pgdn config file, you need to restart the pgdn daemon as root (“killall pgdn && /data/data/com.github.altruizine.Buttonmap/files/pgdn”), or just reboot the system. Please find the source code of this program at https://github.com/altruizine/pgdn. Bug reports / enhancements welcome! Edits (in reverse order):
Spoiler:
Last edited by altruizine; 09-03-2012 at 04:32 AM. Reason: Software update: Added more apps to config file |
08-06-2012, 05:17 AM | #2 |
Junior Member
Posts: 6
Karma: 10
Join Date: Aug 2011
Device: kindle3
|
Thank you! This is really nice, a must have in fact! I just installed it without using ADB by just copying everything over using root explorer. I'm on a lInux host which preserves flags. I didn't know SManager before but it works well!
Now at least I can use the hardware keys and don't need to swipe in most apps. Great little add on, it should be incorporated in the root hacks as standard. |
Advert | |
|
08-06-2012, 09:48 AM | #3 |
Junior Member
Posts: 6
Karma: 10
Join Date: Jul 2012
Device: Sony PRS-T1
|
How does it affect the battery?
|
08-06-2012, 09:58 AM | #4 |
Senior Altruist
Posts: 82
Karma: 600554
Join Date: Jun 2012
Device: Onyx Boox C67ML, Onyx Boox Note Pro
|
The pgdn daemon shouldn't affect battery life much, if at all. I've verified using strace that it sits idle doing nothing unless you press a button.
I haven't profiled the SManager app I'm using to run the daemon at boot, but I can imagine more lightweight methods of running a program at boot. Nonetheless, I haven't observed a difference in battery life. @dennisMe, I'm glad you like it! |
08-06-2012, 11:25 AM | #5 |
Evangelist
Posts: 425
Karma: 75216
Join Date: Nov 2011
Location: old europe
Device: Kobo Mini, Tolino Epos 2
|
Great work, altruizine!
There's no need for SManager. As we did with the fixpermissions script (https://www.mobileread.com/forums/sho...48&postcount=9), you can invoke the daemon via /etc/install-recovery.sh Just make sure that install-recovery.sh is executable. If existent, install-recovery.sh is called on every boot by /init.rc I don't know how to create an apk package, but as an alternative one could modify one of the existing flash packages and put all necessary commands like creating/modifying install_recovery.sh into do_update.sh. But let's wait for rupor to discover this thread! I'm pretty sure he'll integrate it into his root package Last edited by uboot; 08-06-2012 at 11:29 AM. |
Advert | |
|
08-06-2012, 12:16 PM | #6 |
Senior Altruist
Posts: 82
Karma: 600554
Join Date: Jun 2012
Device: Onyx Boox C67ML, Onyx Boox Note Pro
|
Thanks four your comments, uboot!
I know about the install-recovery.sh method, but I'm afraid it does not work in this case: Presently, the pgdn daemon reads a configuration file from the (internal) SD card, which (I think) has not been mounted yet when the install-recovery.sh script runs. The idea of an APK would be not only to ease installation, but also to run the pgdn daemon once boot has been completed and the SD card has been mounted. |
08-06-2012, 02:12 PM | #7 |
Evangelist
Posts: 425
Karma: 75216
Join Date: Nov 2011
Location: old europe
Device: Kobo Mini, Tolino Epos 2
|
hm... you're right... only data, system, preload, dic, ... partitions are mounted before install_recovery.sh
but maybe you can modify the daemon to look in several places for the cfg file: /etc, /data/etc, /mnt/sdcard, ... |
08-18-2012, 08:02 AM | #8 |
Evangelist
Posts: 425
Karma: 75216
Join Date: Nov 2011
Location: old europe
Device: Kobo Mini, Tolino Epos 2
|
This seems to be a lighter alternative to run scripts at boot time:
https://play.google.com/store/apps/d...roid.autostart |
08-19-2012, 10:12 AM | #9 |
Evangelist
Posts: 425
Karma: 75216
Join Date: Nov 2011
Location: old europe
Device: Kobo Mini, Tolino Epos 2
|
Update: I definitely works via install_recovery.sh - I just tried it - and internal sdcard is already mounted.
But the Autostart app I mentioned does not work... |
08-20-2012, 03:06 PM | #10 |
Enthusiast
Posts: 30
Karma: 10
Join Date: Nov 2011
Location: france
Device: kobo libra 2
|
Autostart app works for me with
Code:
su -c "/data/local/bin/pgdn" Need to add Code:
profile org.coolreader 0 0 Last edited by tartanpion; 08-20-2012 at 03:15 PM. |
08-20-2012, 04:12 PM | #11 |
Senior Altruist
Posts: 82
Karma: 600554
Join Date: Jun 2012
Device: Onyx Boox C67ML, Onyx Boox Note Pro
|
Thanks for your follow-ups, uboot and tartanpion!
I've added the CoolReader configuration to the dot.pgdn file and will release an updated .zip soon. (It's already on Github.) The Autostart author has sent me (an updated version of) his app's source code and has given me permission to modify and redistribute it. With it, I may be able to build an all-in-one APK that installs and runs the pgdn daemon automatically. |
08-20-2012, 09:59 PM | #12 |
Member
Posts: 11
Karma: 5110
Join Date: Dec 2011
Device: Sony PRS-T1
|
orionviewer and some apk have a problem...
some apps support T1's left right key
So when pgdn is running, left and right key are acting like double click... can i fix it ? of course [dot.pgdn] file is modified... |
08-21-2012, 04:43 AM | #13 | |
Senior Altruist
Posts: 82
Karma: 600554
Join Date: Jun 2012
Device: Onyx Boox C67ML, Onyx Boox Note Pro
|
Quote:
Once your app works correctly, be sure to share your config directives here so that I can include them in the default config file. |
|
08-23-2012, 09:58 AM | #14 |
Senior Altruist
Posts: 82
Karma: 600554
Join Date: Jun 2012
Device: Onyx Boox C67ML, Onyx Boox Note Pro
|
Buttonmap app for easy pgdn installation and startup
OK, building a simple app that installs and runs the pgdn daemon at boot time wasn't so difficult after all.
I ended up not using the Autostart source code, but rolling my own (with a bit of googling around for inspiration). The source is already up on Github. I'll also update the first post with an APK package and installation instructions shortly. |
08-24-2012, 04:37 AM | #15 |
Member
Posts: 11
Karma: 5110
Join Date: Dec 2011
Device: Sony PRS-T1
|
I made app also...
Pgdn is very useful to me...
so I added this function into my app(T1Mizer) Helping Optimization for T1(but not english...) when T1 is booted completed, this app run 'pgdn' via shell command and This app have a function that can configure 'dot.pgdn' profile... hahaha... |
Tags |
button, hack, reader, root |
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Warning - Kindle Store button removed from Amazon app | RCR | Apple Devices | 4 | 09-02-2011 04:35 PM |
Is there button to scroll left/right in browser? | ST889 | Amazon Kindle | 3 | 09-29-2010 12:28 PM |
Penguin releases iPhone app for Hoffman's "The Left Hand of God" (TheBookseller) | Nate the great | News | 3 | 01-03-2010 04:43 PM |
Point News button at a different folder or app | nekokami | iRex | 3 | 12-17-2007 01:18 PM |
lower left page button starting to misbehave | jmdor | Sony Reader | 3 | 05-24-2007 03:16 AM |