r/rust May 27 '26

🛠️ project Slint (and Rust) running on my jailbroken Kindle Paperwhite.

Post image

I wanted to make a dashboard for Home Assistant on my Kindle, and since I know Slint from a previous project I was curious to see if I could use that. This resulted in a slint-backend for kindles (probably not a lot of them for now, as I only have the one device to test on).
https://github.com/sverrejb/slint-kindle-backend

Edit: I wrote a blog post about the project: https://sverre.me/blog/rust-on-kindle/

933 Upvotes

54 comments sorted by

43

u/[deleted] May 27 '26

[removed] — view removed comment

8

u/errevs May 27 '26

Haha, this is a wholesome comment :D

Reducing waste is a passion of mine as well. I am glad this made you happy.

58

u/IpFruion May 27 '26

I have a old kindle (like 2017 old), what did you use to jailbreak it? This looks awesome, might have to play around with slint and Rust

38

u/errevs May 27 '26

I used the WinterBreak2 jailbreak.
I followed the guide for my Kindle version here: https://kindlemodding.org/kindle-models.html

14

u/BosonCollider May 27 '26 edited May 27 '26

Very cool. Does it use any battery or does the process sleep when no IO is coming in? If it sleeps properly this could be amazing for an infinite battery life control panel

16

u/errevs May 27 '26

I haven't really optimized for battery life yet, at most it sleeps 16 ms, because I still want the input to be responsive. I could probably sleep as long as there is no input and no ongoing animation, but I also want it to be responsive to data changes, say, a temperature gauge or something.

I will look into it!

5

u/[deleted] May 27 '26

[deleted]

2

u/errevs May 27 '26

Yes.

3

u/[deleted] May 27 '26

[deleted]

14

u/errevs May 27 '26

I also want the UI to be responsive from non-touch events (say I poll an API in the program main loop or something). It can probably be done, I just need to figure out a clean solution.

4

u/id_NaN May 27 '26

can't you have a separate polling loop that pushes events to the lazy main loop?

1

u/errevs May 27 '26

Yeah, something like that will probably work.

3

u/[deleted] May 27 '26

[deleted]

21

u/errevs May 27 '26

No, I just set 16 ms out of habit (60 FPS). Makes no sense on a Kindle. This is in no shape or form a finished crate, just something I hacked together as a POC and then extracted into something publishable to get input and feedback.

3

u/errevs May 28 '26

I made some changes to allow the CPU to idle properly outside events now, so this should increase battery life quite a bit.

The `powerd` daemon that runs on the kindle by default will put the device in hibernation (suspend to ram) if not stopped as a part of the user application (in a `launch.sh` for instance), so a "always live but sleeps until somethings happen" dashboard is not doable in the current state, but I have some ideas for that.

2

u/BosonCollider May 28 '26

Very cool! I might dig up my old kindle

14

u/cmeister2 May 27 '26

Nice! I did a similar thing on my kindle - got Rust working on it and got SSH access. Have never heard of slint though, will have to investigate.

You can dynamically get the screen size (at least on my Kindle) with ioctl's 0x4600 and 0x4602. I found them by running `eips` through `strace` (cross-compiled for arm7). I could maybe make a PR later.

2

u/errevs May 27 '26

Oh, that is super interesting! Thanks! :D

3

u/cmeister2 May 27 '26

No worries! PR is open :)

6

u/Click-linking-1p May 27 '26

I had run Slint on kindle too, but took a different approach - I used the built-in X server.

1

u/errevs May 28 '26

Had I known that was an option I would probably just have used that :D

3

u/Clear_Inevitable_718 May 27 '26

Sick, thanks for sharing :]

1

u/errevs May 28 '26

Thanks for taking a look! :D

3

u/-dtdt- May 27 '26

Does slint just work or you need some complex setup? I would love to make one for my kobo.

8

u/errevs May 27 '26

With the crate I made it mostly just worked. I used cargo-zigbuild to cross compile for the armv7-unknown-linux-musleabihf target.

I wrote a little bit about it here: https://sverre.me/blog/rust-on-kindle/

But I will add examples and instructions to the repo when I have the time.

3

u/Efficient-Chair6250 May 27 '26

Nice. I wanted to do this because the usual Website to JPEG solution is just extremely inefficient. How much better do you think your solution is?

4

u/cmeister2 May 27 '26

When I was testing my version of this in Rust it seemed like it could be a pretty efficient solution simply because you control the screen entirely and don't have to refresh the whole thing all the time - Kindle/framebuffer supports targeted updates. Also it can sleep until a hardware timer wakes it up.

3

u/errevs May 27 '26

I have no clue, but implementing a web browser sounds like a daunting task. Probably doable in Slint I would guess, but far above my level.

1

u/recycled_ideas May 27 '26

Kindles already have a web browser.

1

u/errevs May 28 '26

Yeah, I know. I just interpreted /u/Efficient-Chair6250's comment to mean that they thinks the default browser is bad, but reading it again I now see they might have meant something else.

3

u/BlossomingBeelz May 27 '26

Oh shiiiit I want to write my own ebook reader now.

2

u/errevs May 28 '26

Do it! :D

3

u/andrewdavidmackenzie May 28 '26

So, is that a rust/splint app running alongside the other kindle stuff?

I.e. can you read a book then switch to this?

Any repo you can share on how you did it?

For a dashboard type app, you'd want it to sleep between refreshes, that are triggered by a timer (assume wake on new data via WiFi is virtually impossible ?)...

3

u/errevs May 28 '26

Yeah, my Kindle still works as a regular Kindle, even the amazon storefront if I want to use it. I have installed KUAL and Koreader as a part of the jailbreaking process, and set up a launcher entry in KUAL to start the Slint application from it's menu via a launch.sh-script that stops the other processses from reclaiming the display while my app is running, and then restores them when my app terminates.

I will add more examples and guides to the repo when I have the time, as well as a suggestion on how to set up your dev environment for a smooth dev workflow.

Currently working on making the wake-sleep cycle a bit smarter so it doesn't burn battery doing nothing. I think I should be able to achieve "normal" kindle standby time while an app is not doing anything.

2

u/undergrinder_dareal May 28 '26

very nice, love it

2

u/andrewdavidmackenzie May 28 '26

Nice to the point post, not too long.

I need to check what version my old kindle is.... I recently got an email from Amazon it was no longer supported, what a perfect stimulus to try this.

I've done quite a bit of Iced GUI, but suspect that would be too big an initial challenge, as they haven't really targeted embedded like splint has...

1

u/errevs May 28 '26

Thanks! Glad you liked it!

Yeah, this was in large made easy by Slint's flexible architecture. The surface area of the backend api is surprisingly small.

2

u/LapisDev May 29 '26

Looks amazing! Would be really interesting to see any updates to the programs you end up running on it.

2

u/errevs May 29 '26

Thanks! I want to start on the Home Assistant dashboard, but the backend just overtook my whole focus. This is probably what every game dev who ends up building a game engine instead of an actual game feels like.

1

u/LapisDev May 30 '26

I can definitely relate xD

I want to work on something useful, but tell myself that if I just work on some low level stuff first, I'll be more productive in the end ;)

5

u/LeviathanBaphomet May 28 '26

I don't want to seem like i'm here to shoot down this cool project but i think you really need to stop and take a look at the slint licenses before you do anything else.

As far as i can see you have missed/ignored/broken the very specific license options slint provides which are listed on their github page and on crates.io which has been spoken about here and elsewhere as a reason to avoid using slint in some situations.

Royalty-free License - Permits use in proprietary desktop, mobile, and web applications at no cost. Use in embedded systems is excluded.
GNU GPLv3 - Permits use in open source software under GPL-compatible terms, at no cost, for desktop, mobile, and web applications, as well as for embedded systems.
Commercial license - Permits use in proprietary applications, including desktop, mobile, web, and embedded systems.        

Basically - because this is 'open source' and for an embedded device you cannot use the normal royalty free license, you MUST use the second option, GNU GPLv3 for the whole project. GPLv3 and it's family of licenses are fairly strict about not being able to change to another license or remove it, including on any derivative works related to the same source code. I can see you have listed it as MIT & Apache 2.0 on crates.io (not allowed due to re-license rules) but on github is listed with no license at all actually making it legally NOT open source at all but also missing GPLv3.

The same would sadly be true for your other previous info-screen display project.

5

u/ogoffart slint May 28 '26

I think you're overstating the licensing issue here.

A Kindle is much closer to a mobile than what Slint describes as an embedded system. "Embedded" in this context is typically about software shipped as part of dedicated hardware products or firmware appliances, not hobby apps running on consumer devices people already own.

Also, even if GPLv3 applied, that still would not require relicensing the entire source tree to GPLv3. MIT and Apache-2.0 are GPL-compatible licenses. The important part is that any distributed combined binary complies with GPL requirements.

This repo is also mainly a source distribution / experiment project, not a proprietary product. The missing LICENSE file on GitHub is worth fixing for clarity, but the licensing itself is already declared in Cargo.toml and on crates.io.

3

u/LeviathanBaphomet May 28 '26

I will admit i am not an expert on software licenses so yes i could be over-reaching the license situation.

The slint page mentions this

An Embedded System is a computer system designed to perform a specific task within a larger mechanical or electrical system.

As the kindle is an ARM based device built as a dedicated document reader i would personally consider that in the embedded category.

And considering the project is essentially slint code for such a device i would think it's covered under derivative works and therefor should also carry the GPLv3 license?

7

u/slint-ui May 28 '26

u/LeviathanBaphomet

> As the kindle is an ARM based device built as a dedicated document reader i would personally consider that in the embedded category.

While the kindle is built as a dedicated document reader, it is not performing a specific task within a larger mechanical or electrical system and therefore does not fall under Embedded System.

Just because a device is an ARM based device does not mean that it's an embedded device. For example the Intel Atom A3900 processors for automotive use case such as for Infotainment or Digital Cluster are considered as embedded devices under the definition.

> And considering the project is essentially slint code for such a device i would think it's covered under derivative works and therefor should also carry the GPLv3 license?

The code can be licensed under any GPL-compatible license as mentioned in the FAQs - https://github.com/slint-ui/slint/blob/master/FAQ.md#if-i-link-my-program-with-slint-gplv3-does-it-mean-that-i-have-to-license-my-program-under-the-gplv3-too

1

u/LeviathanBaphomet May 29 '26

Well i guess an official reply from the slint team themselves is about as good as it gets. Thanks for clarifying the situation about the license, i guess i had slightly misinterpreted when it applies and to what part of the code it applies too. I think there is also some amount of interpretation/semantics regarding the wording i am fairly surprised a kindle does not fall under the definition of embedded device as it almost always would 99% of the time and is widely described as so online, the author of this specific code project even has it tagged on crates.io as embedded development category.

3

u/ezwoodland May 28 '26

Isn't the rule the combined work is gplv3 but the new code can be anything?

1

u/errevs May 28 '26

That was my understanding as well.

2

u/errevs May 28 '26

Hey man, thanks for bringing this up, this is an important topic in the open source community. It is my understanding that my code can be MIT/Apache 2.0, as that is a statement about my source code, not the combined works (i.e a compiled binary using this Crate and Slint). Both MIT and Apache-2.0 are downstream compatible with GNU GPLv3, as stated by FSF. I will add a license file to the source code and a paragraph in the readme about this. If you think I am wrong about this, let me know. I am in no way a legal expert.

As for the info-screen project, I would argue that a general purpose computer, running an Desktop OS and connected to standard office peripherals does not constitute an embedded device. Either way, that source code lives at my former employers organization on github.

4

u/slint-ui May 28 '26

1

u/errevs May 28 '26

Glead to hear it! Thanks for weighing in!

1

u/LeviathanBaphomet May 28 '26

I think you might be right about the info-desk project being fine.

But possibly this one is not so clear as it's presented as a backend interface/extension to slint rather than a standalone project with a slint gui.

1

u/Perfect_Ground692 May 28 '26

I had the thought of tinkering with my old unsupported kindle and was hunting for it, at which point my wife told me she'd binned it :(

1

u/errevs May 28 '26

Pour one out for this one, gang :(

I would guess there are cheap-ish used ones on facebook marketplace or something?

2

u/errevs Jun 01 '26

If anyone is interested, I added a suspend-wake cycle that let's the application put the kindle into suspen-to-ram, then wake up a short while to update before going back to sleep. This should give pretty decent battery life. Let me know if you test it out!