PRS-T1 Hack: App-dependent Left/Right button mapping
#1  altruizine 08-04-2012, 05:13 PM
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.

  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.

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 Bug reports / enhancements welcome!

Edits (in reverse order):Archived: Installation notes for pgdn daemon without Buttonmap app:
Spoiler Warning below

  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.
     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.
     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).
[zip] (23.9 KB, 920 views)
[zip] (9.6 KB, 747 views)

#2  dennisMe 08-06-2012, 04:17 AM
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.

#3  graboluk 08-06-2012, 08:48 AM
How does it affect the battery?

#4  altruizine 08-06-2012, 08:58 AM
Quote graboluk
How does it affect the battery?
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!

#5  uboot 08-06-2012, 10:25 AM
Great work, altruizine!

There's no need for SManager.

As we did with the fixpermissions script (, you can invoke the daemon via /etc/

Just make sure that is executable.

If existent, 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 into

But let's wait for rupor to discover this thread! I'm pretty sure he'll integrate it into his root package

#6  altruizine 08-06-2012, 11:16 AM
Thanks four your comments, uboot!

I know about the 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 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.

#7  uboot 08-06-2012, 01:12 PM
hm... you're right... only data, system, preload, dic, ... partitions are mounted before

but maybe you can modify the daemon to look in several places for the cfg file: /etc, /data/etc, /mnt/sdcard, ...

#8  uboot 08-18-2012, 07:02 AM
This seems to be a lighter alternative to run scripts at boot time:

#9  uboot 08-19-2012, 09:12 AM
Update: I definitely works via - I just tried it - and internal sdcard is already mounted.

But the Autostart app I mentioned does not work...

#10  tartanpion 08-20-2012, 02:06 PM
Autostart app works for me with
su -c "/data/local/bin/pgdn"
in (tested with moonreader and fbreader)

Need to add
profile org.coolreader 0 0
in ".pgdn" for compatibility with coolreader.

  Next »  Last »  (1/4)
Today's Posts | Search this Thread | Login | Register