Hi everybody,
i’m a long time Debian user and, while i’ve always loved the Linux experience, the bluetooth side of things was always a little bit… painful.
Lately, i’ve been digging on how bluetooth on Linux works (i knew about BlueZ, but i didn’t know about HCI sockets, standard protocols for bluetooth controllers, …). Seeing how Android manages to work fine with bluetooth (yes, i know, money and company support, blah blah blah), i was thinking about re-writing the bluetooth daemon, in order to be modern, modular, safe (written in Rust), stable and retro-compatible (exposes the same D-Bus APIs as BlueZ) I already found some documents about HCI socket in Linux, HCI communication with bluetooth controllers, HID standards for Bluetooth, etc…
My questions are:
- is this a good idea?
- does somebody want to collaborate?
Thanks for reading.
EDIT: The repository is https://github.com/djtech-dev/reblued but at the moment is pretty much empty, just the project’s skeleton, license, README and disussions for collaborators.
It’ll be a tough rewrite, but a lot of the hard work will have been done for you. Android’s Gabeldorsche Bluetooth stack is a Rust rewrite of the old system, so your Rust rewrite can probably borrow a lot from there. I’m not sure how much Gabeldorsche and Bluez overlap in terms of API exposure, but it could be a start!
Be sure to read up on past Bluetooth vulnerabilities, though. A lot of old Bluetooth specs are bad and implementing them like described in the standard can lead to some nasty security risks.
The biggest problem you’ll probably run into rewriting the entire Bluetooth stack is firmware, and there’s no way around that problem at the moment. You’ll have to please the firmware gods and their assumptions to interact with hardware properly, and that can include some kernel level DMA that you’ll need to somehow wrap inside Rust’s security mechanism.
Thanks for your reply; i won’t work with firmware-level aspects of the stack, as my plan is to write the userspace daemon, while keeping the kernel-levels modules identical and to communicate to them via HCI sockets, as they are implemented by Linux and with them I can talk directly to the bluetooth controllers.
I’ll check out Android’s project and double-check for security vulnerabilities in older version of the protocols tho, so thank you again for replying.
triple-check is better.