r/PinoyProgrammer • • 12d 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.

171 Upvotes

17 comments sorted by

4

u/Goldillux 12d ago

windows when 👉🏻👈🏻

5

u/Able-Cauliflower-920 12d ago

Probably not anytime soon from me, seuil hooks straight into Linux's BlueZ, PipeWire, and MPRIS stack, and I don't daily-drive Windows to rewrite and test all the OS-level Bluetooth and audio code.

Good news though: you don't actually need a port on Windows. Samsung already has the official Galaxy Book apps on the Microsoft Store, so you can get native Auto Switch working on a regular Windows PC with a little tinkering. Look up GalaxyBookEnabler to bypass the Samsung hardware check, then install Samsung Continuity Service, Samsung Account, and the Galaxy Buds app from the Microsoft Store.

If any Windows dev ever wants to build an open-source version from scratch though, the reverse-engineered protocol spec is in the repo (docs/PROTOCOL_SPEC.md).

3

u/graysact 12d ago

BTW you did a good job. Updated na yung Galaxy Connect app for Windows 11, may auto-switch sa Buds4 pero wala sa Buds3 Pro ko. Ang upside is may animations na-connext yung Buds sa PC

2

u/Able-Cauliflower-920 12d ago

​Thanks bro! Classic Samsung, ginatekeep pa talaga sa Buds3 Pro sa Windows lol.

6

u/VenAlexxanderson 12d 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 12d 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

u/VenAlexxanderson 12d ago

ohhh I see. Damn, I have an iphone as my daily. Thanks for the info bro!

3

u/ChrisPugsworth 12d 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 12d 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 12d ago

This is next level, even with ai. Much further ahead than I was in my second year.

23

u/bktnmngnn 12d 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 12d 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

u/DeonHolo 12d ago

This is the type of REA projects I have been waiting for, small niche tools that fixes a specific problem.

1

u/OldAd8949 9d ago

Wtf my huawei buds does this? The other brands doesnt? LOL

1

u/maubrick 8d ago

Nice way to Rick Roll us