bluetooth icon indicating copy to clipboard operation
bluetooth copied to clipboard

Allow changing adapter ID in Linux backend

Open Elara6331 opened this issue 3 years ago • 0 comments

The bluetooth library used for Linux simply returns hci0 as the DefaultAdapter. This is constant and never changes. On all systems, DefaultAdapter will be hci0, even if hci0 doesn't exist. Sometimes, hci0 does exist, but users cannot or don't want to use it for one reason or another. There should be a way to use a specific adapter ID.

I'm thinking something like func AdapterByID(id string) (*Adapter, bool) should be added. This would return an adapter and true on Linux, and nil and false on other platforms. It could be used like so:

adapter, ok := bluetooth.AdapterByID(adapterID)
if !ok {
	adapter = bluetooth.DefaultAdapter
}

Elara6331 avatar Oct 21 '22 05:10 Elara6331