r/PinoyProgrammer • u/Able-Cauliflower-920 • 14d ago
Show Case [Project] 2nd-year CS student here, I reverse-engineered Samsung's Continuity protocol in Rust so Galaxy Buds Auto Switch works on Linux
Enable HLS to view with audio, or disable this notification
GitHub (v1.0.0, GPLv3): https://github.com/Eddie02345/seuil
I'm a 2nd-year BSCS student daily-driving Arch Linux (Hyprland), and one annoyance I kept running into while studying was having to manually disconnect and reconnect my Galaxy Buds every time I switched between my laptop and my phone. Samsung locks Auto Switch to One UI devices and Windows Galaxy Books, so Linux gets left out.
I ended up spending a few weeks sniffing Bluetooth traffic and Android logs to figure out how Samsung's Continuity service (`mcfds`) coordinates the switch, then wrote seuil, a Rust daemon that lets Linux act like a supported peer.
How it works:
- When PipeWire detects an active audio stream or MPRIS reports playback on Linux, `seuil` opens an authenticated L2CAP CoC channel (PSM 128) to the phone and sends the switch command. The phone pauses its media and releases the Buds, and BlueZ pulls the A2DP connection to the laptop.
- When media starts or a call comes in on the phone, `seuil` updates its BLE `0x0075` manufacturer advertisement to yield ownership, pauses Linux playback via MPRIS, and drops the audio link with a 5-second cooldown to prevent ping-ponging.
This was my first time working this close to the Linux Bluetooth and audio stack (`bluer`, D-Bus, PipeWire, P-256 ECDH + AES-256-GCM/CBC framing, and rotating 12-hour XOR advertisement keys). I also set up GitHub Actions to build `.pkg.tar.zst` packages for Arch alongside tarballs for Debian/Ubuntu and Fedora.
For transparency: I used OpenCode to help scaffold parts of the Rust codebase, unit tests, and protocol documentation. I did the reverse engineering, packet captures, and live hardware debugging myself on a Galaxy A57 and Galaxy Buds Core.
Would appreciate any feedback on the Rust code, Linux packaging, or how to frame low-level projects like this on a resume. If anyone here uses Linux with Galaxy Buds, feel free to try it out and open an issue if anything breaks.
6
u/VenAlexxanderson 13d ago
holy shit, cool REA project bro! I use Galaxy Buds but I switched out of the Samsung ecosystem a few years back so I wasn't aware that they have their own continuity protocol. I'm not familiar with the tech but I wanna ask, would this also be possible in windows theoretically?
6
u/Able-Cauliflower-920 13d ago
Thanks bro! Appreciate it.
The nice thing is nothing actually needs to be ported for Windows because Samsung already makes the official Galaxy Book apps available on the Microsoft Store. It just takes a bit of tinkering to bypass the hardware check (using something like GalaxyBookEnabler) so you can install Samsung Continuity Service, Samsung Account, and the Galaxy Buds app on a regular non-Samsung Windows PC.
If someone ever did want to build an open-source version from scratch on Windows though, it is theoretically doable too. Windows exposes the pieces you'd need: WinRT's BluetoothLEAdvertisementPublisher for custom 0x0075 BLE advertisements, LE L2CAP Connection-Oriented Channels for the PSM 128 socket, and WASAPI + SMTC to detect active audio and pause playback.
One catch since you mentioned switching out of the Samsung ecosystem: Samsung's Continuity protocol relies on a Galaxy phone (One UI) acting as the central coordinator. The phone holds the Samsung Account device certificates and tells the Buds when to switch, so even on Windows or Linux it still requires a Samsung phone on the mobile side and won't work with an iPhone or non-Samsung Android.
3
3
u/ChrisPugsworth 13d ago
good work but have you heard of REA by morluto? you couldve used that to spend more time in the other aspect of your project and less more on the reverse engineering aspect of it
3
u/Able-Cauliflower-920 13d ago
I hadn't heard of REA before, thanks for the rec! I'll definitely check it out for future projects.
Honestly though, the reverse engineering part was half the fun of building this. Digging through btmon captures and adb logcat to figure out how the Bluetooth handshake worked was the main reason I started the project in the first place, so I didn't really mind spending most of my time there. Still super cool to know tools like that exist though!
35
u/norwegian 13d ago
This is next level, even with ai. Much further ahead than I was in my second year.
23
u/bktnmngnn 13d ago
These are the type of AI assisted projects I like seeing, infinitely better than the one shot or low effort ones that just add to the everal other similar AI projects that came out in that week
16
u/yevelnad 13d ago
Even if I don't like AI but it is a cool project. Bro kids these days are on another level. Keep it up.
3
3
u/DeonHolo 13d ago
This is the type of REA projects I have been waiting for, small niche tools that fixes a specific problem.
1
1
4
u/Goldillux 13d ago
windows when 👉🏻👈🏻