bluetooth
bluetooth copied to clipboard
Fail on connect: Properties.GetAll org.bluez.Device1: Method "GetAll" with signature "s" on interface "org.freedesktop.DBus.Properties" doesn't exist
It's strange that yesterday it still works, but today it shows error when connecting to a bluetooth device:
Properties.GetAll org.bluez.Device1: Method "GetAll" with signature "s" on interface "org.freedesktop.DBus.Properties" doesn't exist
The code:
var adapter = bluetooth.DefaultAdapter
if e := adapter.Enable(); e != nil {
panic(e)
}
mac, _ := bluetooth.ParseMAC("71:42:F7:76:BC:88")
a := bluetooth.Address{MACAddress: bluetooth.MACAddress{MAC: mac}}
_, e := adapter.Connect(a, bluetooth.ConnectionParams{})
if e != nil {
fmt.Println(e.Error())
}
I tried to reboot my machine, still no luck. But it can be connected from bluetoothctl -> connect <MAC>.
I'm on Kali Linux, How to trace the problem? Thanks.
Did you happen to update your Bluez by any chance? Sounds a lot like it.
@deadprogram I checked /var/log/apt/history.log, I didn't upgrade in 48 hours, but I did hibernate the PC yesterday and restored it this morning. I thought maybe the hibernation causes it so I tried reboot, but problem still exists.
I upgrade the system just now, there is an upgrade for bluetooth, bluez, now it shows another error:
MapToStruct: Field not found: Bonded
Hola lovely people,
I was personally experiencing this also. I pinned it down a bit; this does not work:
addr := bluetooth.Address{}
addr.Set(c.Address)
if dev, err := bt.adapter.Connect(addr, bluetooth.ConnectionParams{}); err != nil {
// Error
}
But this does
addr, err := bluetooth.ParseMAC(c.Address)
if err != nil {
return nil, fmt.Errorf("unable to parse mac: %w", err)
}
if dev, err := bt.adapter.Connect(bluetooth.Address{bluetooth.MACAddress{MAC: addr}}, bluetooth.ConnectionParams{}); err != nil {
// Seems Fine
}
I'm not sure why just yet. Anyway, without doing this the address is (somehow) just 0's, and dbus is looking up a device like:
/dev/hci0/00_00_00_00_00_00
(or whatever) and it does not work! I think this might be a slightly different issue than the original post, however.
Did you happen to update your Bluez by any chance? Sounds a lot like it.
Is that a problem? Does this repo not support newer Bluez?
I was already doing the supposed "seems fine" way of parsing addresses, above.
Ok, thanks to some forum posts I'm inferring that this error message in this context means something like "no recent scan was performed".
If I do a quick bluetooth scan and immediately try to connect, then it works.
If I then wait a few seconds, connects will stop working again.
DBUS and Bluetooth. Two technologies that are apparently beyond humanity to make reliable.
This should now be fixed on the dev branch. I will tag this issue to be closed on next release.
Now closing since 0.9.0 has been released. Thank you!