Using the Kindle as an information display
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.
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.
Here are the files to patch browserd and wifid:
WARNING: these patches are for firmware ver. 4.1.2 (2540270001)
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