Inspiration

We thought this would be a great project to grind out for a Hackathon, since we were going to do it anyway and it has a real use case for us today. It is also fun to do things we have never tried before.

What it does

We have put a custom distribution of NixOS on the Spotify Car Thing, which runs a custom Rust app that emulates the original Car Thing UI (with some tweaks), and allows for seeking, shuffling music, liking songs, playing/pausing, and skipping to next and previous tracks.

How we built it

Joey worked on actually hacking the Thing by entering the bootloader, booting an in-memory Linux kernel via U-Boot commands, then dissecting the boot chain of trust and constructing his own kernel and customized Linux environment using Wayland.

While he was doing that, Ben wrote the Rust app using the Slint GUI crate and the RSpotify crate as a wrapper for the Spotify Web API. The app takes data on the currently playing song from the Spotify API and uses that to update the Slint GUI, which has buttons which give callbacks that we use to provide the features listed above.

Challenges we ran into

Ben hadn't done much Rust programming before, so making a multi-threaded async app felt like running full tilt into a brick wall (the borrow checker). Slint specifically was a challenge because the documentation was sparse in many places, forcing him to trawl GitHub issues, where the usual answer was "Here's a workaround, we haven't implemented that yet.". The biggest challenge was definitely the Rust borrow checker, though.

Accomplishments that we're proud of

The Car Thang has a completely custom build of Linux on it, designed specifically for the device (and it runs Doom. All good things run Doom). The Car Thing originally ran a fork of Android, which made getting full Linux on it quite a challenge. ARM embedded devices tend to have very custom boot chains, so getting the full kernel to boot actually requires two steps across two partitions. Debugging problems on the Car Thing was also quite difficult given its general lack of... keyboards.

What we learned

Ben learned a lot about Rust and async development, as well as the crates Tokio, RSpotify, and Slint. Joey learned a ton about building custom kernels and boot chains for embedded devices, and is very excited to continue working on embedded applications in the future.

What's next for Car Thang

Currently the Car Thang only supports the most rudimentary Spotify controls, so we would like to add support for things like Volume control, Queue editing, Playlist/Library searching, and even new features like adding to any playlist instead of just "Liked Songs." Adding some on-screen controls to Doom would also be nice. Other than that though, Joey plans to use it in his car every day, and we will create a writeup and some install scripts for the dozens of us that actually own one of these things.

Built With

Share this project:

Updates