Question about AdapterExists error
1am opened this issue · 3 comments
Hello,
I'm working on a project using go-bluetooth and on one platform I'm experiencing an issue with the code throwing AdapterExists: read unix @->var/run/dbus/system_bus_socket: EOF
on api.GetAdapter(adapterID)
call.
The same thing works ok on my Ubuntu 20 but on a trimmed down custom build OpenWRT with Bluez 5.56 it fails with this error.
Obviously this is not related to the library whatsoever but I'm trying to find the reason for this behaviour and looking for help, maybe someone here would know what I should to look at.
What puzzles me is that DBus is all ok, all features of bluetoothctl
seem to be working fine - I can connect, read and write to peripheral without any issues - and if I'm not mistaken bluetoothctl
also uses DBus in a similar way as go-bluetooth does.
Would really appreciate if someone would have some ideas to check. It has to be something with DBus itself but I don't understand why AdapterExists is actually an error. It's a good thing after all that it exists :)
This may be a permission issue in dbus, have you tried running as root? Can you check the policies in /etc/dbus*?
If the connection to dbus is ok, it may then be related to the message sent not being compatible with the dbus service interface for Adapter. Maybe adapterID is an empty string?
Thank you for your reply. I've compared the configuration, permissions and everything looked okay. I've eventually found that the same code worked on my older OpenWRT builds but I needed to update a ton of packages to make Zephyr HCI stack work on it. As it turned out one of the packages which updated was dbus and it was bumped in the packages feed to 1.13.x while my older and Ubuntu 20 builds used 1.12.x. After some shenanigans with overriding the packages from multiple sources I've made a OpenWRT build with dbus 1.12.12 and it worked like a charm!
I don't know if this has any value to but maybe there is some incompatibility of go-bluetooth vs dbus 1.13.x as the bluetoothctl tool worked with both. DBus is a broad and unexplored topic for me so it's hard to know where to look for the potential problems but I'm just sharing my finding.