Skip to content

Instantly share code, notes, and snippets.

@mrsinguyen
Forked from rvagg/README.md
Created August 13, 2014 09:52
Show Gist options
  • Select an option

  • Save mrsinguyen/72531b81ade923840795 to your computer and use it in GitHub Desktop.

Select an option

Save mrsinguyen/72531b81ade923840795 to your computer and use it in GitHub Desktop.

Work in progress, I'll write this up properly when I'm done.

Almost all credit goes to @maxogden for putting me on to this and pointing me in the right direction for each of these items.

Prerequisites:

if [ -z "$STY" ];  then
    exec screen -xR
fi

Optional:

  • SSH over wifi http://wiki.mobileread.com/wiki/Kindle_Touch_Hacking#SSH_access_over_Wifi I disabled USBNet because I want to use my Kindle as normal via USB but SSH via Wifi is enabled full-time so I can log in to it whenever I like. I also have my pubkey in authorized_keys.
  • Type ~ds into the search bar on the Kindle to disable screensaver while you're working. A reboot will undo this.

Keyboard toggle

Note that there is a kterm commandline option to toggle the keyboard (-k0) but for the current build of landscape kterm it doesn't quite work properly so I prefer to leave the keyboard showing on startup and then tap with 2 fingers and select "Toggle keyboard" to get rid of it. The 2 finger tap will also let you kill the kterm and toggle a few other things.

Running in screen

Remember that you're only using screen for the shared session so doing Ctrl-A stuff to switch windows is going to cause problems because your Pi console might switch but your Kindle terminal won't so you'll be out of sync. Just use it as a single console. Use Ctrl-Z and fg %X to switch between programs and you'll be fine.

Terminal size

Because the terminal size is kind of awkward, especially when you change the font size, you'll probably want to set your terminal width settings with the stty command, mainly for the "columns". For the font size I like I've found that a column width of 72 does the trick so things fit on properly and I get proper wrapping: stty columns 72. You may want to tinker with this a little to make it just right for you. You may also need to restart your kterm session and/or restart programs you have running to make them adjust properly.

The following files need to be placed in this structure:

/mnt/us/extensions/kindleberrypi/config.xml
/mnt/us/extensions/kindleberrypi/menu.json
/mnt/us/extensions/kindleberrypi/etc/id
/mnt/us/extensions/kindleberrypi/bin/kindleberrypi.sh
<?xml version="1.0" encoding="UTF-8"?>
<extension>
<information>
<name>kindleberrypi</name>
<version>0.0</version>
<author>rvagg</author>
<id>kindleberrypi</id>
</information>
<menus>
<menu type="json" dynamic="true">menu.json</menu>
</menus>
</extension>
# THIS FILE NEEDS TO BE YOUR PRIVATE SSH KEY, THE PERMS ARE 644 AND IT'S HARD TO SECURE SO IT MAY BE BEST TO MAKE A SPECIAL KEYPAIR FOR THIS LOGIN
#!/bin/sh
# where kterm is installed
KTERM=/mnt/us/extensions/kterm/
# colour scheme, 0=black on white, 1=white on black
COLOUR=1
# font size
FONT=7
# username on your Pi
USER=username
# hostname of your Pi
HOST=hostname
# run the Extend commands to mount /opt/ so we can get to /opt/bin/ssh
/mnt/us/extend/unmount.sh
/mnt/us/extend/mount.sh
# copy the privkey to a place where we can set the perms to 600 to make ssh happy
cp /mnt/us/extensions/kindleberrypi/etc/id /var/tmp/_id
chmod 600 /var/tmp/_id
# set orientation to landscape
lipc-set-prop com.lab126.winmgr orientationLock R
#
${KTERM}/bin/kterm -c ${COLOUR} -s ${FONT} -e "/opt/bin/ssh -o StrictHostKeyChecking=no -i /var/tmp/_id -l ${USER} ${HOST}"
# run after exit to make sure the keyboard is gone
killall matchbox-keyboard
{
"items": [
{"name": "kindleberrypi", "priority": 1, "action": "bin/kindleberrypi.sh"}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment