Python Carplay library for the "Autobox" dongles
These are readily available from Amazon, but are also available from cheaper sources. The one I got was labelled "Carlinkit" here: https://www.aliexpress.com/item/32829019768.html
They're provided with an Android APK (and if you hunt around online, a Windows CE version of the 'player' application also exists).
/tmp/
and occasionally /etc/
. This implies the dongle itself is running something like Linux.The code provided was based on findings from the APK. As such, some functionality is duplicated that may not be necessary. The primary case is the copying of various "assets" to the dongle that happens on every boot. To acquire these assets, a script is provided.
Simply run:
./downloadassets.sh
from the repository root.
This script simply uses the URL that was printed on the front of the box my dongle came in.
The code is intended for Python3. To install the necessary packages, run this command:
pip3 install pyusb simplejson
Though I thought it'd be fun to have CarPlay on a Tesla, I was really interested in the dongle itself.
They're pretty mysterious, providing CarPlay and Android Auto functionality in a way that clearly wasn't intended by Apple or Google. Further investigation indicates they may come from a line of products that can also support AirPlay and other streaming without needing an Apple-specific dongle.
The program is split into a few files:
ffmpeg
, to take the received h264 and generate PNGshttp.server
, to server a basic "CarPlay" PNG-based webpage and get the touches outpyusb
and the dongle's default interface with a reader thread (which parses messages) and a writer thread (with locking, as each module runs in its own thread)ffmpeg
is communicated with via pipes.
stdout
pipe fast enough, it blocks even if it has plenty of input data.ffmpeg
wrapper for python, or by just rewriting this all in C++.ffmpeg
dropping frames intentionally.All work here was done simply as a research project, and largely for fun. I hope it can be of use to others who are interested!
Copyright (C) 2019 Colin Munro