Giter Site home page Giter Site logo

kindle-dash's Introduction

Low-power Kindle dashboard

Turns out old Kindle devices make great, energy efficient dashboards :-)

What this repo is

This repo only contains the code that runs on the Kindle. It periodically fetches an image to be displayed on the screen and suspends the device to RAM (which is very power efficient) until the next screen update.

This code does not render the dashboard itself. It's expected that what to display on the screen is rendered elsewhere and can be fetchd via HTTP(s). This is both more power efficient and allows you to use any tool you like to produce the dashboard image.

In my case I use a dashbling dashboard that I render into a PNG screenshot on a server. See here for information on how these PNGs should be produced, including some sample code.

Prerequisites

  • A jailbroken Kindle, with Wi-Fi configured.
  • An SSH server on the Kindle (via USBNetwork)
  • Tested only on a Kindle 4 NT. Should work on other Kindle devices as well with minor modifications.

Installation

  1. Download the latest release on your computer and extract it.
  2. Modify local/fetch-dashboard.sh and optionally local/env.sh.
  3. Copy the files to the Kindle, for example: rsync -vr ./ kindle:/mnt/us/dashboard.
  4. Start dashboard with /mnt/us/dashboard/start.sh.
    Note that the device will go into suspend about 10-15 seconds after you start the dashboard.

Upgrading

If you're running kindle-dash already and want to update to the latest version follow the following steps.

  1. Download the latest release on your computer and extract it.
  2. Review the release notes. Some releases might require changes to files in local/.
  3. Copy the files to the Kindle, excluding the local directory. For example: rsync -vur --exclude=local ./ kindle:/mnt/us/dashboard.
  4. Modify files in /mnt/us/dashboard/local if applicable.
  5. Start dashboard with /mnt/us/dashboard/start.sh.
    Note that the device will go into suspend about 10-15 seconds after you start the dashboard.

KUAL

If you're using KUAL you can use simple extension to start this Dashboard

  1. Copy folder kindle-dash from KUAL folder to the kual extensions folder. (located in /mnt/us/extensions)

How this works

  • This code periodically downloads a dashboard image from an HTTP(s) endpoint.
  • The interval can be configured in dist/local/env.sh using a cron expression.
  • During the update intervals the device is suspended to RAM to save power.

Notes

  • The releases contain a pre-compiled binary of the ht command-line HTTP client. This fully supports modern HTTPS crypto, wheras the built-in curl and wget commands don't (because they rely on a very old openssl library).

Credits

Thanks to davidhampgonsalves/life-dashboard for the inspiration!

kindle-dash's People

Contributors

jcmiller11 avatar julianlam avatar matopeto avatar pascalw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

kindle-dash's Issues

Failed to download image

Just tried the latest release, all was fine, but it failed to download the image

This line appears to be incorrect: $(dirname "$0")/../ht"

Logs are as follows:

Partial screen refresh
eips: paint_image> cannot open "./dash.png":can't fopen
Going to suspend, next wakeup in s
Wed May 25 12:06:42 UTC 2022 Battery level: 97%.
./dash.sh: line 111: ./next-wakeup: Permission denied
sh: 3600: unknown operand
Refreshing dashboard
Wi-Fi connected
./local/fetch-dashboard.sh: line 4: ./local/../ht: not found
Partial screen refresh
eips: paint_image> cannot open "./dash.png":can't fopen```

When kindle is in RTC sleep it cannot be charged

When my kindle is in RTC sleep it cannot be charged. It is charging only when is wakeup.

So please implement feature that kindle is not going to RTC sleep when it is charging and allow sleep only in memory (like in DEBUG)

power status - if it is charging can be determine by this command:

lipc-get-prop com.lab126.powerd status

How to disable kindle-dash?

Thank you for all the work on the project so far

I need to temporarily disable kindle-dash and get the regular kindle functionality, how would I go about doing that?

wait-for-wifi.sh not working reliably when called from dash.sh

First of all, thanks for this cool utility! I've had a lot of fun setting it up and playing around with the possibilities.

I'm using a Kindle Keyboard 3G (k3g, US model) and I noticed some strange behavior around the wait-for-wifi.sh script. For some reason, only when called in the context of dash.sh, it hangs and never makes it to the point of downloading the dashboard.

It seems like something is funky in the while statement in wait-for-wifi.sh. I tossed in some debug statements:

  ping -c 1 $WIFI_TEST_IP >/dev/null 2>&1
  while [ $? -ne 0 ]; do
    echo $?

...

    echo "Trying again"
    sleep 1
    /bin/ping -c 1 $WIFI_TEST_IP >/dev/null 2>&1
  done

But when I tail the logs, I see this:

[root@kindle dashboard]# tail -f logs/dash.log
Starting dashboard with 0 2,32 9-19 * * * refresh...
system: I framework:def:stopping booklet framework
Sun Jan 31 15:44:57 2021  INFO:battery charge: 91%
Sun Jan 31 15:44:57 EST 2021 Battery level: 91%.
Refreshing dashboard
0
Trying again
0
Trying again

What's really strange here is that calling the script directly yields no issues:

[root@kindle dashboard]# ./wait-for-wifi.sh
./wait-for-wifi.sh
Wi-Fi connected

For now I'm working around this by just stopping wait-for-wifi.sh from being called inside dash.sh which is totally fine, but I'd be curious if you have any ideas of what might be going on.

Thanks!

Cron format has an unusual number of columns

The example cron schedule is 0 2,32 8-17 * * 2-6, but... this has six columns, where a cron schedule is usually 5 columns.

Plugging this into crontab.guru results in a red mark and no text output.

I think the leading 0 is the issue here. If we erase that, then we get a cron schedule that sounds reasonable for a dashboard.

Question: Battery life?

I really appreciate this project. Thank you for sharing! If you have a second I'm really curious what the battery life has been doing this? Or have you kept it plugged in?

fetch_dashboard.sh to check ETag?

Related to #2, someone on HN mentioned that you may be able to increase battery life by checking the ETag and not running eips if the tag has not changed.

Render to png

Hello,

You mention:

In my case I use a dashbling dashboard that I render into a PNG screenshot on a server.

What do you use to render the dashbling output to PNG?

Thank you very much for this project!

Cheers,
Kiru

Move next_wakeup_secs to local

Please move next_wakeup_secs method to local directory for user/kindles (like fetch-dashboard.sh that cannot use next-wakeup binnary (eg. my kindle DXG). So users can implement own logick for next wakeup (e.g. hadcoded interval)

Maybe i will post PR for this issue later

Changing low-battery.sh to turn off the kindle and then ensure dash.sh/start.sh runs on boot

Currently if my Kindle loses power while running the script it will go to the standard "Kindle Out Of Power - Please Recharge Now" screen. Then when I recharge the Kindle, it does not turn on and automatically run this script. Instead it goes back to standard 'book mode' (hopefully this makes sense!)

The functionality I would like in low-battery.sh is:

  1. a message appears when the battery is low (this seems ok following this advice #13)
  2. if battery is very low, the kindle powers down, leaving the image currently on the screen in place (can I just use sudo shutdown -h now in low-battery.sh inside a conditional with a threshold of, say 5?)
  3. dash.sh/start.sh runs at startup (can I use standard linux commands such as crontab? if so I would just run /mnt/us/dashboard/start.sh at reboot - based on this thread it seems that crontab works on the Kindle 3 so hopefully 4 as well https://www.mobileread.com/forums/showthread.php?t=156472)

As I've written this I feel I've answered some of my own questions but I'll leave this here as I'm interested to know if this sounds like the best approach and what the right way of turning off the kindle is

Thanks!

Image aspect ratio morphed/incorrect

First of all: excellent software!

I created a simple python script to create images to display. Unfortunately, the image is somehow morphed:
IMG_20210216_220700

This is the displayed file:
db

I tried to load it directly from my python script aswell as directly from nginx and in both cases the image was morphed.

Would be nice if you have an idea on how to fix this :)

Print last updated time and battery percentage onto the dashboard locally

Just an idea, but it would probably be nice to be able to see the battery percentage on the kindle dashboard... at which point, I thought "why not have the last update time shown as well?"

I added this to the refresh_dashboard function locally:

/usr/sbin/eips 1 39 "last update: $(date -Iminutes) battery: $(gasgauge-info -c | sed 's/%//g')"

Unfortunately, the built-in busybox date utility is extremely limited, so this is printing in UTC time (and not in a very nice format to begin with) and I also discovered that eips can't print the % symbol, apparently, so I'm using sed to strip that out.

Obviously a lot of room for improvement, which is why I didn't open a PR, but I figured I'd at least mention the idea.

xh segfaults on download

I'm trying to set this up on my Kindle Keyboard running a 3.4.3 (recently jailbroken).

Running from your latest release v1.0.0-beta.4.

From the kindle, if I try to use xh -o outfile url I get a Segmentation Fault. I believe I've tried it will all the options you use in your example download script in local. I can run 'xh --help` and the binary does run, it just fails when I try to download. I can see if there is a verbose option that might help, but what is your source for xh? I wonder if there are other / newer / different versions that might be more compatible with my older device.

I wrote a small python script to verify I CAN download PNGs, at least from a local server via http. Maybe your 'xh' isn't compatible with Kindle 3.x devices? If I get this all running, I can share my python download script to possibly replace xh which is likely a bit more cross-device compatible.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.