View Single Post
Old 08-04-2012, 05:13 PM   #1
altruizine
Senior Altruist
altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.altruizine ought to be getting tired of karma fortunes by now.
 
Posts: 82
Karma: 600554
Join Date: Jun 2012
Device: Onyx Boox C67ML, Onyx Boox Note Pro
Lightbulb 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:
  1. Download the Buttonmap.apk file and install it on the Reader.
  2. Reboot. If your “su” uses the Superuser app, grant Buttonmap permanent root privileges when the superuser request pops up. This occurs shortly after reboot; don’t let the request time out, or you will have to reboot again.
Configuration:

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):
  • 2012-09-03: Updated configuration file with user-contributed settings
  • 2012-08-23: Released wrapper app Buttonmap.apk.
  • 2012-08-20: Updated zip file: Added exception for CoolReader, which has native support for the PRS-T1; added a configuration for the Terminal Emulator. Added mention of the Autostart app.
  • 2012-08-06: Updated zip file: Added exception for built-in browser, which can interpret the Left/Right keys without a keyboard mapping.
Archived: Installation notes for pgdn daemon without Buttonmap app:
Spoiler:
  1. Make sure you're rooted and have root adb access.
  2. Copy the provided pgdn binary to /data/local/bin/pgdn and make sure it's executable.
    Code:
            adb push pgdn /data/local/bin/pgdn
            adb shell chmod 755 /data/local/bin/pgdn
  3. Copy the attached dot.pgdn config file to /sdcard/.pgdn (mind the dot). Customize this file to add keyboard mappings for other reader apps.
    Code:
            adb push dot.pgdn /sdcard/.pgdn
  4. Make sure pgdn is run as root at boot. I'm using the SManager app to do this. Reportedly, the Autostart app works as well (see comments below).
Attached Files
File Type: zip Buttonmap.apk.zip (23.9 KB, 1392 views)
File Type: zip pgdn.zip (9.6 KB, 1122 views)

Last edited by altruizine; 09-03-2012 at 03:32 AM. Reason: Software update: Added more apps to config file
altruizine is offline   Reply With Quote