Closed aykevl closed 8 months ago
Also confirmed this on my laptop, running Debian buster with BlueZ 5.50 (same as the Raspberry Pi).
I see the same thing. Ubuntu 20.04, bluez 5.53.
Please give a try with this branch https://github.com/tinygo-org/bluetooth/tree/update-bluez-555 which updates the go-bluetooth package to the latest version with updated Bluez wrappers.
Unfortunately, I get the exact same output as before. I also tried on Arch Linux with bluez 5.55.
Same for me, it still doesn't work on the update-bluez-555 branch. I suspect it's because the bluetooth package assumes a newer BlueZ version. Maybe BlueZ has made a backwards incompatible change?
I think it is something to do with changes to the wrapper generation in https://github.com/muka/go-bluetooth/commits/master/gen since the last working version, which at least on my machine is also https://github.com/muka/go-bluetooth/commit/f6113f7141c5f535bea0ce20d918383d4577efe8
Note that I am testing by running "old" version of BlueZ:
$ bluetoothctl --version
bluetoothctl: 5.48
If reverting to older SHA of go-bluetooth "fixes" for most of us, we should do that while we look into what might be the root cause. What does everyone think?
I think that sounds good. Keeping on top of bluez releases is going to be a constantly moving target, so this probably won't be the last time something breaks :)
Happy to try out a new branch or PR when it's available.
@mogenson and @aykevl please give a try to #49 it appears to correct this issue on my machine with BlueZ 5.50 installed. Thanks!
A quick test shows that it doesn't crash anymore. I haven't checked whether it actually works but assuming you've tested it, LGTM.
Unfortunately the examples are still failing for me, but now with a different error:
$ go run ./examples/heartrate
go: downloading github.com/muka/go-bluetooth v0.0.0-20200619025933-f6113f7141c5
starting
panic: failed to enable BLE stack: MapToStruct: Field not found: Roles
goroutine 1 [running]:
main.must(...)
/home/mike/Projects/bluetooth/examples/heartrate/main.go:54
main.main()
/home/mike/Projects/bluetooth/examples/heartrate/main.go:17 +0x7c5
exit status 2
$ go run ./examples/scanner
panic: failed to enable BLE stack: MapToStruct: Field not found: Roles
goroutine 1 [running]:
main.must(...)
/home/mike/Projects/bluetooth/examples/scanner/main.go:23
main.main()
/home/mike/Projects/bluetooth/examples/scanner/main.go:11 +0x1df
exit status 2
$ pacman -Qi bluez
Name : bluez
Version : 5.55-1
@mogenson I thought you were using Ubuntu?
Also, you perhaps want to try 5.50:
$ bluetoothctl --version
bluetoothctl: 5.50
This is the version that the recent commit downgraded to, which is, as @aykevl points out the current version on Raspian.
Sorry for the delay. I have a Ubuntu 20.04 laptop. Just haven't used it recently.
$ bluetoothctl --version
bluetoothctl: 5.53
From the dev branch:
$ go run ./examples/scanner
# works great!
$ go run ./examples/heartrate
starting
panic: failed to start adv: MapToStruct: Field not found: SupportedSecondaryChannels
@mogenson can you run this while running the program that fails?
sudo dbus-monitor --system "type=error"
Thanks.
this looks like its due to muka generating invalid UUIDs if passed 128 bit uuids for a service.
Now closing since 0.9.0 has been released. Thank you!
This was most likely fixed with #216.
I haven't investigated this issue yet, but I have bisected it.
Recent versions of the bluetooth package fail on the Raspberry Pi (Debian 10.4, BlueZ 5.50):
The commit introducing this is 2fb3b08920ae957edaa9deecbb7b16514a055068, introduced in #36.