dfrankland / bluster

A Rust crate for implementing BLE (Bluetooth Low Energy) peripherals
https://crates.io/crates/bluster
MIT License
111 stars 33 forks source link

test failed [ respbian on raspberrypi 4 ] #32

Open warycat opened 4 years ago

warycat commented 4 years ago

I am new to bluetooth. Here is the error message I get when running cargo test

     Running target/debug/deps/peripheral-a9f026bb0e36634c

running 1 test
 ERROR bluster::peripheral::bluez > Failed to register advertisement: **Bluster Bluez Error**

    org.bluez.Error.Failed:
        Failed to register advertisement
test it_advertises_gatt ... test it_advertises_gatt has been running for over 60 seconds
Spferical commented 4 years ago

Looks like the error messages should be improved.

To summarize what the error means: bluster communicates with BlueZ, the bluetooth stack on linux. BlueZ returned an error when bluster tried to register an advertisement over DBus. Unfortunately, we don't propagate the inner BlueZ error.

In the meantime, to debug what's happening further (could be a bluetooth device limitation, could be a permissions error?), I would see if you can manually register an advertisement with bluetoothctl advertise peripheral. To see the full error BlueZ is returning, try starting up sudo busctl --system monitor org.bluez in a separate terminal to while running cargo test. You should see a failed RegisterAdvertisement call. It might help to see if there's anything in the BlueZ daemon's logs with sudo systemctl status bluetooth.service.

Hope this helps!

warycat commented 4 years ago

I tried again. Here is the dbus log. I get.

` ‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=2 Sender=:1.25 Destination=org.bluez Path=/ Interface=org.freedesktop.DBus.ObjectManager Member=GetManagedObjects UniqueName=:1.25 MESSAGE "" { };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=170 ReplyCookie=2 Sender=:1.5 Destination=:1.25 UniqueName=:1.5 MESSAGE "a{oa{sa{sv}}}" { ARRAY "{oa{sa{sv}}}" { DICT_ENTRY "oa{sa{sv}}" { OBJECT_PATH "/org/bluez"; ARRAY "{sa{sv}}" { DICT_ENTRY "sa{sv}" { STRING "org.freedesktop.DBus.Introspectable"; ARRAY "{sv}" { }; }; DICT_ENTRY "sa{sv}" { STRING "org.bluez.AgentManager1"; ARRAY "{sv}" { }; }; DICT_ENTRY "sa{sv}" { STRING "org.bluez.ProfileManager1"; ARRAY "{sv}" { }; }; DICT_ENTRY "sa{sv}" { STRING "org.bluez.HealthManager1"; ARRAY "{sv}" { }; }; }; }; DICT_ENTRY "oa{sa{sv}}" { OBJECT_PATH "/org/bluez/hci0"; ARRAY "{sa{sv}}" { DICT_ENTRY "sa{sv}" { STRING "org.freedesktop.DBus.Introspectable"; ARRAY "{sv}" { }; }; DICT_ENTRY "sa{sv}" { STRING "org.bluez.Adapter1"; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "Address"; VARIANT "s" { STRING "DC:A6:32:AF:5F:48"; }; }; DICT_ENTRY "sv" { STRING "AddressType"; VARIANT "s" { STRING "public"; }; }; DICT_ENTRY "sv" { STRING "Name"; VARIANT "s" { STRING "raspberrypi"; }; }; DICT_ENTRY "sv" { STRING "Alias"; VARIANT "s" { STRING "raspberrypi"; }; }; DICT_ENTRY "sv" { STRING "Class"; VARIANT "u" { UINT32 0; }; }; DICT_ENTRY "sv" { STRING "Powered"; VARIANT "b" { BOOLEAN true; }; }; DICT_ENTRY "sv" { STRING "Discoverable"; VARIANT "b" { BOOLEAN false; }; }; DICT_ENTRY "sv" { STRING "DiscoverableTimeout"; VARIANT "u" { UINT32 180; }; }; DICT_ENTRY "sv" { STRING "Pairable"; VARIANT "b" { BOOLEAN true; }; }; DICT_ENTRY "sv" { STRING "PairableTimeout"; VARIANT "u" { UINT32 0; }; }; DICT_ENTRY "sv" { STRING "Discovering"; VARIANT "b" { BOOLEAN false; }; }; DICT_ENTRY "sv" { STRING "UUIDs"; VARIANT "as" { ARRAY "s" { STRING "6e400001-b5a3-f393-e0a9-e50e24dcca9e"; STRING "00001801-0000-1000-8000-00805f9b34fb"; STRING "0000110e-0000-1000-8000-00805f9b34fb"; STRING "00001200-0000-1000-8000-00805f9b34fb"; STRING "0000110c-0000-1000-8000-00805f9b34fb"; STRING "00001800-0000-1000-8000-00805f9b34fb"; }; }; }; DICT_ENTRY "sv" { STRING "Modalias"; VARIANT "s" { STRING "usb:v1D6Bp0246d0532"; }; }; }; }; DICT_ENTRY "sa{sv}" { STRING "org.freedesktop.DBus.Properties"; ARRAY "{sv}" { }; }; DICT_ENTRY "sa{sv}" { STRING "org.bluez.GattManager1"; ARRAY "{sv}" { }; }; DICT_ENTRY "sa{sv}" { STRING "org.bluez.LEAdvertisingManager1"; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "ActiveInstances"; VARIANT "y" { BYTE 1; }; }; DICT_ENTRY "sv" { STRING "SupportedInstances"; VARIANT "y" { BYTE 4; }; }; DICT_ENTRY "sv" { STRING "SupportedIncludes"; VARIANT "as" { ARRAY "s" { STRING "tx-power"; STRING "appearance"; STRING "local-name"; }; }; }; }; }; DICT_ENTRY "sa{sv}" { STRING "org.bluez.Media1"; ARRAY "{sv}" { }; }; DICT_ENTRY "sa{sv}" { STRING "org.bluez.NetworkServer1"; ARRAY "{sv}" { }; }; }; }; }; };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=3 Sender=:1.25 Destination=org.bluez Path=/org/bluez/hci0 Interface=org.freedesktop.DBus.Properties Member=Set UniqueName=:1.25 MESSAGE "ssv" { STRING "org.bluez.Adapter1"; STRING "Powered"; VARIANT "b" { BOOLEAN true; }; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=171 ReplyCookie=3 Sender=:1.5 Destination=:1.25 UniqueName=:1.5 MESSAGE "" { };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=4 Sender=:1.25 Destination=org.bluez Path=/org/bluez/hci0 Interface=org.freedesktop.DBus.Properties Member=Get UniqueName=:1.25 MESSAGE "ss" { STRING "org.bluez.Adapter1"; STRING "Powered"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=172 ReplyCookie=4 Sender=:1.5 Destination=:1.25 UniqueName=:1.5 MESSAGE "v" { VARIANT "b" { BOOLEAN true; }; };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=5 Sender=:1.25 Destination=org.bluez Path=/org/bluez/hci0 Interface=org.bluez.GattManager1 Member=RegisterApplication UniqueName=:1.25 MESSAGE "oa{sv}" { OBJECT_PATH "/org/bluez/example"; ARRAY "{sv}" { }; };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=173 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=AddMatch UniqueName=:1.5 MESSAGE "s" { STRING "type='signal',sender='org.freedesktop.DBus',path='/org/freedesktop/DBus',interface='org.freedesktop.DBus',member='NameOwnerChanged',arg0=':1.25'"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=108 ReplyCookie=173 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "" { };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=174 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=GetNameOwner UniqueName=:1.5 MESSAGE "s" { STRING ":1.25"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=109 ReplyCookie=174 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "s" { STRING ":1.25"; };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=175 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=AddMatch UniqueName=:1.5 MESSAGE "s" { STRING "type='signal',sender=':1.25',path='/org/bluez/example',interface='org.freedesktop.DBus.ObjectManager',member='InterfacesAdded'"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=110 ReplyCookie=175 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "" { };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=176 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=AddMatch UniqueName=:1.5 MESSAGE "s" { STRING "type='signal',sender=':1.25',path='/org/bluez/example',interface='org.freedesktop.DBus.ObjectManager',member='InterfacesRemoved'"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=111 ReplyCookie=176 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "" { };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=177 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=AddMatch UniqueName=:1.5 MESSAGE "s" { STRING "type='signal',sender=':1.25',path_namespace='/org/bluez/example'"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=112 ReplyCookie=177 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "" { };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=178 Sender=:1.5 Destination=:1.25 Path=/org/bluez/example Interface=org.freedesktop.DBus.ObjectManager Member=GetManagedObjects UniqueName=:1.5 MESSAGE "" { };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=6 ReplyCookie=178 Sender=:1.25 Destination=:1.5 UniqueName=:1.25 MESSAGE "a{oa{sa{sv}}}" { ARRAY "{oa{sa{sv}}}" { DICT_ENTRY "oa{sa{sv}}" { OBJECT_PATH "/org/bluez/example/service0000/characteristic0000"; ARRAY "{sa{sv}}" { DICT_ENTRY "sa{sv}" { STRING "org.bluez.GattCharacteristic1"; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "UUID"; VARIANT "s" { STRING "00002a3d-0000-1000-8000-00805f9b34fb"; }; }; DICT_ENTRY "sv" { STRING "Service"; VARIANT "o" { OBJECT_PATH "/org/bluez/example/service0000"; }; }; DICT_ENTRY "sv" { STRING "Flags"; VARIANT "as" { ARRAY "s" { STRING "read"; STRING "write"; STRING "notify"; }; }; }; }; }; }; }; DICT_ENTRY "oa{sa{sv}}" { OBJECT_PATH "/org/bluez/example/service0000/characteristic0000/descriptor0000"; ARRAY "{sa{sv}}" { DICT_ENTRY "sa{sv}" { STRING "org.bluez.GattDescriptor1"; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "UUID"; VARIANT "s" { STRING "00002a3d-0000-1000-8000-00805f9b34fb"; }; }; DICT_ENTRY "sv" { STRING "Flags"; VARIANT "as" { ARRAY "s" { STRING "read"; STRING "write"; }; }; }; DICT_ENTRY "sv" { STRING "Characteristic"; VARIANT "o" { OBJECT_PATH "/org/bluez/example/service0000/characteristic0000"; }; }; }; }; }; }; DICT_ENTRY "oa{sa{sv}}" { OBJECT_PATH "/org/bluez/example/service0000"; ARRAY "{sa{sv}}" { DICT_ENTRY "sa{sv}" { STRING "org.bluez.GattService1"; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "UUID"; VARIANT "s" { STRING "00001234-0000-1000-8000-00805f9b34fb"; }; }; DICT_ENTRY "sv" { STRING "Primary"; VARIANT "b" { BOOLEAN true; }; }; }; }; }; }; }; };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=179 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=AddMatch UniqueName=:1.5 MESSAGE "s" { STRING "type='signal',sender=':1.25',path='/org/bluez/example/service0000/characteristic0000',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.bluez.GattCharacteristic1'"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=113 ReplyCookie=179 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "" { };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=180 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=AddMatch UniqueName=:1.5 MESSAGE "s" { STRING "type='signal',sender=':1.25',path='/org/bluez/example/service0000/characteristic0000/descriptor0000',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.bluez.GattDescriptor1'"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=114 ReplyCookie=180 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "" { };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=181 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=AddMatch UniqueName=:1.5 MESSAGE "s" { STRING "type='signal',sender=':1.25',path='/org/bluez/example/service0000',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.bluez.GattService1'"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=115 ReplyCookie=181 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "" { };

‣ Type=signal Endian=l Flags=1 Version=1 Priority=0 Cookie=182 Sender=:1.5 Path=/org/bluez/hci0 Interface=org.freedesktop.DBus.Properties Member=PropertiesChanged UniqueName=:1.5 MESSAGE "sa{sv}as" { STRING "org.bluez.Adapter1"; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "UUIDs"; VARIANT "as" { ARRAY "s" { STRING "6e400001-b5a3-f393-e0a9-e50e24dcca9e"; STRING "00001801-0000-1000-8000-00805f9b34fb"; STRING "0000110e-0000-1000-8000-00805f9b34fb"; STRING "00001200-0000-1000-8000-00805f9b34fb"; STRING "0000110c-0000-1000-8000-00805f9b34fb"; STRING "00001234-0000-1000-8000-00805f9b34fb"; STRING "00001800-0000-1000-8000-00805f9b34fb"; }; }; }; }; ARRAY "s" { }; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=183 ReplyCookie=5 Sender=:1.5 Destination=:1.25 UniqueName=:1.5 MESSAGE "" { };

‣ Type=signal Endian=l Flags=1 Version=1 Priority=0 Cookie=184 Sender=:1.5 Path=/org/bluez/hci0 Interface=org.freedesktop.DBus.Properties Member=PropertiesChanged UniqueName=:1.5 MESSAGE "sa{sv}as" { STRING "org.bluez.Adapter1"; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "UUIDs"; VARIANT "as" { ARRAY "s" { STRING "6e400001-b5a3-f393-e0a9-e50e24dcca9e"; STRING "00001801-0000-1000-8000-00805f9b34fb"; STRING "0000110e-0000-1000-8000-00805f9b34fb"; STRING "00001200-0000-1000-8000-00805f9b34fb"; STRING "0000110c-0000-1000-8000-00805f9b34fb"; STRING "00001234-0000-1000-8000-00805f9b34fb"; STRING "00001800-0000-1000-8000-00805f9b34fb"; }; }; }; }; ARRAY "s" { }; };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=7 Sender=:1.25 Destination=org.bluez Path=/org/bluez/hci0 Interface=org.bluez.LEAdvertisingManager1 Member=RegisterAdvertisement UniqueName=:1.25 MESSAGE "oa{sv}" { OBJECT_PATH "/org/bluez/example/advertisement0000"; ARRAY "{sv}" { }; };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=185 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=GetNameOwner UniqueName=:1.5 MESSAGE "s" { STRING ":1.25"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=116 ReplyCookie=185 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "s" { STRING ":1.25"; };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=186 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=AddMatch UniqueName=:1.5 MESSAGE "s" { STRING "type='signal',sender=':1.25',path='/org/bluez/example/advertisement0000',interface='org.freedesktop.DBus.ObjectManager',member='InterfacesAdded'"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=117 ReplyCookie=186 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "" { };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=187 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=AddMatch UniqueName=:1.5 MESSAGE "s" { STRING "type='signal',sender=':1.25',path='/org/bluez/example/advertisement0000',interface='org.freedesktop.DBus.ObjectManager',member='InterfacesRemoved'"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=118 ReplyCookie=187 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "" { };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=188 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=AddMatch UniqueName=:1.5 MESSAGE "s" { STRING "type='signal',sender=':1.25',path_namespace='/org/bluez/example/advertisement0000'"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=119 ReplyCookie=188 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "" { };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=189 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=AddMatch UniqueName=:1.5 MESSAGE "s" { STRING "type='signal',sender=':1.25',path='/org/bluez/example/advertisement0000',interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.bluez.LEAdvertisement1'"; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=120 ReplyCookie=189 Sender=org.freedesktop.DBus Destination=:1.5 MESSAGE "" { };

‣ Type=method_call Endian=l Flags=1 Version=1 Priority=0 Cookie=190 Sender=:1.5 Destination=org.freedesktop.DBus Path=/org/freedesktop/DBus Interface=org.freedesktop.DBus Member=StartServiceByName UniqueName=:1.5 MESSAGE "su" { STRING ":1.25"; UINT32 0; };

‣ Type=error Endian=l Flags=1 Version=1 Priority=0 Cookie=121 ReplyCookie=190 Sender=org.freedesktop.DBus Destination=:1.5 ErrorName=org.freedesktop.DBus.Error.ServiceUnknown ErrorMessage="The name :1.25 was not provided by any .service files" MESSAGE "s" { STRING "The name :1.25 was not provided by any .service files"; };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=191 Sender=:1.5 Destination=:1.25 Path=/org/bluez/example/advertisement0000 Interface=org.freedesktop.DBus.ObjectManager Member=GetManagedObjects UniqueName=:1.5 MESSAGE "" { };

‣ Type=error Endian=l Flags=1 Version=1 Priority=0 Cookie=8 ReplyCookie=191 Sender=:1.25 Destination=:1.5 ErrorName=org.freedesktop.DBus.Error.UnknownObject ErrorMessage="Unknown object path /org/bluez/example/advertisement0000" UniqueName=:1.25 MESSAGE "s" { STRING "Unknown object path /org/bluez/example/advertisement0000"; };

‣ Type=method_call Endian=l Flags=0 Version=1 Priority=0 Cookie=192 Sender=:1.5 Destination=:1.25 Path=/org/bluez/example/advertisement0000 Interface=org.freedesktop.DBus.Properties Member=GetAll UniqueName=:1.5 MESSAGE "s" { STRING "org.bluez.LEAdvertisement1"; };

‣ Type=error Endian=l Flags=1 Version=1 Priority=0 Cookie=9 ReplyCookie=192 Sender=:1.25 Destination=:1.5 ErrorName=org.freedesktop.DBus.Error.UnknownObject ErrorMessage="Unknown object path /org/bluez/example/advertisement0000" UniqueName=:1.25 MESSAGE "s" { STRING "Unknown object path /org/bluez/example/advertisement0000"; };

‣ Type=signal Endian=l Flags=1 Version=1 Priority=0 Cookie=193 Sender=:1.5 Path=/org/bluez/hci0 Interface=org.freedesktop.DBus.Properties Member=PropertiesChanged UniqueName=:1.5 MESSAGE "sa{sv}as" { STRING "org.bluez.LEAdvertisingManager1"; ARRAY "{sv}" { DICT_ENTRY "sv" { STRING "SupportedInstances"; VARIANT "y" { BYTE 3; }; }; DICT_ENTRY "sv" { STRING "ActiveInstances"; VARIANT "y" { BYTE 2; }; }; }; ARRAY "s" { }; };

‣ Type=method_return Endian=l Flags=1 Version=1 Priority=0 Cookie=194 ReplyCookie=7 Sender=:1.5 Destination=:1.25 UniqueName=:1.5 MESSAGE "" { };

`