← All side quests

My Bluetooth Dongle Has Amnesia

My Bluetooth Dongle Has Amnesia

Somewhere in my house, there is a USB dongle that forgets who it is every time you unplug it. No, this is not a riddle. It is a TP-Link UB500, and it is the final boss of my smart home build.

The quest begins

It started, as these things do, with ambition. I was building a sandbox — an Ubuntu 22.04 VM running inside UTM on my Mac Mini, hostname ubuntomuse, because nothing says “I’m fun at parties” like a virtual machine with a cute name. The mission: get Bluetooth working in the VM so I could run a pairing window for a Muse gadget. Ten minutes of advertising a friendly little name, MuseGadget3B25DF, and then the Bluetooth radio on the host… did not cooperate.

The Mac Mini, bless its heart, keeps its Bluetooth all to itself. Guests of the VM need not apply.

Enter the dongle

Enter the TP-Link UB500. Fifteen dollars of pure promise: a USB Bluetooth adapter. Plug it in, hand it to the VM via USB passthrough, and suddenly Linux has a radio. Easy, right?

Ha. Ha.

The UB500 runs on a Realtek RTL8761BU chip, and it has a design philosophy I can only describe as aggressively zen: it has no persistent storage. Every single time you plug it in, the operating system has to upload the firmware blob to it, like reminding a goldfish of its own name. Unplug it, and it forgets everything. Including, occasionally, how to be a Bluetooth adapter at all.

The adapter for the adapter

There was also a comedy of ports. The UB500 is USB-A. The Mac Mini M4 is USB-C only. Apple, in its infinite wisdom, has decided that the letter A is for old people. So before the dongle could even reach the VM, it needed a USB-C adapter — an adapter for the adapter. I have now built a Russian nesting doll of connectivity.

Victory (sort of)

Then, on October 13th at 22:50 UTC — I know the timestamp because I have earned it — the moment finally arrived. UTM passthrough resolved. lsusb in the VM printed the magic words. The dongle was seen. Seen! My VM could see its little amnesiac Bluetooth radio, firmware uploaded, lights on, somebody home.

I felt like a surgeon who just got the donor heart to beat.

The final boss: actually turning it on

Of course, “visible” is not “working.” The Bluetooth radio still needs to actually be brought up in Linux — the part where the OS goes from “yes, I see a radio” to “yes, and it can talk to things.” And then the ten-minute pairing window gets re-run, MuseGadget3B25DF goes back on the air, and the gadget and the VM finally shake hands.

We’re almost there. The dongle remembers who it is — for now. I just have to not unplug anything.

To be continued, probably at 2 AM, probably with coffee.

← All side quests