/k3libre

Free Libre command-line tools for Kindle development

Primary LanguageC

Goal of this project is liberation of Kindle 3 (and older) devices, so users
can do things for which they are not originally designed.

Steps required to get root shell over usb networking and
local terminal on your Kindle are described in:

liberate-kindle.txt


e-ink framebuffer

Kindle's e-ink display is exposed as framebuffer /dev/fb0 under linux. For now,
we have two tools to deal with it:

  # create dump.fb0.pgm file from framebuffer data
  fb2pgm.pl dump.fb0

  # convert pgm page to framebuffer format
  pgm2fb.pl data.pgm > data.fb0


/opt/eink/scripts/diags script on Kindle is best documentation how to use e-ink

  # example of eink refresh
  echo 1 > /proc/eink_fb/update_display


keyboard and fiveway

You can see status of lock on keyboard and fiveway using:

  [root@kindle test]# cat /proc/keypad /proc/fiveway 
  keypad is unlocked
  fiveway is unlocked

  # example of keypad unlock
  [root@kindle root]# echo unlock > /proc/keypad


Reseting Kinde

When you get stuck in state where you are no longer running Amazon framework
and you need to somehow connect to your kindle again, press and hold power button
for 20 seconds. It's important to note that your Kindle should be disconnected
from USB while you are doing it. Wait 5-10 seconds and screen will blink
white-black-white and it will re-boot.


Screen rotation from command line

  lipc-send-event -r 3 com.lab126.hal orientationUp
  lipc-send-event -r 3 com.lab126.hal orientationLeft
  lipc-send-event -r 3 com.lab126.hal orientationDown
  lipc-send-event -r 3 com.lab126.hal orientationRight

You can get current rotation using

  cat /sys/module/eink_fb_hal_broads/parameters/bs_orientation

It will return 0 for portrait and 1 for landscape orientation


Screen saver disable/enable

  lipc-set-prop com.lab126.powerd preventScreenSaver 1
  lipc-set-prop com.lab126.powerd preventScreenSaver 0


Wifi on/off

This seems to move from version to versiion, so here is way to find it out:

	[root@kindle root]# lipc-probe -l | grep wifi
	com.lab126.wifid
	[root@kindle root]# lipc-probe com.lab126.wifid | grep enable
	rw      Int     enable
	[root@kindle root]# lipc-get-prop com.lab126.wifid enable
	1
	[root@kindle root]# lipc-set-prop com.lab126.wifid enable 1

Development

For development and compiling binaries, I would recommend getting Debian
lenny armel and running it under qemu using kernel, initrd and rootfs from:

http://people.debian.org/~aurel32/qemu/armel/

To run Debian armel under armhf kernel, you have to add following so apt-get
will fetch armel packages on armhf architecture:

dpavlin@ac100$ cat /etc/apt/apt.conf.d/00arch 
APT::Architecture=armel;