Using the Kindle as an information display

Introduction

I recently saw a KickStarter project that was about making a small device that used an eInk display to show some random information. The screen was quite small and the device was battery powered, communicating via WiFi. I thought that this might be a good use-case for an eInk display. I wouldn’t really want a normal LCD lit all the time in my home to display some info, but it woud be cool to have something like that and this type of display would make more sense.

So i asked myself “Mmm… can i build something like this? Maybe hacking some existing hardware?” and the answer was obviously my Kindle! It has an eInk display and WiFi connectivity built-in.
In fact, some people already had the same idea (see link at the bottom).
The “problem” with these existing solutions is that they basically use a server to render an image and than they just fetch it to display it on the screen.
I don’t have a server in my current home and in general it would make more sense to me to have a device that can do everything on its own.

My idea is to use a web browser on the device to make it render custom HTML pages. This seems a good solution to me as you can create very flexible screens and also run some javascript to do whatever you want.

Let’s do it: Kindle K5 and newer

I haven’t done this myself but it looks like on recent devices you can do this using WebLaunch. It does all you need so if you have a Kindle Touch or Paperwhite then you’re set.

Let’s do it: Kindle K4 (sucks to be you/me…)

My Kindle is a K4 and it doesn’t have the stuff to make WebLaunch work. The UI is done in Java and there are no HTML pages.

But, it HAS a web browser. It’s under Menu > Experimental.
The problem is that it’s kind of limited: it doesn’t work full-screen and it can’t load local files for example.

Here is what I’ve done to remove this limitations. Please note that this is a hack and has its rough edges as i’ll explain.
This is also not a step-by-step tutorial, it’s some knowledge and experience that i want to share and i expect whoever wants to try this to “know what he’s doing” basically.

Loading local files

The browser only allows to use HTTP:// and HTTPS:// protocols on the address bar. My first approach was to run a small web server on the device itself and make it load pages from HTTP://localhost but this doesn’t work for some reason.
In the end I’ve just patched the browserd daemon (the process that renders the pages and runs webkit) to allow the file:// protocol.
This way if you have stored a page named “test.htm” in the device memory using the USB connection, you can access it by typing “file:///mnt/us/test.htm” in the address bar (note the 3 slashes: 2 are part of the file:// protocol, the third is the start of the absolute path /mnt/us/test.htm).

Showing the page fullscreen

I’ve then managed to patch the browserd daemon to use the entire framebuffer to display the page fullscreen. There is a problem tough: the statusbar and addressbar are not handled by browserd, they’re managed by the normal UI process. This means that both processes will write to the same part of the screen and the last one that draws in that area will overwrite what the other has drawn. It’s not ideal but i’m not very familiar with hacking Java (by the way, the code is also obfuscated) and after all we still need to enter the URL somehow so we can’t remove completely the addressbar anyway.

The good news is that after entering the URL the pages renders and covers everything else, so it’s what we want.
You can also go to Menu > Screen Rotation > Enter (without actually changing it) to force a re-draw.

This works well enough but there’s a small issue: the system will redraw the system bar if the battery level or the signal strength changes, thus ruining our fullscreen page.
The battery level won’t change during normal use as you’ll have the USB cable alway connected to keep the device charged. The WiFi signal strengh however could change slightly depending on other radio signals around and could trigger a redraw of the system bar.
To avoid this I’ve patched the wifid daemon to not send the “signal strength changed” notification so the system won’t know about it and won’t redraw the system bar (did i say that this whole thing is a hack?).

Preventing the device to go to sleep

This is relatively easy:

# lipc-set-prop -i com.lab126.powerd preventScreenSaver 1

Set it back to 0 to allow the device to sleep.

Resources

Here are the files to patch browserd and wifid:
WARNING: these patches are for firmware ver. 4.1.2 (2540270001)

browserd_patch
wifid_patch

I’ve made them using the bsdiff utility already present on the device. To apply them, copy the files to the device via USB and:

# cp /usr/bin/browserd /usr/bin/browserd_orig
# bspatch /usr/bin/browserd_orig /usr/bin/browserd /mnt/us/browserd_patch
# cp /usr/sbin/wifid /usr/sbin/wifid_orig
# bspatch /usr/sbin/wifid_orig /usr/sbin/wifid /mnt/us/wifid_patch
# killall browserd
# killall wifid

Related projects

https://github.com/jp3141/KindleThermometer
https://github.com/pjimenezmateo/kindle-wallpaper
https://github.com/mpetroff/kindle-weather-display

Advertisements

18 thoughts on “Using the Kindle as an information display

  1. Very interesting. I’ve just followed some other guides… using a webserver to create a .png image, my kindle pulls every few minutes using cron, a simple shell script and eips to display the image (after killing framework and powerd no need to worry about device going to sleep etc).
    I don’t want to leave my kindle plugged in so was wondering about ways of conserving power (disabling wifi between refreshes etc?). Any ideas if/how this might be possible? Or any other ways power may be conserved?
    Thanks!

    • I think the best solution would be to let the device suspend and wake up every X minutes. The powerd daemon seems to have a few properties to schedule a wakeup: “rtcWakeup” and “wakeup”. I would suggest you to google a bit to see if somebody already found how to use those properties to do it.

  2. Pingback: Kindle Wireless Display (PVOutput, Helpdesk, Weather Forecast etc) | Tickett's Blog

  3. Hello, I really need to do this for a project I am doing. Also on a K4, really don’t want to use a K5 as the screen and backlight just don’t suit. I tried anyway just to see to use the WebLauncher on my K4 but of course no dice.
    Your instructions are technically beyond me. Any hints about I might achieve this using terminal on mac would greatly apperciated.

    • Unfortunately, as I mentioned in the post, it’s quite a hack.
      I would recommend to get help from somebody as this is not a walkthrough and I can’t really explain all the individual steps in a comment.

      In short, it boils down to:
      1) check if the firmware is the same that i had when i made the patches (Resources section). If not, you can’t use those patches unless you find a way to downgrade.
      2) If it matches, put the paches on the Kindle and apply them using the commands in the same section
      3) put the HTML file in the Kindle
      4) open the browser and point it to the HTML file (Loading local files section)

      • Hi. We have really been working hard on this. we downgraded the firmware so that it matches but and have followed all other instructions though no matter what we cannot get terminal to find /usr/bin/browserd_orig or /usr/sbin/wifid_orig and therefore cannot apply the patches. Any insight would be appreciated. Thanks a million

      • Those files are just copies of the stock files. You create them when you run the cp (=copy) commands.
        Here’s an explanation of the commands i gave in the article.

        Copy /usr/bin/browserd to /usr/bin/browserd_orig
        # cp /usr/bin/browserd /usr/bin/browserd_orig

        Read /usr/bin/browserd_orig, apply the patch /mnt/us/browserd_patch and save it as /usr/bin/browserd (overwrites the original file)
        # bspatch /usr/bin/browserd_orig /usr/bin/browserd /mnt/us/browserd_patch

        Copy /usr/sbin/wifid to /usr/sbin/wifid_orig
        # cp /usr/sbin/wifid /usr/sbin/wifid_orig

        Read /usr/sbin/wifid_orig, apply the patch /mnt/us/wifid_patch and save it as /usr/sbin/wifid (overwrites the original file)
        # bspatch /usr/sbin/wifid_orig /usr/sbin/wifid /mnt/us/wifid_patch

        Kill the current browserd and wifid processes so they get restarted (this loads the new ones that are patched)
        # killall browserd
        # killall wifid

        You just need to make sure that you’ve copied the patch files to the root folder of the Kindle.
        If you’ve already downgraded, jailbroken and run SSH this should be a piece of cake.

    • Hey randomcoderdude, I’m trying to resolve this issue with AF!
      So after I’ve ssh’d into the root of the kindle and issue the cp /usr/bin/browserd /usr/bin/browserd_orig I get:
      cp: can’t stat ‘/usr/bin/browserd’: No such file or directory
      Same happens with the wifid. 😦 And it looks like these files don’t exist on the kindle.
      Im using a Kindle 4 NT, with 4.1.2 (2540270001). (downgraded using Kubrick, then installed the 4.1.2 downloaded from Amazon)

      • This must sound really stupid but… are you sure you are SSHing into the Kindle? Because I can’t think of any other reason for this.
        Why don’t you try the following:
        # uname -a
        # whoami
        # find / -name browserd
        then come back with the results

      • Hey! Thanks for the quick response.

        [root@[192_168_15_244] /root]# uname -a
        Linux [192_168_15_244] 2.6.31-rt11-lab126 #1 Fri Sep 2 19:00:58 PDT 2011 armv7l GNU/Linux
        [root@[192_168_15_244] /root]# whoami
        root
        [root@[192_168_15_244] /root]# find / -name browserd
        [root@[192_168_15_244] /root]#

        The find / -name browserd gives me just an empty line.

      • was not mounted.

        I get this:

        [root@[192_168_15_244] /root]# find / -name browserd
        /mnt/base-mmc/usr/bin/browserd
        /mnt/base-mmc/etc/kdb.src/yoshi/system/daemon/pmond/browserd
        /mnt/base-mmc/etc/init.d/browserd
        [root@[192_168_15_244] /root]#

  4. I was using the diags mode, not ssh via wifi.
    Now I’m getting somewhere.

    When i run bspatch /usr/bin/browserd_orig /usr/bin/browserd /mnt/us/browserd_patch.
    I get: bspatch: /usr/bin/browserd: Text file busy.

    Do you have any idea what could be wrong?

    • I’m not sure… you could try to delete the file first with
      # rm /usr/bin/browserd
      But it’s strange that the file is busy, as far as i remember even when the process is running the file should not be open on linux.

      • Hey Randomcoderdude! Thanks a lot for your help.

        So I managed to patch the file after deleting it.
        But as I try to open up the experimental browser the kindle freezes.
        Do you by any chance have any idea about this problem?

      • I would make sure that the files have been patched correctly (and not, say, patched twice).

        These are the SHA1 hashes of the 2 files after being patched:
        b0f789b18329a90db6dae8423c660e3f4f47ab79 browserd
        417134279a743742a445a78e3e76e172f502c156 wifid
        (I don’t think there’s an sha1sum tool on the Kindle so you’ll probably need to copy the files to your PC and check them there)

  5. Hey, was waiting for a friends pc to be able to run the Kubrick, as it does not work on my mac.
    To be able to try again from scratch.
    the SHA1 hashes are the same :(.

    May I ask what method you did to be able to ssh into it?
    I feel like that is the only thing I am doing that could be wrong at the moment.
    http://blog.joschika.tk/2012/03/01/kindle-4nt-ssh-over-wifi/ This is the method I used.

    And again thanks for the help! Much appreciated!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: