Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recent version doesn't work on Debian buster #46

Closed
aykevl opened this issue Nov 29, 2020 · 17 comments
Closed

Recent version doesn't work on Debian buster #46

aykevl opened this issue Nov 29, 2020 · 17 comments
Labels
bug Something isn't working linux

Comments

@aykevl
Copy link
Member

aykevl commented Nov 29, 2020

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):

$ go run ./examples/heartrate/
starting
panic: failed to add service: Failed to create entry in database

goroutine 1 [running]:
main.must(...)
        /home/ayke/src/tinygo.org/x/bluetooth/examples/heartrate/main.go:64
main.main()
        /home/ayke/src/tinygo.org/x/bluetooth/examples/heartrate/main.go:26 +0x51c
exit status 2

The commit introducing this is 2fb3b08, introduced in #36.

@aykevl aykevl changed the title Recent version doesn't work on the Raspberry Pi Recent version doesn't work on Debian buster Nov 29, 2020
@aykevl
Copy link
Member Author

aykevl commented Nov 29, 2020

Also confirmed this on my laptop, running Debian buster with BlueZ 5.50 (same as the Raspberry Pi).

@mogenson
Copy link
Contributor

mogenson commented Dec 9, 2020

I see the same thing. Ubuntu 20.04, bluez 5.53.

@deadprogram
Copy link
Member

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.

@deadprogram deadprogram added the bug Something isn't working label Dec 10, 2020
@mogenson
Copy link
Contributor

mogenson commented Dec 10, 2020

Unfortunately, I get the exact same output as before. I also tried on Arch Linux with bluez 5.55.

@aykevl
Copy link
Member Author

aykevl commented Dec 11, 2020

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?

@deadprogram
Copy link
Member

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 muka/go-bluetooth@f6113f7

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?

@mogenson
Copy link
Contributor

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.

@deadprogram
Copy link
Member

@mogenson and @aykevl please give a try to #49 it appears to correct this issue on my machine with BlueZ 5.50 installed. Thanks!

@aykevl
Copy link
Member Author

aykevl commented Jan 18, 2021

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.

@mogenson
Copy link
Contributor

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

@deadprogram
Copy link
Member

@mogenson I thought you were using Ubuntu?

@deadprogram
Copy link
Member

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.

@mogenson
Copy link
Contributor

mogenson commented Feb 8, 2021

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

@deadprogram
Copy link
Member

@mogenson can you run this while running the program that fails?

sudo dbus-monitor --system "type=error"

Thanks.

james-lawrence added a commit to james-lawrence/bluetooth that referenced this issue Aug 10, 2021
muka/go-bluetooth does some magic so you can use short UUIDs and it'll auto
expand them to the full 128 bit uuid. setting these flags disables that behavior.

related issues:
- allows updating muka library to resolve tinygo-org#35
- fixes the regression the upgrade caused tinygo-org#46
- commit causing the regression in upstream muka/go-bluetooth@1c4c1c8
@james-lawrence
Copy link
Contributor

this looks like its due to muka generating invalid UUIDs if passed 128 bit uuids for a service.

james-lawrence added a commit to james-lawrence/bluetooth that referenced this issue Aug 10, 2021
muka/go-bluetooth does some magic so you can use short UUIDs and it'll auto
expand them to the full 128 bit uuid. setting these flags disables that behavior.

related issues:
- allows updating muka library to resolve tinygo-org#35
- fixes the regression the upgrade caused tinygo-org#46
- commit causing the regression in upstream muka/go-bluetooth@1c4c1c8
deadprogram pushed a commit that referenced this issue Sep 3, 2021
muka/go-bluetooth does some magic so you can use short UUIDs and it'll auto
expand them to the full 128 bit uuid. setting these flags disables that behavior.

related issues:
- allows updating muka library to resolve #35
- fixes the regression the upgrade caused #46
- commit causing the regression in upstream muka/go-bluetooth@1c4c1c8
deadprogram pushed a commit that referenced this issue Sep 3, 2021
muka/go-bluetooth does some magic so you can use short UUIDs and it'll auto
expand them to the full 128 bit uuid. setting these flags disables that behavior.

related issues:
- allows updating muka library to resolve #35
- fixes the regression the upgrade caused #46
- commit causing the regression in upstream muka/go-bluetooth@1c4c1c8
@deadprogram
Copy link
Member

Now closing since 0.9.0 has been released. Thank you!

@aykevl
Copy link
Member Author

aykevl commented May 3, 2024

This was most likely fixed with #216.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linux
Projects
None yet
Development

No branches or pull requests

4 participants