Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Sony Reader > Sony Reader Dev Corner

Notices

Reply
 
Thread Tools Search this Thread
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: 77
Karma: 600554
Join Date: Jun 2012
Device: Sony Reader PRS-T1
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, 561 views)
File Type: zip pgdn.zip (9.6 KB, 461 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
Old 08-06-2012, 04:17 AM   #2
dennisMe
Junior Member
dennisMe began at the beginning.
 
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.
dennisMe is offline   Reply With Quote
 
Enthusiast
Old 08-06-2012, 08:48 AM   #3
graboluk
Junior Member
graboluk began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jul 2012
Device: Sony PRS-T1
How does it affect the battery?
graboluk is offline   Reply With Quote
Old 08-06-2012, 08:58 AM   #4
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: 77
Karma: 600554
Join Date: Jun 2012
Device: Sony Reader PRS-T1
Quote:
Originally Posted by graboluk View Post
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!
altruizine is offline   Reply With Quote
Old 08-06-2012, 10:25 AM   #5
uboot
Evangelist
uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.
 
Posts: 416
Karma: 75216
Join Date: Nov 2011
Location: old europe
Device: Kobo Mini, Sony PRS T1
Great work, altruizine!

There's no need for SManager.

As we did with the fixpermissions script (http://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 10:29 AM.
uboot is offline   Reply With Quote
Old 08-06-2012, 11:16 AM   #6
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: 77
Karma: 600554
Join Date: Jun 2012
Device: Sony Reader PRS-T1
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.
altruizine is offline   Reply With Quote
Old 08-06-2012, 01:12 PM   #7
uboot
Evangelist
uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.
 
Posts: 416
Karma: 75216
Join Date: Nov 2011
Location: old europe
Device: Kobo Mini, Sony PRS T1
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, ...
uboot is offline   Reply With Quote
Old 08-18-2012, 07:02 AM   #8
uboot
Evangelist
uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.
 
Posts: 416
Karma: 75216
Join Date: Nov 2011
Location: old europe
Device: Kobo Mini, Sony PRS T1
This seems to be a lighter alternative to run scripts at boot time:

https://play.google.com/store/apps/d...roid.autostart
uboot is offline   Reply With Quote
Old 08-19-2012, 09:12 AM   #9
uboot
Evangelist
uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.uboot seems famous, but is in fact legendary.
 
Posts: 416
Karma: 75216
Join Date: Nov 2011
Location: old europe
Device: Kobo Mini, Sony PRS T1
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...
uboot is offline   Reply With Quote
Old 08-20-2012, 02:06 PM   #10
tartanpion
Member
tartanpion began at the beginning.
 
Posts: 10
Karma: 10
Join Date: Nov 2011
Device: e60
Autostart app works for me with
Code:
su -c "/data/local/bin/pgdn"
in autostart.sh. (tested with moonreader and fbreader)

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

Last edited by tartanpion; 08-20-2012 at 02:15 PM.
tartanpion is offline   Reply With Quote
Old 08-20-2012, 03:12 PM   #11
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: 77
Karma: 600554
Join Date: Jun 2012
Device: Sony Reader PRS-T1
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.
altruizine is offline   Reply With Quote
Old 08-20-2012, 08:59 PM   #12
fairworld
Member
fairworld began at the beginning.
 
Posts: 11
Karma: 10
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...
fairworld is offline   Reply With Quote
Old 08-21-2012, 03:43 AM   #13
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: 77
Karma: 600554
Join Date: Jun 2012
Device: Sony Reader PRS-T1
Quote:
Originally Posted by fairworld View Post
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 ?
Yes, you can fix it in the same manner as tartanpion did for CoolReader: Find out the package name of the app in question (directory name under /data/data/) and add a directive to the /sdcard/.pgdn file that maps the keys to 0 for that app.

Once your app works correctly, be sure to share your config directives here so that I can include them in the default config file.
altruizine is offline   Reply With Quote
Old 08-23-2012, 08:58 AM   #14
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: 77
Karma: 600554
Join Date: Jun 2012
Device: Sony Reader PRS-T1
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.
altruizine is offline   Reply With Quote
Old 08-24-2012, 03:37 AM   #15
fairworld
Member
fairworld began at the beginning.
 
Posts: 11
Karma: 10
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...
fairworld is offline   Reply With Quote
Reply

Tags
button, hack, reader, root

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Warning - Kindle Store button removed from Amazon app RCR Apple Devices 4 09-02-2011 03:35 PM
Is there button to scroll left/right in browser? ST889 Amazon Kindle 3 09-29-2010 11:28 AM
Penguin releases iPhone app for Hoffman's "The Left Hand of God" (TheBookseller) Nate the great News 3 01-03-2010 03:43 PM
Point News button at a different folder or app nekokami iRex 3 12-17-2007 12:18 PM
lower left page button starting to misbehave jmdor Sony Reader 3 05-24-2007 02:16 AM


All times are GMT -4. The time now is 02:33 PM.


MobileRead.com is a privately owned, operated and funded community.