Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using your Kindle as an e-ink monitor #872

Open
1 task
ShellLM opened this issue Aug 9, 2024 · 1 comment
Open
1 task

Using your Kindle as an e-ink monitor #872

ShellLM opened this issue Aug 9, 2024 · 1 comment
Labels
Git-Repo Source code repository like gitlab or gh github gh tools like cli, Actions, Issues, Pages New-Label Choose this option if the existing labels are insufficient to describe the content accurately software-engineering Best practice for software engineering source-code Code snippets

Comments

@ShellLM
Copy link
Collaborator

ShellLM commented Aug 9, 2024

Using your Kindle as an e-ink monitor

Snippet

🖥️ See Demo

3.5 fps, Paperwhite 3
@adtac_
step 1: jailbreak your Kindle

mobileread.com is your best resource here, follow the instructions from the LanguageBreak thread

I didn't really follow the LanguageBreak instructions because I didn't care about most of the features + I was curious to do it myself, but the LanguageBreak github repo was invaluable for debugging

it doesn't matter how you jailbreak your device as long as you get to a root shell somehow

step 2: listener server on the Kindle

I wrote a Go program to receive files on port 8000 and then invoke eips, which is Kindle's built-in utility to draw images on the screen

for example, if the Go program received a JPG file and saved it under /tmp/img.jpg, the following command would draw the image with a partial update (full update looks awful):

eips -g /tmp/img.jpg -w gc16 -x 128 -y 0
read the eips wiki for details on what the flags mean

you may want to clear the screen with a eips -c before the first frame

unfortunately I lost the Go source code, but it was pretty simple, like under 30 lines

step 3: screencapture + imagemagick

I wrote a script to use screencapture on macOS to repeatedly capture the screen into a png file, which is then converted into a shape, size and color the Kindle likes using imagemagick, and then transferred over usbnet using netcat

/usr/sbin/screencapture -C -x /tmp/orig.png
convert /tmp/orig.png -rotate 270 -resize '810x1448!' -type GrayScale -depth 8 -colors 256 /tmp/gray.jpg
cat /tmp/gray.jpg | nc -w 0 192.168.15.244 8000
change the resolution to match your device and port to match the listener server

step 4: ???

I hacked this together last night for fun and obviously there's a lot of room for improvement here, both in terms of performance and usability

it's super wasteful to send a full jpeg file for each frame when the delta between consecutive frames is mostly going to be empty and very compressible (like when you're using a text editor)

without reinventing codecs like h.264 and protocols like vnc, it should be possible to quickly improve this with just the tools we already have

have fun!

other useful resources

https://www.sixfoisneuf.fr/posts/kindle-hacking-deeper-dive-internals/

https://github.com/NiLuJe/KindleTool

https://www.mobileread.com/forums/showthread.php?t=356766 - the vulnerability that makes LanguageBreak possible

README

Using your Kindle as an e-ink monitor

🖥️ See Demo

3.5 fps, Paperwhite 3
@adtac_

step 1: jailbreak your Kindle

mobileread.com is your best resource here, follow the instructions from the LanguageBreak thread.

I didn't really follow the LanguageBreak instructions because I didn't care about most of the features + I was curious to do it myself, but the LanguageBreak github repo was invaluable for debugging.

It doesn't matter how you jailbreak your device as long as you get to a root shell somehow.

step 2: listener server on the Kindle

I wrote a Go program to receive files on port 8000 and then invoke eips, which is Kindle's built-in utility to draw images on the screen.

For example, if the Go program received a JPG file and saved it under /tmp/img.jpg, the following command would draw the image with a partial update (full update looks awful):

eips -g /tmp/img.jpg -w gc16 -x 128 -y 0

Read the eips wiki for details on what the flags mean.

You may want to clear the screen with a eips -c before the first frame.

Unfortunately I lost the Go source code, but it was pretty simple, like under 30 lines.

step 3: screencapture + imagemagick

I wrote a script to use screencapture on macOS to repeatedly capture the screen into a png file, which is then converted into a shape, size and color the Kindle likes using imagemagick, and then transferred over usbnet using netcat.

/usr/sbin/screencapture -C -x /tmp/orig.png
convert /tmp/orig.png -rotate 270 -resize '810x1448!' -type GrayScale -depth 8 -colors 256 /tmp/gray.jpg
cat /tmp/gray.jpg | nc -w 0 192.168.15.244 8000

Change the resolution to match your device and port to match the listener server.

step 4: ???

I hacked this together last night for fun and obviously there's a lot of room for improvement here, both in terms of performance and usability.

It's super wasteful to send a full jpeg file for each frame when the delta between consecutive frames is mostly going to be empty and very compressible (like when you're using a text editor).

Without reinventing codecs like h.264 and protocols like vnc, it should be
be possible to quickly improve this with just the tools we already have.

Have fun!

Other useful resources

Suggested labels

None

@ShellLM ShellLM added Git-Repo Source code repository like gitlab or gh github gh tools like cli, Actions, Issues, Pages New-Label Choose this option if the existing labels are insufficient to describe the content accurately software-engineering Best practice for software engineering source-code Code snippets labels Aug 9, 2024
@ShellLM
Copy link
Collaborator Author

ShellLM commented Aug 9, 2024

Related content

#725 similarity score: 0.82
#748 similarity score: 0.81
#367 similarity score: 0.81
#134 similarity score: 0.81
#674 similarity score: 0.81
#625 similarity score: 0.8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Git-Repo Source code repository like gitlab or gh github gh tools like cli, Actions, Issues, Pages New-Label Choose this option if the existing labels are insufficient to describe the content accurately software-engineering Best practice for software engineering source-code Code snippets
Projects
None yet
Development

No branches or pull requests

1 participant