GATT Server: DBus GATT Services not advertised/exported
Hi all,
I am having issue to advertise/export GATT services exposed through DBus API. I tried ./test/example-gatt-server. And I also tried to merge ./test/example-advertisement into ./test/example-gatt-server. But in both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)
I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional debug statement all prefixed with '#'):
bluetoothd[16877]: src/gatt-database.c:manager_register_app() # manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() # create_app
bluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service0/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service2/char0/desc0, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service2/char2/desc3, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service2/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service1/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service2/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service0/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service2/char1/desc3, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service2/char1/desc2, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service0/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service2/char0/desc1, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service2/char2/desc2, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received: /org/bluez/example/service2/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:client_ready_cb() # client_ready_cb
bluetoothd[16877]: src/gatt-database.c:create_service() # create_service from /org/bluez/example/service2 bluetoothd[16877]: src/gatt-database.c:create_service() # create_service from /org/bluez/example/service1 bluetoothd[16877]: src/gatt-database.c:create_service() # create_service from /org/bluez/example/service0 bluetoothd[16877]: src/gatt-database.c:database_add_app() # database_add_app
bluetoothd[16877]: src/gatt-database.c:database_add_service() # database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() # gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() # database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() # gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() # database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() # gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement registered: /org/bluez/example/advertisement0
I start ./test/example-gatt-server as a normal user. But Bluez does not seem to have any permission issue with it.
I am using 'BLE scanner' on Android to discover the GATT services. But I think the problem is coming from Bluez. When I connect the Android device to Bluez, I can see this log:
bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected eir_len 14
bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR ATT connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref() 0x98cd908: g_attrib_ref=1
bluetoothd[16877]: src/device.c:load_gatt_db() # load_gatt_db: Restoring 98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() # load_gatt_db_impl
bluetoothd[16877]: src/device.c:load_service() # load_service: loading service: 0x0001, end: 0x0005, uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_service() # load_service: loading service: 0x0014, end: 0xffff, uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle: 0x0002, value handle: 0x0003, properties 0x0020 uuid: 00002a05-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle: 0x0015, value handle: 0x0016, properties 0x0002 uuid: 00002a00-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle: 0x0017, value handle: 0x0018, properties 0x0002 uuid: 00002a01-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID: 00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID: 00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() # add_primary
bluetoothd[16877]: src/device.c:add_primary() # add_primary
bluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept (98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state() 0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected -> connected (0) bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device connected.
bluetoothd[16877]: src/device.c:gatt_server_init() # gatt_server_init
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2
bluetoothd[16877]: src/device.c:gatt_debug() start: 0x0001, end: 0x0005, uuid: 00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:gatt_debug() start: 0x0014, end: 0xffff, uuid: 00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status: success, error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() # register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() # add_primary
bluetoothd[16877]: src/device.c:add_primary() # add_primary
bluetoothd[16877]: src/device.c:add_gatt_service() # add_gatt_service: UUID:00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects for GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service: /org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001
bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported GATT characteristic: /org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0
bluetoothd[16877]: src/device.c:store_gatt_db() # store_gatt_db
bluetoothd[16877]: src/device.c:store_service() # store_service
bluetoothd[16877]: src/device.c:store_service() # store_service
bluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device Name: Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance: 0x0000
I also reduced DBus 'TestAdvertisement' interface to only expose one GATT Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):
def __init__(self, bus, index):
Advertisement.__init__(self, bus, index, 'peripheral')
#self.add_service_uuid('180D') # HeartRate
self.add_service_uuid('180F') # Battery
#self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03, 0x04])
#self.add_service_data('9999', [0x00, 0x01, 0x02, 0x03, 0x04]) self.include_tx_power = True
My concern is mainly these lines:
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2
bluetoothd[16877]: src/device.c:gatt_debug() start: 0x0001, end: 0x0005, uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start: 0x0014, end: 0xffff, uuid: 00001800-0000-1000-8000-00805f9b34fb
I have not found the code that export GATT Services from GATT Database to the BLE central.
From my search on Internet, it looks I am not the only one who is having this issue I am happy to share/test anything that could help to make some progress.
Thanks,
Olivier
Hello Olivier,
Quoted 107 lines · Olivier MARTIN
Hi all,
I am having issue to advertise/export GATT services exposed through DBus API. I tried./test/example-gatt-server. And I also tried to merge./test/example-advertisementinto./test/example-gatt-server. But in both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional debug statement all prefixed with '#'):
bluetoothd[16877]: src/gatt-database.c:manager_register_app() #
manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() #create_appbluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering
application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc0, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc3, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc3, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc2, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc1, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc2, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:client_ready_cb() #client_ready_cbbluetoothd[16877]: src/gatt-database.c:create_service() #create_servicefrom /org/bluez/example/service2
bluetoothd[16877]: src/gatt-database.c:create_service() #create_servicefrom /org/bluez/example/service1
bluetoothd[16877]: src/gatt-database.c:create_service() #create_servicefrom /org/bluez/example/service0
bluetoothd[16877]: src/gatt-database.c:database_add_app() #database_add_appbluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application
registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0
Quoted 2 lines
I start
./test/example-gatt-serveras a normal user. But Bluez does not seem to have any permission issue with it.
Building from source I've seen something similar if I've used sudo for the make.
To compile and install I use sudo for the install only:
make -j 4 && sudo make install
Quoted 89 lines
I am using 'BLE scanner' on Android to discover the GATT services. But I think the problem is coming from Bluez. When I connect the Android device to Bluez, I can see this log:
bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected
eir_len14
bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR ATT connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref()0x98cd908: g_attrib_ref=1 bluetoothd[16877]: src/device.c:load_gatt_db() #load_gatt_db: Restoring 98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() #load_gatt_db_implbluetoothd[16877]: src/device.c:load_service() #load_service: loading
service:0x0001, end:0x0005, uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_service() #load_service: loading
service:0x0014, end:0xffff, uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0002, value handle:0x0003, properties0x0020uuid:
00002a05-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0015, value handle:0x0016, properties0x0002uuid:
00002a00-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0017, value handle:0x0018, properties0x0002uuid:
00002a01-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept (98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state()0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected -> connected (0)
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device connected.
bluetoothd[16877]: src/device.c:gatt_server_init() #gatt_server_initbluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status: success,
error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() #register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_gatt_service() #add_gatt_service:
UUID:00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects for GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001 bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported GATT
characteristic: /org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0
bluetoothd[16877]: src/device.c:store_gatt_db() #store_gatt_dbbluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device Name:
Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance:0x0000I also reduced DBus 'TestAdvertisement' interface to only expose one GATT Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):def __init__(self, bus, index): Advertisement.__init__(self, bus, index, 'peripheral') #self.add_service_uuid('180D') # HeartRate self.add_service_uuid('180F') # Battery #self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03, 0x04]) #self.add_service_data('9999', [0x00, 0x01, 0x02, 0x03, 0x04]) self.include_tx_power = True
Quoted 8 lines
My concern is mainly these lines:
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[16877]: src/device.c:gatt_debug() start:
0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb
I've seen this kind of error message when I've had a failure of a previous script and the Bluetooth daemon is in some unknown state. At this point it is worth restarting the bluetooth service with:
sudo service bluetooth restart
You will see in the advertising DBus API documentation that it is still in experimental mode in 5.44.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n78
This means that you need to make sure bluetoothd is started in experimental mode. Have you done this?
You can check with "sudo service bluetooth status"
Experimental can be switched on by default in the bluetooth.service file
Edit /lib/systemd/system/bluetooth.service file to add --experimental flag e.g:
sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/' /lib/systemd/system/bluetooth.service
Quoted 14 lines
I have not found the code that export GATT Services from GATT Database to the BLE central.
From my search on Internet, it looks I am not the only one who is having this issue
I am happy to share/test anything that could help to make some progress.Thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks for replying my message Barry,
Sorry, I forgot to mention but I start Bluez daemon with sudo ./src/bluetoothd -E -n -d (after stopping the bluetooth service). So I already run it with sudo and experimental option.
I am not sure to understand what you mean by "this kind of error message". Because I do not see any error message in the log I provided.
Any other idea?
Quoted 258 lines · Barry Byford
Hello Olivier,
Quoted 107 lines · Olivier MARTIN
Hi all,
I am having issue to advertise/export GATT services exposed through DBus API. I tried./test/example-gatt-server. And I also tried to merge./test/example-advertisementinto./test/example-gatt-server. But in both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional debug statement all prefixed with '#'):
bluetoothd[16877]: src/gatt-database.c:manager_register_app() #
manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() #create_appbluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering
application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc0, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc3, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc3, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc2, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc1, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc2, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:client_ready_cb() #client_ready_cbbluetoothd[16877]: src/gatt-database.c:create_service() #create_servicefrom /org/bluez/example/service2
bluetoothd[16877]: src/gatt-database.c:create_service() #create_servicefrom /org/bluez/example/service1
bluetoothd[16877]: src/gatt-database.c:create_service() #create_servicefrom /org/bluez/example/service0
bluetoothd[16877]: src/gatt-database.c:database_add_app() #database_add_appbluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application
registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0Quoted 2 lines
I start
./test/example-gatt-serveras a normal user. But Bluez does not seem to have any permission issue with it.Building from source I've seen something similar if I've used sudo for the make.
To compile and install I use sudo for the install only:
make -j 4 && sudo make install
Quoted 90 lines
I am using 'BLE scanner' on Android to discover the GATT services. But I think the problem is coming from Bluez. When I connect the Android device to Bluez, I can see this log:
bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected
eir_len14
bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR ATT connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref()0x98cd908: g_attrib_ref=1 bluetoothd[16877]: src/device.c:load_gatt_db() #load_gatt_db: Restoring 98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() #load_gatt_db_implbluetoothd[16877]: src/device.c:load_service() #load_service: loading
service:0x0001, end:0x0005, uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_service() #load_service: loading
service:0x0014, end:0xffff, uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0002, value handle:0x0003, properties0x0020uuid:
00002a05-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0015, value handle:0x0016, properties0x0002uuid:
00002a00-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0017, value handle:0x0018, properties0x0002uuid:
00002a01-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept (98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state()0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected -> connected (0)
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device connected.
bluetoothd[16877]: src/device.c:gatt_server_init() #gatt_server_initbluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status: success,
error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() #register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_gatt_service() #add_gatt_service:
UUID:00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects for GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001 bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported GATT
characteristic: /org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0
bluetoothd[16877]: src/device.c:store_gatt_db() #store_gatt_dbbluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device Name:
Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance:0x0000I also reduced DBus 'TestAdvertisement' interface to only expose one GATT Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):def __init__(self, bus, index): Advertisement.__init__(self, bus, index, 'peripheral') #self.add_service_uuid('180D') # HeartRate self.add_service_uuid('180F') # Battery #self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03,
0x04])
#self.add_service_data('9999', [0x00,0x01,0x02,0x03,0x04]) self.include_tx_power = TrueQuoted 8 lines
My concern is mainly these lines:
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[16877]: src/device.c:gatt_debug() start:
0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fbI've seen this kind of error message when I've had a failure of a previous script and the Bluetooth daemon is in some unknown state. At this point it is worth restarting the bluetooth service with:
sudo service bluetooth restartYou will see in the advertising DBus API documentation that it is still in experimental mode in 5.44.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n78This means that you need to make sure bluetoothd is started in experimental mode. Have you done this?
You can check with "sudo service bluetooth status"Experimental can be switched on by default in the bluetooth.service file
Edit
/lib/systemd/system/bluetooth.servicefile to add --experimental flag e.g:sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/'
/lib/systemd/system/bluetooth.serviceQuoted 14 lines
I have not found the code that export GATT Services from GATT Database to the BLE central.
From my search on Internet, it looks I am not the only one who is having this issue
I am happy to share/test anything that could help to make some progress.Thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
example-advertisementHello Oliver,
Quoted 8 lines · Olivier MARTIN
Thanks for replying my message Barry,
Sorry, I forgot to mention but I start Bluez daemon with
sudo ./src/bluetoothd -E -n -d(after stopping the bluetooth service). So I already run it with sudo and experimental option.I am not sure to understand what you mean by "this kind of error message". Because I do not see any error message in the log I provided.
OK, that was bad on my part. I read it as complaining that there were too many advertisements. Looking again that wasn't what it was say. Apologies.
Quoted 2 lines
Any other idea?
I am by Linux Single Board Computers (SBC) today so I'm able to run what you are running and can show you what I'm seeing. I'll focus on example-advertisement first as example-gatt-server doesn't change the advertisements.
I've started the BlueZ daemon with "./src/bluetoothd -E -n -d"
In another shell when I start "./example-advertisement" I see the following in the output:
bluetoothd[2325]: src/adapter.c:property_set_mode() sending Set Powered command for index 0
bluetoothd[2325]: src/adapter.c:property_set_mode_complete() Success (0x00) bluetoothd[2325]: src/adapter.c:new_settings_callback() Settings: 0x00000ad1 bluetoothd[2325]: src/adapter.c:settings_changed() Changed settings: 0x00000001 bluetoothd[2325]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
bluetoothd[2325]: src/adapter.c:trigger_passive_scanning() bluetoothd[2325]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[2325]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[2325]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[2325]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[2325]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[2325]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0
bluetoothd[2325]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0
On a second SBC, at the command line I run "bluetoothctl" and do "scan on". Once my first SBC is found I do "scan off". I then do "info B8:27:EB:22:57:E0" (this is the address of the first SBC) which gives the following output:
[bluetooth]# info B8:27:EB:22:57:E0
Device B8:27:EB:22:57:E0
Alias: B8-27-EB-22-57-E0
Paired: no
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Heart Rate (0000180d-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
ManufacturerData Key: 0xffff
ManufacturerData Value: 0x00
ManufacturerData Value: 0x01
ManufacturerData Value: 0x02
ManufacturerData Value: 0x03
ManufacturerData Value: 0x04
ServiceData Key: 00009999-0000-1000-8000-00805f9b34fb ServiceData Value: 0x00
ServiceData Value: 0x01
ServiceData Value: 0x02
ServiceData Value: 0x03
ServiceData Value: 0x04
I've also done a scan from my Android phone (using the Nordic nRF Connect app) and can see the advertisements also (just hard to share that information on here).
Does that help?
Quoted 292 lines · Barry Byford
Quoted 287 lines
Hello Olivier,
Quoted 117 lines · Olivier MARTIN
Hi all,
I am having issue to advertise/export GATT services exposed through DBus API. I tried./test/example-gatt-server. And I also tried to merge./test/example-advertisementinto./test/example-gatt-server. But in both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional debug
statement all prefixed with '#'):bluetoothd[16877]: src/gatt-database.c:manager_register_app() #
manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() #create_appbluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering
application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc0, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc3, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc3, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc2, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc1, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc2, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:client_ready_cb() #client_ready_cb
bluetoothd[16877]: src/gatt-database.c:create_service() #create_servicefrom /org/bluez/example/service2
bluetoothd[16877]: src/gatt-database.c:create_service() #create_servicefrom /org/bluez/example/service1
bluetoothd[16877]: src/gatt-database.c:create_service() #create_servicefrom /org/bluez/example/service0
bluetoothd[16877]: src/gatt-database.c:database_add_app() #database_add_app
bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application
registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData
for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0Quoted 2 lines
I start
./test/example-gatt-serveras a normal user. But Bluez does not seem to have any permission issue with it.Building from source I've seen something similar if I've used sudo for the make.
To compile and install I use sudo for the install only:
make -j 4 && sudo make install
Quoted 103 lines
I am using 'BLE scanner' on Android to discover the GATT services. But I think the problem is coming from Bluez. When I connect the Android device to
Bluez, I can see this log:bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected
eir_len14
bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR ATT
connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref()0x98cd908:
g_attrib_ref=1
bluetoothd[16877]: src/device.c:load_gatt_db() #load_gatt_db: Restoring 98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() #load_gatt_db_implbluetoothd[16877]: src/device.c:load_service() #load_service: loading
service:0x0001, end:0x0005, uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_service() #load_service: loading
service:0x0014, end:0xffff, uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0002, value handle:0x0003, properties0x0020uuid:
00002a05-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0015, value handle:0x0016, properties0x0002uuid:
00002a00-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0017, value handle:0x0018, properties0x0002uuid:
00002a01-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept (98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state()0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected -> connected (0)
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device connected.
bluetoothd[16877]: src/device.c:gatt_server_init() #gatt_server_initbluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status: success,
error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() #register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_gatt_service() #add_gatt_service:
UUID:00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects for
GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001 bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported GATT
characteristic:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0 bluetoothd[16877]: src/device.c:store_gatt_db() #store_gatt_dbbluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device Name:
Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance:0x0000I also reduced DBus 'TestAdvertisement' interface to only expose one GATT Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):def __init__(self, bus, index): Advertisement.__init__(self, bus, index, 'peripheral') #self.add_service_uuid('180D') # HeartRate self.add_service_uuid('180F') # Battery #self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03,
0x04])
#self.add_service_data('9999', [0x00,0x01,0x02,0x03,0x04]) self.include_tx_power = TrueQuoted 8 lines
My concern is mainly these lines:
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[16877]: src/device.c:gatt_debug() start:
0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fbI've seen this kind of error message when I've had a failure of a previous script and the Bluetooth daemon is in some unknown state. At this point it is worth restarting the bluetooth service with:
sudo service bluetooth restartYou will see in the advertising DBus API documentation that it is still in experimental mode in 5.44.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n78
This means that you need to make sure bluetoothd is started in experimental mode. Have you done this?
You can check with "sudo service bluetooth status"Experimental can be switched on by default in the bluetooth.service file
Edit
/lib/systemd/system/bluetooth.servicefile to add --experimental flag e.g:sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/'
/lib/systemd/system/bluetooth.serviceQuoted 15 lines
I have not found the code that export GATT Services from GATT Database to the BLE central.
From my search on Internet, it looks I am not the only one who is having this issue
I am happy to share/test anything that could help to make some progress.Thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
You are right Barry, example-advertisement seems to work well (I installed and tried Nordic nRF Connect and I can see the expected advertisemet data). But I cannot still manage to get example-gatt-server :-(
I am sure I got it working last year with an older version of Bluez. But I cannot make it work with Bluez v5.44.
My testing procedure:
1. [Laptop] First terminal: Start sudo ./src/bluetoothd -E -n -d
2. [Laptop] Second terminal: Start unmodified Bluez ./test/example-gatt-server
3. [Laptop] Third terminal: Ensure the adapter is "Powered: yes" and "Discoverable: yes"
4. [Android] Connect using Nordic nRF Connect (I also tried with "BLE Scanner") and check I see the exposed GATT services by example-gatt-server Unfortunately, I can only see:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)
If I had to suspect Bluez code, I will guess there is something missing around here:
bluetoothd[20429]: src/device.c:gatt_server_init() # gatt_server_init
bluetoothd[20429]: src/device.c:gatt_debug() Primary services found: 2
bluetoothd[20429]: src/device.c:gatt_debug() start: 0x0001, end: 0x0005, uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() start: 0x0014, end: 0xffff, uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() Registered handler for "Service Changed": 0 bluetoothd[20429]: src/device.c:gatt_client_ready_cb() status: success, error: 0
As Bluez daemon does not get the GATT services from Buez GATT Database. But it might be me who miss a step...
Quoted 387 lines · Barry Byford
example-advertisementHello Oliver,
Quoted 8 lines · Olivier MARTIN
Thanks for replying my message Barry,
Sorry, I forgot to mention but I start Bluez daemon with
sudo ./src/bluetoothd -E -n -d(after stopping the bluetooth service). So I already run it with sudo and experimental option.I am not sure to understand what you mean by "this kind of error message". Because I do not see any error message in the log I provided.
OK, that was bad on my part. I read it as complaining that there were too many advertisements. Looking again that wasn't what it was say. Apologies.
Quoted 2 lines
Any other idea?
I am by Linux Single Board Computers (SBC) today so I'm able to run what you are running and can show you what I'm seeing. I'll focus on example-advertisement first as example-gatt-server doesn't change the advertisements.
I've started the BlueZ daemon with "./src/bluetoothd -E -n -d"
In another shell when I start "./example-advertisement" I see the following in the output:
bluetoothd[2325]: src/adapter.c:property_set_mode() sending Set Powered command for index 0
bluetoothd[2325]: src/adapter.c:property_set_mode_complete() Success (0x00) bluetoothd[2325]: src/adapter.c:new_settings_callback() Settings:0x00000ad1bluetoothd[2325]: src/adapter.c:settings_changed() Changed settings:0x00000001bluetoothd[2325]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
bluetoothd[2325]: src/adapter.c:trigger_passive_scanning() bluetoothd[2325]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[2325]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[2325]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[2325]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[2325]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[2325]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0
bluetoothd[2325]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0On a second SBC, at the command line I run "bluetoothctl" and do "scan on". Once my first SBC is found I do "scan off". I then do "info B8:27:EB:22:57:E0" (this is the address of the first SBC) which gives the following output:
[bluetooth]# info B8:27:EB:22:57:E0
Device B8:27:EB:22:57:E0
Alias: B8-27-EB-22-57-E0
Paired: no
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Heart Rate (0000180d-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
ManufacturerData Key:0xffff
ManufacturerData Value:0x00
ManufacturerData Value:0x01
ManufacturerData Value:0x02
ManufacturerData Value:0x03
ManufacturerData Value:0x04
ServiceData Key: 00009999-0000-1000-8000-00805f9b34fb ServiceData Value:0x00
ServiceData Value:0x01
ServiceData Value:0x02
ServiceData Value:0x03
ServiceData Value:0x04I've also done a scan from my Android phone (using the Nordic nRF Connect app) and can see the advertisements also (just hard to share that information on here).
Does that help?
Quoted 293 lines · Barry Byford
Quoted 288 lines
Hello Olivier,
Quoted 117 lines · Olivier MARTIN
Hi all,
I am having issue to advertise/export GATT services exposed through DBus API. I tried./test/example-gatt-server. And I also tried to merge./test/example-advertisementinto./test/example-gatt-server. But in both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional debug
statement all prefixed with '#'):bluetoothd[16877]: src/gatt-database.c:manager_register_app() #
manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() #create_appbluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering
application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc0, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc3, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc3, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc2, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc1, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc2, iface: org.bluez.GattDescriptor1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:client_ready_cb() #client_ready_cb
bluetoothd[16877]: src/gatt-database.c:create_service() #create_servicefrom /org/bluez/example/service2
bluetoothd[16877]: src/gatt-database.c:create_service() #create_servicefrom /org/bluez/example/service1
bluetoothd[16877]: src/gatt-database.c:create_service() #create_servicefrom /org/bluez/example/service0
bluetoothd[16877]: src/gatt-database.c:database_add_app() #database_add_app
bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application
registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData
for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0Quoted 2 lines
I start
./test/example-gatt-serveras a normal user. But Bluez does not seem to have any permission issue with it.Building from source I've seen something similar if I've used sudo for the make.
To compile and install I use sudo for the install only:
make -j 4 && sudo make install
Quoted 104 lines
I am using 'BLE scanner' on Android to discover the GATT services. But I think the problem is coming from Bluez. When I connect the Android device to
Bluez, I can see this log:bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected
eir_len14
bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR ATT
connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref()0x98cd908:
g_attrib_ref=1
bluetoothd[16877]: src/device.c:load_gatt_db() #load_gatt_db: Restoring 98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() #load_gatt_db_implbluetoothd[16877]: src/device.c:load_service() #load_service: loading
service:0x0001, end:0x0005, uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_service() #load_service: loading
service:0x0014, end:0xffff, uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0002, value handle:0x0003, properties0x0020uuid:
00002a05-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0015, value handle:0x0016, properties0x0002uuid:
00002a00-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0017, value handle:0x0018, properties0x0002uuid:
00002a01-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept (98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state()0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected -> connected (0)
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device connected.
bluetoothd[16877]: src/device.c:gatt_server_init() #gatt_server_initbluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status: success,
error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() #register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_gatt_service() #add_gatt_service:
UUID:00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects for
GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001 bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported GATT
characteristic:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0 bluetoothd[16877]: src/device.c:store_gatt_db() #store_gatt_dbbluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device Name:
Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance:0x0000I also reduced DBus 'TestAdvertisement' interface to only expose one GATT Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):def __init__(self, bus, index): Advertisement.__init__(self, bus, index, 'peripheral') #self.add_service_uuid('180D') # HeartRate self.add_service_uuid('180F') # Battery #self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03, 0x04]) #self.add_service_data('9999', [0x00, 0x01, 0x02, 0x03,
0x04])
self.include_tx_power = TrueQuoted 8 lines
My concern is mainly these lines:
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[16877]: src/device.c:gatt_debug() start:
0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fbI've seen this kind of error message when I've had a failure of a previous script and the Bluetooth daemon is in some unknown state. At this point it is worth restarting the bluetooth service with:
sudo service bluetooth restartYou will see in the advertising DBus API documentation that it is still in experimental mode in 5.44.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n78
This means that you need to make sure bluetoothd is started in experimental mode. Have you done this?
You can check with "sudo service bluetooth status"Experimental can be switched on by default in the bluetooth.service file
Edit
/lib/systemd/system/bluetooth.servicefile to add --experimental flag e.g:sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/'
/lib/systemd/system/bluetooth.serviceQuoted 15 lines
I have not found the code that export GATT Services from GATT Database to the BLE central.
From my search on Internet, it looks I am not the only one who is having this issue
I am happy to share/test anything that could help to make some progress.Thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello Olivier,
Quoted 2 lines · Olivier MARTIN
You are right Barry,
example-advertisementseems to work well (I installed and tried Nordic nRF Connect and I can see the expected advertisemet data).
Excellent!
Quoted 3 lines
But I cannot still manage to get
example-gatt-server:-(
I am sure I got it working last year with an older version of Bluez. But I cannot make it work with Bluez v5.44.
OK, I've taken a look at "example-gatt-server" and have it working...
Quoted 8 lines
My testing procedure:
1. [Laptop] First terminal: Start
sudo ./src/bluetoothd -E -n -d
2. [Laptop] Second terminal: Start unmodified Bluez ./test/example-gatt-server
3. [Laptop] Third terminal: Ensure the adapter is "Powered: yes" and "Discoverable: yes"
OK, I've done this slightly different (details below). However, the first thing I did was edit "/etc/bluetooth/main.conf"
I added the following line to the end of the file:
ControllerMode = le
Then I did the following:
1. [SBC1:T1] sudo ./src/bluetoothd -E -n -d
2. [SBC1:T2] ./example-gatt-server
3. [SBC1:T3] ./example-advertisement
Quoted 7 lines
4. [Android] Connect using Nordic nRF Connect (I also tried with "BLE Scanner") and check I see the exposed GATT services by
example-gatt-serverUnfortunately, I can only see:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)
I've used bluetoothctl on SBC2 to connect and read the battery values that the GATT server is counting down.
$ bluetoothctl [NEW] Controller 00:00:00:00:5A:AD linaro-alip [default] [bluetooth]# scan on Discovery started [CHG] Controller 00:00:00:00:5A:AD Discovering: yes [NEW] Device B8:27:EB:22:57:E0 BluezeroLight [bluetooth]# scan off Discovery stopped [CHG] Controller 00:00:00:00:5A:AD Discovering: no [bluetooth]# connect B8:27:EB:22:57:E0 Attempting to connect to B8:27:EB:22:57:E0 [CHG] Device B8:27:EB:22:57:E0 Connected: yes Connection successful [...snip...] [NEW] Primary Service /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a 0000180f-0000-1000-8000-00805f9b34fb Battery Service [NEW] Characteristic /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b 00002a19-0000-1000-8000-00805f9b34fb Battery Level [...snip...] [CHG] Device B8:27:EB:22:57:E0 ServicesResolved: yes [BluezeroLight]# select-attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [BluezeroLight:/service000a/char000b]# read Attempting to read /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 46 F [BluezeroLight:/service000a/char000b]# notify on [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: yes Notify started [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x44 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x42 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x40 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x3e [BluezeroLight:/service000a/char000b]# notify off [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: no Notify stopped
That seems to be working then. When I didn't have "ControllerMode = le" set then I did see it be unpredictable if it successfully connected or not.
This also worked connecting with the nRF app.
Does that work for you?
Quoted 471 lines
If I had to suspect Bluez code, I will guess there is something missing around here:
bluetoothd[20429]: src/device.c:gatt_server_init() #
gatt_server_initbluetoothd[20429]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[20429]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb
bluetoothd[20429]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb
bluetoothd[20429]: src/device.c:gatt_debug() Registered handler for "Service Changed": 0
bluetoothd[20429]: src/device.c:gatt_client_ready_cb() status: success,
error: 0As Bluez daemon does not get the GATT services from Buez GATT Database. But it might be me who miss a step...
Quoted 451 lines · Barry Byford
example-advertisementHello Oliver,
Quoted 10 lines · Olivier MARTIN
Thanks for replying my message Barry,
Sorry, I forgot to mention but I start Bluez daemon with
sudo ./src/bluetoothd -E -n -d(after stopping the bluetooth service). So I already run it with sudo and experimental option.I am not sure to understand what you mean by "this kind of error message".
Because I do not see any error message in the log I provided.OK, that was bad on my part. I read it as complaining that there were too many advertisements. Looking again that wasn't what it was say. Apologies.
Quoted 2 lines
Any other idea?
I am by Linux Single Board Computers (SBC) today so I'm able to run what you are running and can show you what I'm seeing. I'll focus on example-advertisement first as example-gatt-server doesn't change the advertisements.
I've started the BlueZ daemon with "./src/bluetoothd -E -n -d"
In another shell when I start "./example-advertisement" I see the following in the output:
bluetoothd[2325]: src/adapter.c:property_set_mode() sending Set Powered command for index 0
bluetoothd[2325]: src/adapter.c:property_set_mode_complete() Success (0x00)
bluetoothd[2325]: src/adapter.c:new_settings_callback() Settings:0x00000ad1
bluetoothd[2325]: src/adapter.c:settings_changed() Changed settings:0x00000001
bluetoothd[2325]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
bluetoothd[2325]: src/adapter.c:trigger_passive_scanning() bluetoothd[2325]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[2325]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[2325]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[2325]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[2325]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[2325]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0On a second SBC, at the command line I run "bluetoothctl" and do "scan on". Once my first SBC is found I do "scan off". I then do "info B8:27:EB:22:57:E0" (this is the address of the first SBC) which gives the following output:
[bluetooth]# info B8:27:EB:22:57:E0
Device B8:27:EB:22:57:E0
Alias: B8-27-EB-22-57-E0
Paired: no
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Heart Rate (0000180d-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
ManufacturerData Key:0xffff
ManufacturerData Value:0x00
ManufacturerData Value:0x01
ManufacturerData Value:0x02
ManufacturerData Value:0x03
ManufacturerData Value:0x04
ServiceData Key: 00009999-0000-1000-8000-00805f9b34fb ServiceData Value:0x00
ServiceData Value:0x01
ServiceData Value:0x02
ServiceData Value:0x03
ServiceData Value:0x04I've also done a scan from my Android phone (using the Nordic nRF Connect app) and can see the advertisements also (just hard to share that information on here).
Does that help?
Quoted 349 lines · Barry Byford
Quoted 343 lines
Hello Olivier,
Quoted 151 lines · Olivier MARTIN
Hi all,
I am having issue to advertise/export GATT services exposed through DBus
API. I tried./test/example-gatt-server. And I also tried to merge./test/example-advertisementinto./test/example-gatt-server. But in
both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional debug
statement all prefixed with '#'):bluetoothd[16877]: src/gatt-database.c:manager_register_app() #
manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() #create_appbluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering
application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered
advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc0, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc1, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:client_ready_cb() #client_ready_cb
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service2
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service1
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service0
bluetoothd[16877]: src/gatt-database.c:database_add_app() #database_add_app
bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application
registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData
for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0Quoted 3 lines
I start
./test/example-gatt-serveras a normal user. But Bluez does not
seem to have any permission issue with it.Building from source I've seen something similar if I've used sudo for the
make.To compile and install I use sudo for the install only:
make -j 4 && sudo make install
Quoted 116 lines
I am using 'BLE scanner' on Android to discover the GATT services. But I
think the problem is coming from Bluez. When I connect the Android device
to
Bluez, I can see this log:bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected
eir_len14
bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR ATT
connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref()0x98cd908:
g_attrib_ref=1
bluetoothd[16877]: src/device.c:load_gatt_db() #load_gatt_db:
Restoring
98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() #load_gatt_db_implbluetoothd[16877]: src/device.c:load_service() #load_service: loading
service:0x0001, end:0x0005, uuid:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_service() #load_service: loading
service:0x0014, end:0xffff, uuid:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0002, value handle:0x0003, properties0x0020uuid:
00002a05-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0015, value handle:0x0016, properties0x0002uuid:
00002a00-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0017, value handle:0x0018, properties0x0002uuid:
00002a01-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before
being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept (98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state()0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected -> connected (0)
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device connected.
bluetoothd[16877]: src/device.c:gatt_server_init() #gatt_server_initbluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status: success,
error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() #register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_gatt_service() #add_gatt_service:
UUID:00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client
ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects
for
GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001 bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported GATT
characteristic:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0 bluetoothd[16877]: src/device.c:store_gatt_db() #store_gatt_dbbluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device Name:
Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance:0x0000I also reduced DBus 'TestAdvertisement' interface to only expose one GATT
Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):def __init__(self, bus, index): Advertisement.__init__(self, bus, index, 'peripheral') #self.add_service_uuid('180D') # HeartRate self.add_service_uuid('180F') # Battery #self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03,
0x04])
#self.add_service_data('9999', [0x00,0x01,0x02,0x03,0x04]) self.include_tx_power = TrueMy concern is mainly these lines:
Quoted 8 lines
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[16877]: src/device.c:gatt_debug() start:
0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fbI've seen this kind of error message when I've had a failure of a previous script and the Bluetooth daemon is in some unknown state. At this point it is worth restarting the bluetooth service with:
sudo service bluetooth restartYou will see in the advertising DBus API documentation that it is still in experimental mode in 5.44.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n78
This means that you need to make sure bluetoothd is started in experimental mode. Have you done this?
You can check with "sudo service bluetooth status"Experimental can be switched on by default in the bluetooth.service file
Edit
/lib/systemd/system/bluetooth.servicefile to add --experimental flag
e.g:sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/'
/lib/systemd/system/bluetooth.serviceQuoted 18 lines
I have not found the code that export GATT Services from GATT Database to
the BLE central.From my search on Internet, it looks I am not the only one who is having
this issue
I am happy to share/test anything that could help to make some progress.Thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks Barry, setting 'ControllerMode = le' in /etc/bluetooth/main.conf fixed my issue. I can now see the GATT services.
But I guess my adapter now only works as BLE adapter and will ignore the non-LE devices. In the comment of /etc/bluetooth/main.conf it is written the adapter should be by default set as 'dual'.
Is it a bug in Bluez? Why GATT services are not exposed while using the default value for 'ControllerMode'?
Quoted 587 lines · Barry Byford
Hello Olivier,
Quoted 2 lines · Olivier MARTIN
You are right Barry,
example-advertisementseems to work well (I installed and tried Nordic nRF Connect and I can see the expected advertisemet data).Excellent!
Quoted 3 lines
But I cannot still manage to get
example-gatt-server:-(
I am sure I got it working last year with an older version of Bluez. But I cannot make it work with Bluez v5.44.OK, I've taken a look at "example-gatt-server" and have it working...
Quoted 8 lines
My testing procedure:
1. [Laptop] First terminal: Start
sudo ./src/bluetoothd -E -n -d
2. [Laptop] Second terminal: Start unmodified Bluez ./test/example-gatt-server
3. [Laptop] Third terminal: Ensure the adapter is "Powered: yes" and "Discoverable: yes"OK, I've done this slightly different (details below). However, the first thing I did was edit "
/etc/bluetooth/main.conf"
I added the following line to the end of the file:ControllerMode = le
Then I did the following:
1. [SBC1:T1] sudo ./src/bluetoothd -E -n -d
2. [SBC1:T2] ./example-gatt-server
3. [SBC1:T3] ./example-advertisementQuoted 7 lines
4. [Android] Connect using Nordic nRF Connect (I also tried with "BLE Scanner") and check I see the exposed GATT services by
example-gatt-serverUnfortunately, I can only see:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I've used bluetoothctl on SBC2 to connect and read the battery values that the GATT server is counting down.
$ bluetoothctl [NEW] Controller 00:00:00:00:5A:AD linaro-alip [default] [bluetooth]# scan on Discovery started [CHG] Controller 00:00:00:00:5A:AD Discovering: yes [NEW] Device B8:27:EB:22:57:E0 BluezeroLight [bluetooth]# scan off Discovery stopped [CHG] Controller 00:00:00:00:5A:AD Discovering: no [bluetooth]# connect B8:27:EB:22:57:E0 Attempting to connect to B8:27:EB:22:57:E0 [CHG] Device B8:27:EB:22:57:E0 Connected: yes Connection successful [...snip...] [NEW] Primary Service /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a 0000180f-0000-1000-8000-00805f9b34fb Battery Service [NEW] Characteristic /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b 00002a19-0000-1000-8000-00805f9b34fb Battery Level [...snip...] [CHG] Device B8:27:EB:22:57:E0 ServicesResolved: yes [BluezeroLight]# select-attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [BluezeroLight:/service000a/char000b]# read Attempting to read /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 46 F [BluezeroLight:/service000a/char000b]# notify on [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: yes Notify started [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x44 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x42 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x40 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x3e [BluezeroLight:/service000a/char000b]# notify off [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: no Notify stoppedThat seems to be working then. When I didn't have "ControllerMode = le" set then I did see it be unpredictable if it successfully connected or not.
This also worked connecting with the nRF app.Does that work for you?
Quoted 475 lines
If I had to suspect Bluez code, I will guess there is something missing around here:
bluetoothd[20429]: src/device.c:gatt_server_init() #
gatt_server_initbluetoothd[20429]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[20429]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb
bluetoothd[20429]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb
bluetoothd[20429]: src/device.c:gatt_debug() Registered handler for "Service Changed": 0
bluetoothd[20429]: src/device.c:gatt_client_ready_cb() status: success,
error: 0As Bluez daemon does not get the GATT services from Buez GATT Database. But it might be me who miss a step...
Quoted 455 lines · Barry Byford
example-advertisementHello Oliver,
Quoted 10 lines · Olivier MARTIN
Thanks for replying my message Barry,
Sorry, I forgot to mention but I start Bluez daemon with
sudo ./src/bluetoothd -E -n -d(after stopping the bluetooth service). So I already run it with sudo and experimental option.I am not sure to understand what you mean by "this kind of error message".
Because I do not see any error message in the log I provided.OK, that was bad on my part. I read it as complaining that there were too many advertisements. Looking again that wasn't what it was say. Apologies.
Quoted 2 lines
Any other idea?
I am by Linux Single Board Computers (SBC) today so I'm able to run what you are running and can show you what I'm seeing. I'll focus on example-advertisement first as example-gatt-server doesn't change the advertisements.
I've started the BlueZ daemon with "./src/bluetoothd -E -n -d"
In another shell when I start "./example-advertisement" I see the following in the output:
bluetoothd[2325]: src/adapter.c:property_set_mode() sending Set Powered command for index 0
bluetoothd[2325]: src/adapter.c:property_set_mode_complete() Success (0x00)
bluetoothd[2325]: src/adapter.c:new_settings_callback() Settings:0x00000ad1
bluetoothd[2325]: src/adapter.c:settings_changed() Changed settings:0x00000001
bluetoothd[2325]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
bluetoothd[2325]: src/adapter.c:trigger_passive_scanning() bluetoothd[2325]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[2325]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[2325]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[2325]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[2325]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[2325]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0On a second SBC, at the command line I run "bluetoothctl" and do "scan on". Once my first SBC is found I do "scan off". I then do "info B8:27:EB:22:57:E0" (this is the address of the first SBC) which gives the following output:
[bluetooth]# info B8:27:EB:22:57:E0
Device B8:27:EB:22:57:E0
Alias: B8-27-EB-22-57-E0
Paired: no
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Heart Rate (0000180d-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
ManufacturerData Key:0xffff
ManufacturerData Value:0x00
ManufacturerData Value:0x01
ManufacturerData Value:0x02
ManufacturerData Value:0x03
ManufacturerData Value:0x04
ServiceData Key: 00009999-0000-1000-8000-00805f9b34fb ServiceData Value:0x00
ServiceData Value:0x01
ServiceData Value:0x02
ServiceData Value:0x03
ServiceData Value:0x04I've also done a scan from my Android phone (using the Nordic nRF Connect app) and can see the advertisements also (just hard to share that information on here).
Does that help?
Quoted 353 lines · Barry Byford
Quoted 347 lines
Hello Olivier,
Quoted 151 lines · Olivier MARTIN
Hi all,
I am having issue to advertise/export GATT services exposed through DBus
API. I tried./test/example-gatt-server. And I also tried to merge./test/example-advertisementinto./test/example-gatt-server. But in
both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional debug
statement all prefixed with '#'):bluetoothd[16877]: src/gatt-database.c:manager_register_app() #
manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() #create_appbluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering
application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered
advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc0, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc1, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16877]: src/gatt-database.c:client_ready_cb() #client_ready_cb
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service2
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service1
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service0
bluetoothd[16877]: src/gatt-database.c:database_add_app() #database_add_app
bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application
registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData
for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0Quoted 3 lines
I start
./test/example-gatt-serveras a normal user. But Bluez does not
seem to have any permission issue with it.Building from source I've seen something similar if I've used sudo for the
make.To compile and install I use sudo for the install only:
make -j 4 && sudo make install
Quoted 119 lines
I am using 'BLE scanner' on Android to discover the GATT services. But I
think the problem is coming from Bluez. When I connect the Android device
to
Bluez, I can see this log:bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected
eir_len14
bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR ATT
connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref()0x98cd908:
g_attrib_ref=1
bluetoothd[16877]: src/device.c:load_gatt_db() #load_gatt_db:
Restoring
98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() #load_gatt_db_implbluetoothd[16877]: src/device.c:load_service() #load_service: loading
service:0x0001, end:0x0005, uuid:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_service() #load_service: loading
service:0x0014, end:0xffff, uuid:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0002, value handle:0x0003, properties0x0020uuid:
00002a05-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0015, value handle:0x0016, properties0x0002uuid:
00002a00-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0017, value handle:0x0018, properties0x0002uuid:
00002a01-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before
being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept (98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state()0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected ->
connected (0)
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device connected.
bluetoothd[16877]: src/device.c:gatt_server_init() #gatt_server_initbluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status: success,
error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() #register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_gatt_service() #add_gatt_service:
UUID:00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client
ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects
for
GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001 bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported GATT
characteristic:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0 bluetoothd[16877]: src/device.c:store_gatt_db() #store_gatt_dbbluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device Name:
Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance:0x0000I also reduced DBus 'TestAdvertisement' interface to only expose one GATT
Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):def __init__(self, bus, index): Advertisement.__init__(self, bus, index, 'peripheral') #self.add_service_uuid('180D') # HeartRate self.add_service_uuid('180F') # Battery #self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03, 0x04]) #self.add_service_data('9999', [0x00, 0x01, 0x02, 0x03,
0x04])
self.include_tx_power = TrueMy concern is mainly these lines:
Quoted 8 lines
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[16877]: src/device.c:gatt_debug() start:
0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fbI've seen this kind of error message when I've had a failure of a previous script and the Bluetooth daemon is in some unknown state. At this point it is worth restarting the bluetooth service with:
sudo service bluetooth restartYou will see in the advertising DBus API documentation that it is still in experimental mode in 5.44.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n78
This means that you need to make sure bluetoothd is started in experimental mode. Have you done this?
You can check with "sudo service bluetooth status"Experimental can be switched on by default in the bluetooth.service file
Edit
/lib/systemd/system/bluetooth.servicefile to add --experimental
flag
e.g:sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/'
/lib/systemd/system/bluetooth.serviceQuoted 18 lines
I have not found the code that export GATT Services from GATT Database to
the BLE central.From my search on Internet, it looks I am not the only one who is having
this issue
I am happy to share/test anything that could help to make some progress.Thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hello Olivier,
Quoted 2 lines · Olivier MARTIN
Thanks Barry, setting 'ControllerMode = le' in
/etc/bluetooth/main.conffixed my issue. I can now see the GATT services.
Good news!
Quoted 7 lines
But I guess my adapter now only works as BLE adapter and will ignore the non-LE devices.
In the comment of/etc/bluetooth/main.confit is written the adapter should be by default set as 'dual'.Is it a bug in Bluez? Why GATT services are not exposed while using the default value for 'ControllerMode'?
This issue has come up before and was discuss here:
http://marc.info/?l=linux-bluetooth&m=146071596012263&w=2
Quoted 633 lines · Barry Byford
Quoted 631 lines
Hello Olivier,
Quoted 5 lines · Olivier MARTIN
You are right Barry,
example-advertisementseems to work well (I installed
and tried Nordic nRF Connect and I can see the expected advertisemet data).Excellent!
Quoted 4 lines
But I cannot still manage to get
example-gatt-server:-(
I am sure I got it working last year with an older version of Bluez. But I
cannot make it work with Bluez v5.44.OK, I've taken a look at "example-gatt-server" and have it working...
Quoted 8 lines
My testing procedure:
1. [Laptop] First terminal: Start
sudo ./src/bluetoothd -E -n -d
2. [Laptop] Second terminal: Start unmodified Bluez ./test/example-gatt-server
3. [Laptop] Third terminal: Ensure the adapter is "Powered: yes" and "Discoverable: yes"OK, I've done this slightly different (details below). However, the first thing I did was edit "
/etc/bluetooth/main.conf"
I added the following line to the end of the file:ControllerMode = le
Then I did the following:
1. [SBC1:T1] sudo ./src/bluetoothd -E -n -d
2. [SBC1:T2] ./example-gatt-server
3. [SBC1:T3] ./example-advertisementQuoted 8 lines
4. [Android] Connect using Nordic nRF Connect (I also tried with "BLE Scanner") and check I see the exposed GATT services by
example-gatt-server
Unfortunately, I can only see:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I've used bluetoothctl on SBC2 to connect and read the battery values that the GATT server is counting down.
$ bluetoothctl [NEW] Controller 00:00:00:00:5A:AD linaro-alip [default] [bluetooth]# scan on Discovery started [CHG] Controller 00:00:00:00:5A:AD Discovering: yes [NEW] Device B8:27:EB:22:57:E0 BluezeroLight [bluetooth]# scan off Discovery stopped [CHG] Controller 00:00:00:00:5A:AD Discovering: no [bluetooth]# connect B8:27:EB:22:57:E0 Attempting to connect to B8:27:EB:22:57:E0 [CHG] Device B8:27:EB:22:57:E0 Connected: yes Connection successful [...snip...] [NEW] Primary Service /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a 0000180f-0000-1000-8000-00805f9b34fb Battery Service [NEW] Characteristic /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b 00002a19-0000-1000-8000-00805f9b34fb Battery Level [...snip...] [CHG] Device B8:27:EB:22:57:E0 ServicesResolved: yes [BluezeroLight]# select-attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [BluezeroLight:/service000a/char000b]# read Attempting to read /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 46 F [BluezeroLight:/service000a/char000b]# notify on [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: yes Notify started [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x44 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x42 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x40 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x3e [BluezeroLight:/service000a/char000b]# notify off [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: no Notify stoppedThat seems to be working then. When I didn't have "ControllerMode = le" set then I did see it be unpredictable if it successfully connected or not.
This also worked connecting with the nRF app.Does that work for you?
Quoted 509 lines
If I had to suspect Bluez code, I will guess there is something missing around here:
bluetoothd[20429]: src/device.c:gatt_server_init() #
gatt_server_initbluetoothd[20429]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[20429]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[20429]: src/device.c:gatt_client_ready_cb() status: success,
error: 0As Bluez daemon does not get the GATT services from Buez GATT Database. But
it might be me who miss a step...Quoted 487 lines · Barry Byford
example-advertisementHello Oliver,
Quoted 11 lines · Olivier MARTIN
Thanks for replying my message Barry,
Sorry, I forgot to mention but I start Bluez daemon with
sudo ./src/bluetoothd -E -n -d(after stopping the bluetooth service). So I already run it with sudo and experimental option.I am not sure to understand what you mean by "this kind of error message".
Because I do not see any error message in the log I provided.OK, that was bad on my part. I read it as complaining that there were too many advertisements. Looking again that wasn't what it was say. Apologies.
Quoted 2 lines
Any other idea?
I am by Linux Single Board Computers (SBC) today so I'm able to run what you are running and can show you what I'm seeing. I'll focus on example-advertisement first as example-gatt-server doesn't change the advertisements.
I've started the BlueZ daemon with "./src/bluetoothd -E -n -d"
In another shell when I start "./example-advertisement" I see the following in the output:
bluetoothd[2325]: src/adapter.c:property_set_mode() sending Set Powered command for index 0
bluetoothd[2325]: src/adapter.c:property_set_mode_complete() Success (0x00)
bluetoothd[2325]: src/adapter.c:new_settings_callback() Settings:0x00000ad1
bluetoothd[2325]: src/adapter.c:settings_changed() Changed settings:0x00000001
bluetoothd[2325]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
bluetoothd[2325]: src/adapter.c:trigger_passive_scanning() bluetoothd[2325]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[2325]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[2325]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[2325]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[2325]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[2325]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0On a second SBC, at the command line I run "bluetoothctl" and do "scan on". Once my first SBC is found I do "scan off". I then do "info B8:27:EB:22:57:E0" (this is the address of the first SBC) which gives the following output:
[bluetooth]# info B8:27:EB:22:57:E0
Device B8:27:EB:22:57:E0
Alias: B8-27-EB-22-57-E0
Paired: no
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Heart Rate (0000180d-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
ManufacturerData Key:0xffff
ManufacturerData Value:0x00
ManufacturerData Value:0x01
ManufacturerData Value:0x02
ManufacturerData Value:0x03
ManufacturerData Value:0x04
ServiceData Key: 00009999-0000-1000-8000-00805f9b34fb ServiceData Value:0x00
ServiceData Value:0x01
ServiceData Value:0x02
ServiceData Value:0x03
ServiceData Value:0x04I've also done a scan from my Android phone (using the Nordic nRF Connect app) and can see the advertisements also (just hard to share that information on here).
Does that help?
Quoted 381 lines · Barry Byford
Quoted 374 lines
Hello Olivier,
Quoted 164 lines · Olivier MARTIN
Hi all,
I am having issue to advertise/export GATT services exposed through DBus
API. I tried./test/example-gatt-server. And I also tried to merge./test/example-advertisementinto./test/example-gatt-server. But in
both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional
debug
statement all prefixed with '#'):bluetoothd[16877]: src/gatt-database.c:manager_register_app() #
manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() #create_appbluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering
application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered
advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char2, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc0, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char1, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc1, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:client_ready_cb() #client_ready_cb
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service2
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service1
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service0
bluetoothd[16877]: src/gatt-database.c:database_add_app() #database_add_app
bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application
registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData
for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0Quoted 3 lines
I start
./test/example-gatt-serveras a normal user. But Bluez does not
seem to have any permission issue with it.Building from source I've seen something similar if I've used sudo for the
make.To compile and install I use sudo for the install only:
make -j 4 && sudo make install
Quoted 127 lines
I am using 'BLE scanner' on Android to discover the GATT services. But
I
think the problem is coming from Bluez. When I connect the Android device
to
Bluez, I can see this log:bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected
eir_len14
bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR
ATT
connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref()0x98cd908:
g_attrib_ref=1
bluetoothd[16877]: src/device.c:load_gatt_db() #load_gatt_db:
Restoring
98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() #load_gatt_db_impl
bluetoothd[16877]: src/device.c:load_service() #load_service:
loading
service:0x0001, end:0x0005, uuid:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_service() #load_service:
loading
service:0x0014, end:0xffff, uuid:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0002, value handle:0x0003, properties0x0020uuid:
00002a05-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0015, value handle:0x0016, properties0x0002uuid:
00002a00-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0017, value handle:0x0018, properties0x0002uuid:
00002a01-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before
being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept (98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state()0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected -> connected (0)
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device
connected.
bluetoothd[16877]: src/device.c:gatt_server_init() #gatt_server_initbluetoothd[16877]: src/device.c:gatt_debug() Primary services found:
2
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status:
success,
error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() #register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_gatt_service() #add_gatt_service:
UUID:00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client
ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects
for
GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001 bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported GATT
characteristic:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0 bluetoothd[16877]: src/device.c:store_gatt_db() #store_gatt_dbbluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device
Name:
Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance:0x0000I also reduced DBus 'TestAdvertisement' interface to only expose one GATT
Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):def __init__(self, bus, index): Advertisement.__init__(self, bus, index, 'peripheral') #self.add_service_uuid('180D') # HeartRate self.add_service_uuid('180F') # Battery #self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03, 0x04]) #self.add_service_data('9999', [0x00, 0x01, 0x02, 0x03,
0x04])
self.include_tx_power = TrueMy concern is mainly these lines:
Quoted 9 lines
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found:
2
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fbI've seen this kind of error message when I've had a failure of a previous script and the Bluetooth daemon is in some unknown state. At this point it is worth restarting the bluetooth service with:
sudo service bluetooth restartYou will see in the advertising DBus API documentation that it is still in experimental mode in 5.44.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n78
This means that you need to make sure bluetoothd is started in experimental mode. Have you done this?
You can check with "sudo service bluetooth status"Experimental can be switched on by default in the bluetooth.service file
Edit
/lib/systemd/system/bluetooth.servicefile to add --experimental flag
e.g:sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/'
/lib/systemd/system/bluetooth.serviceQuoted 19 lines
I have not found the code that export GATT Services from GATT Database
to
the BLE central.From my search on Internet, it looks I am not the only one who is having
this issue
I am happy to share/test anything that could help to make some progress.Thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Thanks a lot Barry for the following up. I will keep the workaround for now.
I will likely come back on this issue in the next months to see how I can help implementing a fix for Bluez.
Quoted 657 lines · Barry Byford
Hello Olivier,
Quoted 2 lines · Olivier MARTIN
Thanks Barry, setting 'ControllerMode = le' in
/etc/bluetooth/main.conffixed my issue. I can now see the GATT services.Good news!
Quoted 7 lines
But I guess my adapter now only works as BLE adapter and will ignore the non-LE devices.
In the comment of/etc/bluetooth/main.confit is written the adapter should be by default set as 'dual'.Is it a bug in Bluez? Why GATT services are not exposed while using the default value for 'ControllerMode'?
This issue has come up before and was discuss here:
http://marc.info/?l=linux-bluetooth&m=146071596012263&w=2Quoted 635 lines · Barry Byford
Quoted 633 lines
Hello Olivier,
Quoted 5 lines · Olivier MARTIN
You are right Barry,
example-advertisementseems to work well (I installed
and tried Nordic nRF Connect and I can see the expected advertisemet data).Excellent!
Quoted 4 lines
But I cannot still manage to get
example-gatt-server:-(
I am sure I got it working last year with an older version of Bluez. But I
cannot make it work with Bluez v5.44.OK, I've taken a look at "example-gatt-server" and have it working...
Quoted 8 lines
My testing procedure:
1. [Laptop] First terminal: Start
sudo ./src/bluetoothd -E -n -d
2. [Laptop] Second terminal: Start unmodified Bluez ./test/example-gatt-server
3. [Laptop] Third terminal: Ensure the adapter is "Powered: yes" and "Discoverable: yes"OK, I've done this slightly different (details below). However, the first thing I did was edit "
/etc/bluetooth/main.conf"
I added the following line to the end of the file:ControllerMode = le
Then I did the following:
1. [SBC1:T1] sudo ./src/bluetoothd -E -n -d
2. [SBC1:T2] ./example-gatt-server
3. [SBC1:T3] ./example-advertisementQuoted 8 lines
4. [Android] Connect using Nordic nRF Connect (I also tried with "BLE Scanner") and check I see the exposed GATT services by
example-gatt-server
Unfortunately, I can only see:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I've used bluetoothctl on SBC2 to connect and read the battery values that the GATT server is counting down.
$ bluetoothctl [NEW] Controller 00:00:00:00:5A:AD linaro-alip [default] [bluetooth]# scan on Discovery started [CHG] Controller 00:00:00:00:5A:AD Discovering: yes [NEW] Device B8:27:EB:22:57:E0 BluezeroLight [bluetooth]# scan off Discovery stopped [CHG] Controller 00:00:00:00:5A:AD Discovering: no [bluetooth]# connect B8:27:EB:22:57:E0 Attempting to connect to B8:27:EB:22:57:E0 [CHG] Device B8:27:EB:22:57:E0 Connected: yes Connection successful [...snip...] [NEW] Primary Service /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a 0000180f-0000-1000-8000-00805f9b34fb Battery Service [NEW] Characteristic /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b 00002a19-0000-1000-8000-00805f9b34fb Battery Level [...snip...] [CHG] Device B8:27:EB:22:57:E0 ServicesResolved: yes [BluezeroLight]# select-attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [BluezeroLight:/service000a/char000b]# read Attempting to read /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 46 F [BluezeroLight:/service000a/char000b]# notify on [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: yes Notify started [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x44 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x42 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x40 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x3e [BluezeroLight:/service000a/char000b]# notify off [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: no Notify stoppedThat seems to be working then. When I didn't have "ControllerMode = le" set then I did see it be unpredictable if it successfully connected or not.
This also worked connecting with the nRF app.Does that work for you?
Quoted 511 lines
If I had to suspect Bluez code, I will guess there is something missing around here:
bluetoothd[20429]: src/device.c:gatt_server_init() #
gatt_server_initbluetoothd[20429]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[20429]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[20429]: src/device.c:gatt_client_ready_cb() status: success,
error: 0As Bluez daemon does not get the GATT services from Buez GATT Database. But
it might be me who miss a step...Quoted 489 lines · Barry Byford
example-advertisementHello Oliver,
Quoted 11 lines · Olivier MARTIN
Thanks for replying my message Barry,
Sorry, I forgot to mention but I start Bluez daemon with
sudo ./src/bluetoothd -E -n -d(after stopping the bluetooth service). So I already run it with sudo and experimental option.I am not sure to understand what you mean by "this kind of error message".
Because I do not see any error message in the log I provided.OK, that was bad on my part. I read it as complaining that there were too many advertisements. Looking again that wasn't what it was say. Apologies.
Quoted 2 lines
Any other idea?
I am by Linux Single Board Computers (SBC) today so I'm able to run what you are running and can show you what I'm seeing. I'll focus on example-advertisement first as example-gatt-server doesn't change the advertisements.
I've started the BlueZ daemon with "./src/bluetoothd -E -n -d"
In another shell when I start "./example-advertisement" I see the following in the output:
bluetoothd[2325]: src/adapter.c:property_set_mode() sending Set Powered command for index 0
bluetoothd[2325]: src/adapter.c:property_set_mode_complete() Success (0x00)
bluetoothd[2325]: src/adapter.c:new_settings_callback() Settings:0x00000ad1
bluetoothd[2325]: src/adapter.c:settings_changed() Changed settings:0x00000001
bluetoothd[2325]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
bluetoothd[2325]: src/adapter.c:trigger_passive_scanning() bluetoothd[2325]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[2325]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[2325]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[2325]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[2325]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[2325]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0On a second SBC, at the command line I run "bluetoothctl" and do "scan on". Once my first SBC is found I do "scan off". I then do "info B8:27:EB:22:57:E0" (this is the address of the first SBC) which gives the following output:
[bluetooth]# info B8:27:EB:22:57:E0
Device B8:27:EB:22:57:E0
Alias: B8-27-EB-22-57-E0
Paired: no
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Heart Rate (0000180d-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
ManufacturerData Key:0xffff
ManufacturerData Value:0x00
ManufacturerData Value:0x01
ManufacturerData Value:0x02
ManufacturerData Value:0x03
ManufacturerData Value:0x04
ServiceData Key: 00009999-0000-1000-8000-00805f9b34fb ServiceData Value:0x00
ServiceData Value:0x01
ServiceData Value:0x02
ServiceData Value:0x03
ServiceData Value:0x04I've also done a scan from my Android phone (using the Nordic nRF Connect app) and can see the advertisements also (just hard to share that information on here).
Does that help?
Quoted 383 lines · Barry Byford
Quoted 376 lines
Hello Olivier,
Quoted 164 lines · Olivier MARTIN
Hi all,
I am having issue to advertise/export GATT services exposed through DBus
API. I tried./test/example-gatt-server. And I also tried to merge./test/example-advertisementinto./test/example-gatt-server. But in
both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional
debug
statement all prefixed with '#'):bluetoothd[16877]: src/gatt-database.c:manager_register_app() #
manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() #create_appbluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering
application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered
advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char2, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc0, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char1, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc1, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:client_ready_cb() #client_ready_cb
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service2
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service1
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service0
bluetoothd[16877]: src/gatt-database.c:database_add_app() #database_add_app
bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application
registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData
for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0Quoted 3 lines
I start
./test/example-gatt-serveras a normal user. But Bluez does not
seem to have any permission issue with it.Building from source I've seen something similar if I've used sudo for the
make.To compile and install I use sudo for the install only:
make -j 4 && sudo make install
Quoted 128 lines
I am using 'BLE scanner' on Android to discover the GATT services. But
I
think the problem is coming from Bluez. When I connect the Android device
to
Bluez, I can see this log:bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected
eir_len14
bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR
ATT
connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref()0x98cd908:
g_attrib_ref=1
bluetoothd[16877]: src/device.c:load_gatt_db() #load_gatt_db:
Restoring
98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() #load_gatt_db_impl
bluetoothd[16877]: src/device.c:load_service() #load_service:
loading
service:0x0001, end:0x0005, uuid:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_service() #load_service:
loading
service:0x0014, end:0xffff, uuid:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0002, value handle:0x0003, properties0x0020uuid:
00002a05-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0015, value handle:0x0016, properties0x0002uuid:
00002a00-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0017, value handle:0x0018, properties0x0002uuid:
00002a01-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before
being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept (98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state()0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected -> connected (0)
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device
connected.
bluetoothd[16877]: src/device.c:gatt_server_init() #gatt_server_initbluetoothd[16877]: src/device.c:gatt_debug() Primary services found:
2
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status:
success,
error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() #register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_gatt_service() #add_gatt_service:
UUID:00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client
ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects
for
GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001 bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported GATT
characteristic:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0 bluetoothd[16877]: src/device.c:store_gatt_db() #store_gatt_dbbluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device
Name:
Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance:0x0000I also reduced DBus 'TestAdvertisement' interface to only expose one GATT
Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):def __init__(self, bus, index): Advertisement.__init__(self, bus, index, 'peripheral') #self.add_service_uuid('180D') # HeartRate self.add_service_uuid('180F') # Battery #self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03, 0x04]) #self.add_service_data('9999', [0x00, 0x01, 0x02, 0x03,
0x04])
self.include_tx_power = TrueMy concern is mainly these lines:
Quoted 9 lines
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found:
2
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fbI've seen this kind of error message when I've had a failure of a previous script and the Bluetooth daemon is in some unknown state. At this point it is worth restarting the bluetooth service with:
sudo service bluetooth restartYou will see in the advertising DBus API documentation that it is still in experimental mode in 5.44.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n78
This means that you need to make sure bluetoothd is started in experimental mode. Have you done this?
You can check with "sudo service bluetooth status"Experimental can be switched on by default in the bluetooth.service file
Edit
/lib/systemd/system/bluetooth.servicefile to add --experimental
flag
e.g:sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/'
/lib/systemd/system/bluetooth.serviceQuoted 19 lines
I have not found the code that export GATT Services from GATT Database
to
the BLE central.From my search on Internet, it looks I am not the only one who is having
this issue
I am happy to share/test anything that could help to make some progress.Thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
I am back on the thread.
What I noticed last week when I tried on Android phone with both "BLE Scanner" and "Nordic Connect", discovering GATT services is really really slow (it takes 2 min to discover all example-gatt-server GATT services) on Nexus 4 with Android 5.1.1 and Ubuntu 16.04 with Bluez v5.44 for the GATT server. I am using the Asus USB-BT400 (Broadcom chipset).
I did more investigation this evening but I have not done any progress.
I tried with example-gatt-server started by the user and root and no change in the poor performance.
I do not know what is taking so long but for instance it takes many seconds to execute this part:
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start: 0x005e end: 0x0061 bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start: 0x0060 end: 0x0061 bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start: 0x0061 end: 0x0061 bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start: 0x0062 end: 0x0071 bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start: 0x0062 end: 0x0071 bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start: 0x006e end: 0x0071 bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start: 0x0065 end: 0x0067 bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start: 0x0066 end: 0x0067 bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start: 0x0067 end: 0x0067 bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start: 0x006a end: 0x006c bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start: 0x006b end: 0x006c bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start: 0x006c end: 0x006c bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start: 0x006f end: 0x0071 bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start: 0x0070 end: 0x0071 bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start: 0x0071 end: 0x0071 bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start: 0x0072 end: 0x0079 bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start: 0x0072 end: 0x0079 bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start: 0x0079 end: 0x0079 bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start: 0x0077 end: 0x0077
Quoted 657 lines · Barry Byford
Hello Olivier,
Quoted 2 lines · Olivier MARTIN
Thanks Barry, setting 'ControllerMode = le' in
/etc/bluetooth/main.conffixed my issue. I can now see the GATT services.Good news!
Quoted 7 lines
But I guess my adapter now only works as BLE adapter and will ignore the non-LE devices.
In the comment of/etc/bluetooth/main.confit is written the adapter should be by default set as 'dual'.Is it a bug in Bluez? Why GATT services are not exposed while using the default value for 'ControllerMode'?
This issue has come up before and was discuss here:
http://marc.info/?l=linux-bluetooth&m=146071596012263&w=2Quoted 635 lines · Barry Byford
Quoted 633 lines
Hello Olivier,
Quoted 5 lines · Olivier MARTIN
You are right Barry,
example-advertisementseems to work well (I installed
and tried Nordic nRF Connect and I can see the expected advertisemet data).Excellent!
Quoted 4 lines
But I cannot still manage to get
example-gatt-server:-(
I am sure I got it working last year with an older version of Bluez. But I
cannot make it work with Bluez v5.44.OK, I've taken a look at "example-gatt-server" and have it working...
Quoted 8 lines
My testing procedure:
1. [Laptop] First terminal: Start
sudo ./src/bluetoothd -E -n -d
2. [Laptop] Second terminal: Start unmodified Bluez ./test/example-gatt-server
3. [Laptop] Third terminal: Ensure the adapter is "Powered: yes" and "Discoverable: yes"OK, I've done this slightly different (details below). However, the first thing I did was edit "
/etc/bluetooth/main.conf"
I added the following line to the end of the file:ControllerMode = le
Then I did the following:
1. [SBC1:T1] sudo ./src/bluetoothd -E -n -d
2. [SBC1:T2] ./example-gatt-server
3. [SBC1:T3] ./example-advertisementQuoted 8 lines
4. [Android] Connect using Nordic nRF Connect (I also tried with "BLE Scanner") and check I see the exposed GATT services by
example-gatt-server
Unfortunately, I can only see:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I've used bluetoothctl on SBC2 to connect and read the battery values that the GATT server is counting down.
$ bluetoothctl [NEW] Controller 00:00:00:00:5A:AD linaro-alip [default] [bluetooth]# scan on Discovery started [CHG] Controller 00:00:00:00:5A:AD Discovering: yes [NEW] Device B8:27:EB:22:57:E0 BluezeroLight [bluetooth]# scan off Discovery stopped [CHG] Controller 00:00:00:00:5A:AD Discovering: no [bluetooth]# connect B8:27:EB:22:57:E0 Attempting to connect to B8:27:EB:22:57:E0 [CHG] Device B8:27:EB:22:57:E0 Connected: yes Connection successful [...snip...] [NEW] Primary Service /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a 0000180f-0000-1000-8000-00805f9b34fb Battery Service [NEW] Characteristic /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b 00002a19-0000-1000-8000-00805f9b34fb Battery Level [...snip...] [CHG] Device B8:27:EB:22:57:E0 ServicesResolved: yes [BluezeroLight]# select-attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [BluezeroLight:/service000a/char000b]# read Attempting to read /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 46 F [BluezeroLight:/service000a/char000b]# notify on [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: yes Notify started [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x44 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x42 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x40 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x3e [BluezeroLight:/service000a/char000b]# notify off [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: no Notify stoppedThat seems to be working then. When I didn't have "ControllerMode = le" set then I did see it be unpredictable if it successfully connected or not.
This also worked connecting with the nRF app.Does that work for you?
Quoted 511 lines
If I had to suspect Bluez code, I will guess there is something missing around here:
bluetoothd[20429]: src/device.c:gatt_server_init() #
gatt_server_initbluetoothd[20429]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[20429]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[20429]: src/device.c:gatt_client_ready_cb() status: success,
error: 0As Bluez daemon does not get the GATT services from Buez GATT Database. But
it might be me who miss a step...Quoted 489 lines · Barry Byford
example-advertisementHello Oliver,
Quoted 11 lines · Olivier MARTIN
Thanks for replying my message Barry,
Sorry, I forgot to mention but I start Bluez daemon with
sudo ./src/bluetoothd -E -n -d(after stopping the bluetooth service). So I already run it with sudo and experimental option.I am not sure to understand what you mean by "this kind of error message".
Because I do not see any error message in the log I provided.OK, that was bad on my part. I read it as complaining that there were too many advertisements. Looking again that wasn't what it was say. Apologies.
Quoted 2 lines
Any other idea?
I am by Linux Single Board Computers (SBC) today so I'm able to run what you are running and can show you what I'm seeing. I'll focus on example-advertisement first as example-gatt-server doesn't change the advertisements.
I've started the BlueZ daemon with "./src/bluetoothd -E -n -d"
In another shell when I start "./example-advertisement" I see the following in the output:
bluetoothd[2325]: src/adapter.c:property_set_mode() sending Set Powered command for index 0
bluetoothd[2325]: src/adapter.c:property_set_mode_complete() Success (0x00)
bluetoothd[2325]: src/adapter.c:new_settings_callback() Settings:0x00000ad1
bluetoothd[2325]: src/adapter.c:settings_changed() Changed settings:0x00000001
bluetoothd[2325]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
bluetoothd[2325]: src/adapter.c:trigger_passive_scanning() bluetoothd[2325]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[2325]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[2325]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[2325]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[2325]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[2325]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0On a second SBC, at the command line I run "bluetoothctl" and do "scan on". Once my first SBC is found I do "scan off". I then do "info B8:27:EB:22:57:E0" (this is the address of the first SBC) which gives the following output:
[bluetooth]# info B8:27:EB:22:57:E0
Device B8:27:EB:22:57:E0
Alias: B8-27-EB-22-57-E0
Paired: no
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Heart Rate (0000180d-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
ManufacturerData Key:0xffff
ManufacturerData Value:0x00
ManufacturerData Value:0x01
ManufacturerData Value:0x02
ManufacturerData Value:0x03
ManufacturerData Value:0x04
ServiceData Key: 00009999-0000-1000-8000-00805f9b34fb ServiceData Value:0x00
ServiceData Value:0x01
ServiceData Value:0x02
ServiceData Value:0x03
ServiceData Value:0x04I've also done a scan from my Android phone (using the Nordic nRF Connect app) and can see the advertisements also (just hard to share that information on here).
Does that help?
Quoted 383 lines · Barry Byford
Quoted 376 lines
Hello Olivier,
Quoted 164 lines · Olivier MARTIN
Hi all,
I am having issue to advertise/export GATT services exposed through DBus
API. I tried./test/example-gatt-server. And I also tried to merge./test/example-advertisementinto./test/example-gatt-server. But in
both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional
debug
statement all prefixed with '#'):bluetoothd[16877]: src/gatt-database.c:manager_register_app() #
manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() #create_appbluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering
application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered
advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char2, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc0, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char1, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc1, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:client_ready_cb() #client_ready_cb
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service2
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service1
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service0
bluetoothd[16877]: src/gatt-database.c:database_add_app() #database_add_app
bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application
registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData
for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0Quoted 3 lines
I start
./test/example-gatt-serveras a normal user. But Bluez does not
seem to have any permission issue with it.Building from source I've seen something similar if I've used sudo for the
make.To compile and install I use sudo for the install only:
make -j 4 && sudo make install
Quoted 128 lines
I am using 'BLE scanner' on Android to discover the GATT services. But
I
think the problem is coming from Bluez. When I connect the Android device
to
Bluez, I can see this log:bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected
eir_len14
bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR
ATT
connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref()0x98cd908:
g_attrib_ref=1
bluetoothd[16877]: src/device.c:load_gatt_db() #load_gatt_db:
Restoring
98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() #load_gatt_db_impl
bluetoothd[16877]: src/device.c:load_service() #load_service:
loading
service:0x0001, end:0x0005, uuid:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_service() #load_service:
loading
service:0x0014, end:0xffff, uuid:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0002, value handle:0x0003, properties0x0020uuid:
00002a05-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0015, value handle:0x0016, properties0x0002uuid:
00002a00-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0017, value handle:0x0018, properties0x0002uuid:
00002a01-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before
being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept (98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state()0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected -> connected (0)
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device
connected.
bluetoothd[16877]: src/device.c:gatt_server_init() #gatt_server_initbluetoothd[16877]: src/device.c:gatt_debug() Primary services found:
2
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status:
success,
error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() #register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_gatt_service() #add_gatt_service:
UUID:00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client
ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects
for
GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001 bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported GATT
characteristic:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0 bluetoothd[16877]: src/device.c:store_gatt_db() #store_gatt_dbbluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device
Name:
Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance:0x0000I also reduced DBus 'TestAdvertisement' interface to only expose one GATT
Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):def __init__(self, bus, index): Advertisement.__init__(self, bus, index, 'peripheral') #self.add_service_uuid('180D') # HeartRate self.add_service_uuid('180F') # Battery #self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03, 0x04]) #self.add_service_data('9999', [0x00, 0x01, 0x02, 0x03,
0x04])
self.include_tx_power = TrueMy concern is mainly these lines:
Quoted 9 lines
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found:
2
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fbI've seen this kind of error message when I've had a failure of a previous script and the Bluetooth daemon is in some unknown state. At this point it is worth restarting the bluetooth service with:
sudo service bluetooth restartYou will see in the advertising DBus API documentation that it is still in experimental mode in 5.44.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n78
This means that you need to make sure bluetoothd is started in experimental mode. Have you done this?
You can check with "sudo service bluetooth status"Experimental can be switched on by default in the bluetooth.service file
Edit
/lib/systemd/system/bluetooth.servicefile to add --experimental
flag
e.g:sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/'
/lib/systemd/system/bluetooth.serviceQuoted 19 lines
I have not found the code that export GATT Services from GATT Database
to
the BLE central.From my search on Internet, it looks I am not the only one who is having
this issue
I am happy to share/test anything that could help to make some progress.Thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Luiz Augusto von Dentz
maintainerHi Oliver,
Quoted 44 lines · Olivier MARTIN
I am back on the thread.
What I noticed last week when I tried on Android phone with both "BLE Scanner" and "Nordic Connect", discovering GATT services is really really slow (it takes 2 min to discover allexample-gatt-serverGATT services) on Nexus 4 with Android 5.1.1 and Ubuntu 16.04 with Bluez v5.44 for the GATT server. I am using the Asus USB-BT400 (Broadcom chipset).I did more investigation this evening but I have not done any progress. I tried with
example-gatt-serverstarted by the user and root and no change in the poor performance.I do not know what is taking so long but for instance it takes many seconds to execute this part:
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:
0x005e
end:0x0061
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0060
end:0x0061
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0061end:0x0061
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0062
end:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0062
end:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x006e
end:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0065end:0x0067
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0066end:0x0067
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0067end:0x0067
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x006aend:0x006c
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x006bend:0x006c
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x006cend:0x006c
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x006fend:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0070end:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0071end:0x0071
Quoted 8 lines
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:
0x0072
end:0x0079
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0072
end:0x0079
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0079
end:0x0079
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0077end:0x0077
You should be able to see their timings in HCI with btmon, or just use journalctl if are thinking there is a delay in processing the packets but I think that is not the case. These many Find Info does indeed looks odd, and there are even repeated range.
Quoted 711 lines · Barry Byford
Quoted 17 lines
Hello Olivier,
Quoted 3 lines · Olivier MARTIN
Thanks Barry, setting 'ControllerMode = le' in
/etc/bluetooth/main.conffixed my issue. I can now see the GATT services.Good news!
Quoted 6 lines
But I guess my adapter now only works as BLE adapter and will ignore the non-LE devices.
In the comment of/etc/bluetooth/main.confit is written the adapter should
be by default set as 'dual'.Quoted 684 lines
Quoted 2 lines
Is it a bug in Bluez? Why GATT services are not exposed while using the default value for 'ControllerMode'?
This issue has come up before and was discuss here:
http://marc.info/?l=linux-bluetooth&m=146071596012263&w=2Quoted 674 lines · Barry Byford
Quoted 672 lines
Hello Olivier,
Quoted 6 lines · Olivier MARTIN
You are right Barry,
example-advertisementseems to work well (I installed
and tried Nordic nRF Connect and I can see the expected advertisemet data).Excellent!
Quoted 5 lines
But I cannot still manage to get
example-gatt-server:-( I am sure I got it working last year with an older version of Bluez. But
I
cannot make it work with Bluez v5.44.OK, I've taken a look at "example-gatt-server" and have it working...
Quoted 8 lines
My testing procedure:
1. [Laptop] First terminal: Start
sudo ./src/bluetoothd -E -n -d
2. [Laptop] Second terminal: Start unmodified Bluez ./test/example-gatt-server
3. [Laptop] Third terminal: Ensure the adapter is "Powered: yes" and "Discoverable: yes"OK, I've done this slightly different (details below). However, the first thing I did was edit "
/etc/bluetooth/main.conf"
I added the following line to the end of the file:ControllerMode = le
Then I did the following:
1. [SBC1:T1] sudo ./src/bluetoothd -E -n -d
2. [SBC1:T2] ./example-gatt-server
3. [SBC1:T3] ./example-advertisementQuoted 8 lines
4. [Android] Connect using Nordic nRF Connect (I also tried with "BLE Scanner") and check I see the exposed GATT services by
example-gatt-server
Unfortunately, I can only see:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I've used bluetoothctl on SBC2 to connect and read the battery values that the GATT server is counting down.
$ bluetoothctl [NEW] Controller 00:00:00:00:5A:AD linaro-alip [default] [bluetooth]# scan on Discovery started [CHG] Controller 00:00:00:00:5A:AD Discovering: yes [NEW] Device B8:27:EB:22:57:E0 BluezeroLight [bluetooth]# scan off Discovery stopped [CHG] Controller 00:00:00:00:5A:AD Discovering: no [bluetooth]# connect B8:27:EB:22:57:E0 Attempting to connect to B8:27:EB:22:57:E0 [CHG] Device B8:27:EB:22:57:E0 Connected: yes Connection successful [...snip...] [NEW] Primary Service /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a 0000180f-0000-1000-8000-00805f9b34fb Battery Service [NEW] Characteristic /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b 00002a19-0000-1000-8000-00805f9b34fb Battery Level [...snip...] [CHG] Device B8:27:EB:22:57:E0 ServicesResolved: yes [BluezeroLight]# select-attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [BluezeroLight:/service000a/char000b]# read Attempting to read /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 46 F [BluezeroLight:/service000a/char000b]# notify on [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: yes Notify started [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x44 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x42 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x40 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x3e [BluezeroLight:/service000a/char000b]# notify off [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: no Notify stoppedThat seems to be working then. When I didn't have "ControllerMode = le" set then I did see it be unpredictable if it successfully connected or not.
This also worked connecting with the nRF app.Does that work for you?
Quoted 544 lines
If I had to suspect Bluez code, I will guess there is something missing around here:
bluetoothd[20429]: src/device.c:gatt_server_init() #
gatt_server_initbluetoothd[20429]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[20429]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[20429]: src/device.c:gatt_client_ready_cb() status: success,
error: 0As Bluez daemon does not get the GATT services from Buez GATT Database. But
it might be me who miss a step...Quoted 520 lines · Barry Byford
example-advertisementHello Oliver,
Quoted 5 lines · Olivier MARTIN
Thanks for replying my message Barry,
Quoted 8 lines
Sorry, I forgot to mention but I start Bluez daemon with
sudo ./src/bluetoothd -E -n -d(after stopping the bluetooth service). So I
already run it with sudo and experimental option.I am not sure to understand what you mean by "this kind of error message".
Because I do not see any error message in the log I provided.OK, that was bad on my part. I read it as complaining that there were too many advertisements. Looking again that wasn't what it was say. Apologies.
Quoted 2 lines
Any other idea?
I am by Linux Single Board Computers (SBC) today so I'm able to run what you are running and can show you what I'm seeing. I'll focus on example-advertisement first as example-gatt-server doesn't change the advertisements.
I've started the BlueZ daemon with "./src/bluetoothd -E -n -d"
In another shell when I start "./example-advertisement" I see the following in the output:
bluetoothd[2325]: src/adapter.c:property_set_mode() sending Set Powered command for index 0
bluetoothd[2325]: src/adapter.c:property_set_mode_complete() Success (0x00)
bluetoothd[2325]: src/adapter.c:new_settings_callback() Settings:0x00000ad1
bluetoothd[2325]: src/adapter.c:settings_changed() Changed settings:0x00000001
bluetoothd[2325]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
bluetoothd[2325]: src/adapter.c:trigger_passive_scanning() bluetoothd[2325]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[2325]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[2325]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[2325]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[2325]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[2325]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0On a second SBC, at the command line I run "bluetoothctl" and do "scan on". Once my first SBC is found I do "scan off". I then do "info B8:27:EB:22:57:E0" (this is the address of the first SBC) which gives the following output:
[bluetooth]# info B8:27:EB:22:57:E0
Device B8:27:EB:22:57:E0
Alias: B8-27-EB-22-57-E0
Paired: no
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Heart Rate (0000180d-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
ManufacturerData Key:0xffff
ManufacturerData Value:0x00
ManufacturerData Value:0x01
ManufacturerData Value:0x02
ManufacturerData Value:0x03
ManufacturerData Value:0x04
ServiceData Key: 00009999-0000-1000-8000-00805f9b34fb ServiceData Value:0x00
ServiceData Value:0x01
ServiceData Value:0x02
ServiceData Value:0x03
ServiceData Value:0x04I've also done a scan from my Android phone (using the Nordic nRF Connect app) and can see the advertisements also (just hard to share that information on here).
Does that help?
Quoted 408 lines · Barry Byford
Quoted 400 lines
Hello Olivier,
Quoted 175 lines · Olivier MARTIN
Hi all,
I am having issue to advertise/export GATT services exposed through DBus
API. I tried./test/example-gatt-server. And I also tried to merge./test/example-advertisementinto./test/example-gatt-server. But
in
both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional
debug
statement all prefixed with '#'):bluetoothd[16877]: src/gatt-database.c:manager_register_app() #
manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() #create_appbluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering
application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for
/org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered
advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char2, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc0, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char1, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc1, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:client_ready_cb() #client_ready_cb
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service2
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service1
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service0
bluetoothd[16877]: src/gatt-database.c:database_add_app() #database_add_app
bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application
registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding
ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData
for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0Quoted 4 lines
I start
./test/example-gatt-serveras a normal user. But Bluez does
not
seem to have any permission issue with it.Building from source I've seen something similar if I've used sudo for
the
make.To compile and install I use sudo for the install only:
make -j 4 && sudo make install
Quoted 134 lines
I am using 'BLE scanner' on Android to discover the GATT services. But
I
think the problem is coming from Bluez. When I connect the Android device
to
Bluez, I can see this log:bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected
eir_len14 bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR
ATT
connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref()0x98cd908:
g_attrib_ref=1
bluetoothd[16877]: src/device.c:load_gatt_db() #load_gatt_db:
Restoring
98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() #load_gatt_db_impl
bluetoothd[16877]: src/device.c:load_service() #load_service:
loading
service:0x0001, end:0x0005, uuid:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_service() #load_service:
loading
service:0x0014, end:0xffff, uuid:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0002, value handle:0x0003, properties0x0020uuid:
00002a05-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0015, value handle:0x0016, properties0x0002uuid:
00002a00-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0017, value handle:0x0018, properties0x0002uuid:
00002a01-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before
being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept
(98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state()0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected ->
connected (0)
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device
connected.
bluetoothd[16877]: src/device.c:gatt_server_init() #gatt_server_init
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found:
2
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status:
success,
error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() #register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_gatt_service() #add_gatt_service:
UUID:00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client
ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects
for
GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001 bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported
GATT
characteristic:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0 bluetoothd[16877]: src/device.c:store_gatt_db() #store_gatt_dbbluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device
Name:
Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance:0x0000I also reduced DBus 'TestAdvertisement' interface to only expose one
GATT
Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):def __init__(self, bus, index): Advertisement.__init__(self, bus, index, 'peripheral') #self.add_service_uuid('180D') # HeartRate self.add_service_uuid('180F') # Battery #self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03, 0x04]) #self.add_service_data('9999', [0x00, 0x01, 0x02, 0x03,
0x04])
self.include_tx_power = TrueMy concern is mainly these lines:
Quoted 10 lines
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found:
2
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fbI've seen this kind of error message when I've had a failure of a previous script and the Bluetooth daemon is in some unknown state. At
this point it is worth restarting the bluetooth service with:
sudo service bluetooth restartYou will see in the advertising DBus API documentation that it is still in experimental mode in 5.44.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n78
This means that you need to make sure bluetoothd is started in experimental mode. Have you done this?
You can check with "sudo service bluetooth status"Experimental can be switched on by default in the bluetooth.service file
Edit
/lib/systemd/system/bluetooth.servicefile to add --experimental
flag
e.g:sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/'
/lib/systemd/system/bluetooth.serviceQuoted 19 lines
I have not found the code that export GATT Services from GATT Database
to
the BLE central.From my search on Internet, it looks I am not the only one who is having
this issue
I am happy to share/test anything that could help to make some progress.Thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 1 line
Luiz Augusto von Dentz
Hi Luiz,
after doing more investigation, I think the slow down comes from some incompatibilities between Bluez v5.44 and the Linux kernel distributed with Ubuntu 16.04 (ie: 4.4.0-72).
Android can discover the GATT services of Bluez's v5.37 './tests/example-gatt-server' with bluez v5.37 distributed by Ubuntu 16.04 under a second.
FYI, I attached 'btmon.log' that is the result of 'btmon' when I had the slowdown with Android 5.1.
Thanks,
Olivier
Quoted 56 lines · Luiz Augusto von Dentz
Hi Oliver,
Quoted 44 lines · Olivier MARTIN
I am back on the thread.
What I noticed last week when I tried on Android phone with both "BLE Scanner" and "Nordic Connect", discovering GATT services is really really slow (it takes 2 min to discover allexample-gatt-serverGATT services) on Nexus 4 with Android 5.1.1 and Ubuntu 16.04 with Bluez v5.44 for the GATT server. I am using the Asus USB-BT400 (Broadcom chipset).I did more investigation this evening but I have not done any progress. I tried with
example-gatt-serverstarted by the user and root and no change in the poor performance.I do not know what is taking so long but for instance it takes many seconds to execute this part:
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:
0x005e
end:0x0061
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0060
end:0x0061
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0061end:0x0061
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0062
end:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0062
end:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x006e
end:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0065end:0x0067
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0066end:0x0067
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0067end:0x0067
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x006aend:0x006c
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x006bend:0x006c
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x006cend:0x006c
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x006fend:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0070end:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0071end:0x0071Quoted 8 lines
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:
0x0072
end:0x0079
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0072
end:0x0079
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0079
end:0x0079
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0077end:0x0077
Quoted 717 lines
You should be able to see their timings in HCI with btmon, or just use journalctl if are thinking there is a delay in processing the packets but I think that is not the case. These many Find Info does indeed looks odd, and there are even repeated range.
Quoted 712 lines · Barry Byford
Quoted 17 lines
Hello Olivier,
Quoted 3 lines · Olivier MARTIN
Thanks Barry, setting 'ControllerMode = le' in
/etc/bluetooth/main.conffixed my issue. I can now see the GATT services.Good news!
Quoted 6 lines
But I guess my adapter now only works as BLE adapter and will ignore the non-LE devices.
In the comment of/etc/bluetooth/main.confit is written the adapter should
be by default set as 'dual'.Quoted 685 lines
Quoted 2 lines
Is it a bug in Bluez? Why GATT services are not exposed while using the default value for 'ControllerMode'?
This issue has come up before and was discuss here:
http://marc.info/?l=linux-bluetooth&m=146071596012263&w=2Quoted 675 lines · Barry Byford
Quoted 673 lines
Hello Olivier,
Quoted 6 lines · Olivier MARTIN
You are right Barry,
example-advertisementseems to work well (I installed
and tried Nordic nRF Connect and I can see the expected advertisemet data).Excellent!
Quoted 5 lines
But I cannot still manage to get
example-gatt-server:-( I am sure I got it working last year with an older version of Bluez. But
I
cannot make it work with Bluez v5.44.OK, I've taken a look at "example-gatt-server" and have it working...
Quoted 8 lines
My testing procedure:
1. [Laptop] First terminal: Start
sudo ./src/bluetoothd -E -n -d
2. [Laptop] Second terminal: Start unmodified Bluez ./test/example-gatt-server
3. [Laptop] Third terminal: Ensure the adapter is "Powered: yes" and "Discoverable: yes"OK, I've done this slightly different (details below). However, the first thing I did was edit "
/etc/bluetooth/main.conf"
I added the following line to the end of the file:ControllerMode = le
Then I did the following:
1. [SBC1:T1] sudo ./src/bluetoothd -E -n -d
2. [SBC1:T2] ./example-gatt-server
3. [SBC1:T3] ./example-advertisementQuoted 8 lines
4. [Android] Connect using Nordic nRF Connect (I also tried with "BLE Scanner") and check I see the exposed GATT services by
example-gatt-server
Unfortunately, I can only see:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I've used bluetoothctl on SBC2 to connect and read the battery values that the GATT server is counting down.
$ bluetoothctl [NEW] Controller 00:00:00:00:5A:AD linaro-alip [default] [bluetooth]# scan on Discovery started [CHG] Controller 00:00:00:00:5A:AD Discovering: yes [NEW] Device B8:27:EB:22:57:E0 BluezeroLight [bluetooth]# scan off Discovery stopped [CHG] Controller 00:00:00:00:5A:AD Discovering: no [bluetooth]# connect B8:27:EB:22:57:E0 Attempting to connect to B8:27:EB:22:57:E0 [CHG] Device B8:27:EB:22:57:E0 Connected: yes Connection successful [...snip...] [NEW] Primary Service /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a 0000180f-0000-1000-8000-00805f9b34fb Battery Service [NEW] Characteristic /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b 00002a19-0000-1000-8000-00805f9b34fb Battery Level [...snip...] [CHG] Device B8:27:EB:22:57:E0 ServicesResolved: yes [BluezeroLight]# select-attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [BluezeroLight:/service000a/char000b]# read Attempting to read /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 46 F [BluezeroLight:/service000a/char000b]# notify on [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: yes Notify started [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x44 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x42 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x40 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x3e [BluezeroLight:/service000a/char000b]# notify off [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: no Notify stoppedThat seems to be working then. When I didn't have "ControllerMode = le" set then I did see it be unpredictable if it successfully connected or not.
This also worked connecting with the nRF app.Does that work for you?
Quoted 545 lines
If I had to suspect Bluez code, I will guess there is something missing around here:
bluetoothd[20429]: src/device.c:gatt_server_init() #
gatt_server_initbluetoothd[20429]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[20429]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[20429]: src/device.c:gatt_client_ready_cb() status: success,
error: 0As Bluez daemon does not get the GATT services from Buez GATT Database. But
it might be me who miss a step...Quoted 521 lines · Barry Byford
example-advertisementHello Oliver,
Quoted 5 lines · Olivier MARTIN
Thanks for replying my message Barry,
Quoted 8 lines
Sorry, I forgot to mention but I start Bluez daemon with
sudo ./src/bluetoothd -E -n -d(after stopping the bluetooth service). So I
already run it with sudo and experimental option.I am not sure to understand what you mean by "this kind of error message".
Because I do not see any error message in the log I provided.OK, that was bad on my part. I read it as complaining that there were too many advertisements. Looking again that wasn't what it was say. Apologies.
Quoted 2 lines
Any other idea?
I am by Linux Single Board Computers (SBC) today so I'm able to run what you are running and can show you what I'm seeing. I'll focus on example-advertisement first as example-gatt-server doesn't change the advertisements.
I've started the BlueZ daemon with "./src/bluetoothd -E -n -d"
In another shell when I start "./example-advertisement" I see the following in the output:
bluetoothd[2325]: src/adapter.c:property_set_mode() sending Set Powered command for index 0
bluetoothd[2325]: src/adapter.c:property_set_mode_complete() Success (0x00)
bluetoothd[2325]: src/adapter.c:new_settings_callback() Settings:0x00000ad1
bluetoothd[2325]: src/adapter.c:settings_changed() Changed settings:0x00000001
bluetoothd[2325]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
bluetoothd[2325]: src/adapter.c:trigger_passive_scanning() bluetoothd[2325]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[2325]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[2325]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[2325]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[2325]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[2325]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0On a second SBC, at the command line I run "bluetoothctl" and do "scan on". Once my first SBC is found I do "scan off". I then do "info B8:27:EB:22:57:E0" (this is the address of the first SBC) which gives the following output:
[bluetooth]# info B8:27:EB:22:57:E0
Device B8:27:EB:22:57:E0
Alias: B8-27-EB-22-57-E0
Paired: no
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Heart Rate (0000180d-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
ManufacturerData Key:0xffff
ManufacturerData Value:0x00
ManufacturerData Value:0x01
ManufacturerData Value:0x02
ManufacturerData Value:0x03
ManufacturerData Value:0x04
ServiceData Key: 00009999-0000-1000-8000-00805f9b34fb ServiceData Value:0x00
ServiceData Value:0x01
ServiceData Value:0x02
ServiceData Value:0x03
ServiceData Value:0x04I've also done a scan from my Android phone (using the Nordic nRF Connect app) and can see the advertisements also (just hard to share that information on here).
Does that help?
Quoted 409 lines · Barry Byford
Quoted 401 lines
Hello Olivier,
Quoted 175 lines · Olivier MARTIN
Hi all,
I am having issue to advertise/export GATT services exposed through DBus
API. I tried./test/example-gatt-server. And I also tried to merge./test/example-advertisementinto./test/example-gatt-server. But
in
both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional
debug
statement all prefixed with '#'):bluetoothd[16877]: src/gatt-database.c:manager_register_app() #
manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() #create_appbluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering
application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for
/org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered
advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char2, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc0, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char1, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc1, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:client_ready_cb() #client_ready_cb
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service2
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service1
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service0
bluetoothd[16877]: src/gatt-database.c:database_add_app() #database_add_app
bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application
registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding
ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData
for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0Quoted 4 lines
I start
./test/example-gatt-serveras a normal user. But Bluez does
not
seem to have any permission issue with it.Building from source I've seen something similar if I've used sudo for
the
make.To compile and install I use sudo for the install only:
make -j 4 && sudo make install
Quoted 135 lines
I am using 'BLE scanner' on Android to discover the GATT services. But
I
think the problem is coming from Bluez. When I connect the Android device
to
Bluez, I can see this log:bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected
eir_len14 bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR
ATT
connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref()0x98cd908:
g_attrib_ref=1
bluetoothd[16877]: src/device.c:load_gatt_db() #load_gatt_db:
Restoring
98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() #load_gatt_db_impl
bluetoothd[16877]: src/device.c:load_service() #load_service:
loading
service:0x0001, end:0x0005, uuid:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_service() #load_service:
loading
service:0x0014, end:0xffff, uuid:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0002, value handle:0x0003, properties0x0020uuid:
00002a05-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0015, value handle:0x0016, properties0x0002uuid:
00002a00-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0017, value handle:0x0018, properties0x0002uuid:
00002a01-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before
being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept
(98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state()0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected ->
connected (0)
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device
connected.
bluetoothd[16877]: src/device.c:gatt_server_init() #gatt_server_init
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found:
2
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status:
success,
error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() #register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_gatt_service() #add_gatt_service:
UUID:00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client
ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects
for
GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001 bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported
GATT
characteristic:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0 bluetoothd[16877]: src/device.c:store_gatt_db() #store_gatt_dbbluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device
Name:
Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance:0x0000I also reduced DBus 'TestAdvertisement' interface to only expose one
GATT
Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):def __init__(self, bus, index): Advertisement.__init__(self, bus, index, 'peripheral') #self.add_service_uuid('180D') # HeartRate self.add_service_uuid('180F') # Battery #self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03, 0x04]) #self.add_service_data('9999', [0x00, 0x01, 0x02,
0x03,0x04])
self.include_tx_power = TrueMy concern is mainly these lines:
Quoted 10 lines
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found:
2
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fbI've seen this kind of error message when I've had a failure of a previous script and the Bluetooth daemon is in some unknown state. At
this point it is worth restarting the bluetooth service with:
sudo service bluetooth restartYou will see in the advertising DBus API documentation that it is still in experimental mode in 5.44.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n78
This means that you need to make sure bluetoothd is started in experimental mode. Have you done this?
You can check with "sudo service bluetooth status"Experimental can be switched on by default in the bluetooth.service file
Edit
/lib/systemd/system/bluetooth.servicefile to add --experimental
flag
e.g:sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/'
/lib/systemd/system/bluetooth.serviceQuoted 19 lines
I have not found the code that export GATT Services from GATT Database
to
the BLE central.From my search on Internet, it looks I am not the only one who is having
this issue
I am happy to share/test anything that could help to make some progress.Thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
= New Index: 5C:F3:70:6A:D9:3C (Primary,USB,hci0) [hci0] 0.264415
= Open Index: 5C:F3:70:6A:D9:3C [hci0] 0.264417
= Index Info: 5C:F3:70:6A:D9:3C (Broadcom Corporation) [hci0] 0.264418
> HCI Event: LE Meta Event (0x3e) plen 19 [hci0] 5.331404
LE Connection Complete (0x01)
Status: Success (0x00)
Handle: 64
Role: Slave (0x01)
Peer address type: Random (0x01)
Peer address: 5E:3A:99:E3:23:CD (Resolvable)
Connection interval: 48.75 msec (0x0027)
Connection latency: 0.00 msec (0x0000)
Supervision timeout: 20000 msec (0x07d0)
Master clock accuracy: 0x05< ACL Data TX: Handle 64 flags 0x00 dlen 16 [hci0] 5.331611
LE L2CAP: Connection Parameter Update Request (0x12) ident 1 len 8
Min interval: 40
Max interval: 56
Slave latency: 0
Timeout multiplier: 2000
@ Device Connected: 5E:3A:99:E3:23:CD (2) flags 0x0000
< ACL Data TX: Handle 64 flags 0x00 dlen 7 [hci0] 5.332136
ATT: Exchange MTU Request (0x02) len 2
Client RX MTU: 517
Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 5.396396
Num handles: 1
Handle: 64
Count: 2
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 10 [hci0] 5.444224
LE L2CAP: Connection Parameter Update Response (0x13) ident 1 len 2
Result: Connection Parameters accepted (0x0000)Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 7 [hci0] 5.542005
ATT: Exchange MTU Response (0x03) len 2
Server RX MTU: 517
< ACL Data TX: Handle 64 flags 0x00 dlen 11 [hci0] 5.542343
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x0001-0xffff
Attribute group type: Primary Service (0x2800)Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 5.590647
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x0001-0xffff
Attribute group type: Primary Service (0x2800)
< ACL Data TX: Handle 64 flags 0x00 dlen 24 [hci0] 5.590898
ATT: Read By Group Type Response (0x11) len 19
Attribute data length: 6
Attribute group list: 3 entries
Handle range: 0x0001-0x0005
UUID: Generic Access Profile (0x1800)
Handle range: 0x0006-0x0009
UUID: Generic Attribute Profile (0x1801)
Handle range: 0x000a-0x000d
UUID: Battery Service (0x180f)Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 18 [hci0] 5.639527
ATT: Read By Group Type Response (0x11) len 13
Attribute data length: 6
Attribute group list: 2 entries
Handle range: 0x0001-0x0005
UUID: Generic Attribute Profile (0x1801)
Handle range: 0x0014-0xffff
UUID: Generic Access Profile (0x1800)
< ACL Data TX: Handle 64 flags 0x00 dlen 11 [hci0] 5.639932
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x0001-0xffff
Attribute group type: Secondary Service (0x2801)Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 5.688156
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x000e-0xffff
Attribute group type: Primary Service (0x2800)
< ACL Data TX: Handle 64 flags 0x00 dlen 26 [hci0] 5.688413
ATT: Read By Group Type Response (0x11) len 21
Attribute data length: 20
Attribute group list: 1 entry
Handle range: 0x000e-0x001d
UUID: Vendor specific (12345678-1234-5678-1234-56789abcdef0)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 5.689357
Num handles: 1
Handle: 64
Count: 2
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 5.736775
ATT: Error Response (0x01) len 4
Read By Group Type Request (0x10)
Handle: 0x0001
Error: Unsupported Group Type (0x10)
< ACL Data TX: Handle 64 flags 0x00 dlen 11 [hci0] 5.737047
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0001-0x0005
Attribute type: Include (0x2802)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 5.816420
Num handles: 1
Handle: 64
Count: 2
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 5.816432
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x001e-0xffff
Attribute group type: Primary Service (0x2800)
< ACL Data TX: Handle 64 flags 0x00 dlen 12 [hci0] 5.816695
ATT: Read By Group Type Response (0x11) len 7
Attribute data length: 6
Attribute group list: 1 entry
Handle range: 0x001e-0x0025
UUID: Heart Rate (0x180d)Quoted 1 line
HCI Event: LE Meta Event (
0x3e) plen 10 [hci0] 5.817423
LE Connection Update Complete (0x03)
Status: Success (0x00)
Handle: 64
Connection interval: 67.50 msec (0x0036)
Connection latency: 0.00 msec (0x0000)
Supervision timeout: 20000 msec (0x07d0)Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 5.883029
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0001
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 11 [hci0] 5.883233
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0014-0xffff
Attribute type: Include (0x2802)Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 5.950685
ATT: Read By Group Type Request (0x10) len 6
Handle range: 0x0026-0xffff
Attribute group type: Primary Service (0x2800)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 5.950965
ATT: Error Response (0x01) len 4
Read By Group Type Request (0x10)
Handle: 0x0026
Error: Attribute Not Found (0x0a)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 5.951360
Num handles: 1
Handle: 64
Count: 2
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 6.085807
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0014
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 11 [hci0] 6.086017
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0001-0x0005
Attribute type: Characteristic (0x2803)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 6.086234
Num handles: 1
Handle: 64
Count: 2
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 6.153046
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0001-0x0005
Attribute type: Include (0x2802)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 6.153339
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0001
Error: Attribute Not Found (0x0a)Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 13 [hci0] 7.165684
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0002
Value: 200300052a
< ACL Data TX: Handle 64 flags 0x00 dlen 11 [hci0] 7.165875
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0003-0x0005
Attribute type: Characteristic (0x2803)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 7.345432
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 9.663320
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0001-0x0005
Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 64 flags 0x00 dlen 20 [hci0] 9.663577
ATT: Read By Type Response (0x09) len 15
Attribute data length: 7
Attribute data list: 2 entries
Handle: 0x0002
Value: 020300002a
Handle: 0x0004
Value: 020500012aQuoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 9.845460
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 12.160742
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0003
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 12.161073
ATT: Find Information Request (0x04) len 4
Handle range: 0x0004-0x0005Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 12.345483
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 14.658367
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0005-0x0005
Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 14.658616
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0005
Error: Attribute Not Found (0x0a)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 14.845516
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 17.155765
ATT: Error Response (0x01) len 4
Find Information Request (0x04)
Handle: 0x0004
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 11 [hci0] 17.155920
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0014-0xffff
Attribute type: Characteristic (0x2803)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 17.346532
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 19.653425
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0006-0x0009
Attribute type: Include (0x2802)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 19.653637
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0006
Error: Attribute Not Found (0x0a)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 19.846562
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 20 [hci0] 22.151046
ATT: Read By Type Response (0x09) len 15
Attribute data length: 7
Attribute data list: 2 entries
Handle: 0x0015
Value: 021600002a
Handle: 0x0017
Value: 021800012a
< ACL Data TX: Handle 64 flags 0x00 dlen 11 [hci0] 22.151258
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0018-0xffff
Attribute type: Characteristic (0x2803)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 22.346609
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 24.648466
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0006-0x0009
Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 64 flags 0x00 dlen 13 [hci0] 24.648692
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x0007
Value: 200800052aQuoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 24.846622
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 27.145990
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0018
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 27.146285
ATT: Find Information Request (0x04) len 4
Handle range: 0x0019-0xffffQuoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 27.346656
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 29.643540
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0008-0x0009
Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 29.643821
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0008
Error: Attribute Not Found (0x0a)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 29.847674
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 32.141054
ATT: Error Response (0x01) len 4
Find Information Request (0x04)
Handle: 0x0019
Error: Attribute Not Found (0x0a)
< ACL Data TX: Handle 64 flags 0x00 dlen 7 [hci0] 32.142594
ATT: Read Request (0x0a) len 2
Handle: 0x0016Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 32.347697
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 34.638561
ATT: Find Information Request (0x04) len 4
Handle range: 0x0009-0x0009
< ACL Data TX: Handle 64 flags 0x00 dlen 10 [hci0] 34.638810
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x0009
UUID: Client Characteristic Configuration (0x2902)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 34.847732
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 12 [hci0] 37.136212
ATT: Read Response (0x0b) len 7
Value: 4e657875732034
< ACL Data TX: Handle 64 flags 0x00 dlen 7 [hci0] 37.136595
ATT: Read Request (0x0a) len 2
Handle: 0x0018Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 37.347740
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 39.633742
ATT: Read By Type Request (0x08) len 6
Handle range: 0x000a-0x000d
Attribute type: Include (0x2802)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 39.633996
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x000a
Error: Attribute Not Found (0x0a)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 39.847757
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 42.347796
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 7 [hci0] 44.628674
ATT: Read Response (0x0b) len 2
Value: 0000Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 44.848813
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 47.126454
ATT: Read By Type Request (0x08) len 6
Handle range: 0x000a-0x000d
Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 64 flags 0x00 dlen 13 [hci0] 47.126657
ATT: Read By Type Response (0x09) len 8
Attribute data length: 7
Attribute data list: 1 entry
Handle: 0x000b
Value: 120c00192aQuoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 52.121491
ATT: Read By Type Request (0x08) len 6
Handle range: 0x000c-0x000d
Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 52.121737
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x000c
Error: Attribute Not Found (0x0a)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 52.348909
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 57.116442
ATT: Find Information Request (0x04) len 4
Handle range: 0x000d-0x000d
< ACL Data TX: Handle 64 flags 0x00 dlen 10 [hci0] 57.116715
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x000d
UUID: Client Characteristic Configuration (0x2902)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 57.349962
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 62.111720
ATT: Read By Type Request (0x08) len 6
Handle range: 0x000e-0x001d
Attribute type: Include (0x2802)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 62.111935
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x000e
Error: Attribute Not Found (0x0a)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 62.349984
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 67.106773
ATT: Read By Type Request (0x08) len 6
Handle range: 0x000e-0x001d
Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 64 flags 0x00 dlen 27 [hci0] 67.107075
< ACL Data TX: Handle 64 flags 0x01 dlen 27 [hci0] 67.107088
< ACL Data TX: Handle 64 flags 0x01 dlen 15 [hci0] 67.107091
ATT: Read By Type Response (0x09) len 64
Attribute data length: 21
Attribute data list: 3 entries
Handle: 0x000f
Value: 8a1000f5debc9a785634127856341278563412
Handle: 0x0014
Value: 8a1500f1debc9a785634127856341278563412
Handle: 0x0019
Value: 8a1a00f3debc9a785634127856341278563412Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 67.350037
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 69.606070
Num handles: 1
Handle: 64
Count: 2
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 72.101945
ATT: Read By Type Request (0x08) len 6
Handle range: 0x001a-0x001d
Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 72.102244
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x001a
Error: Attribute Not Found (0x0a)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 72.351106
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 77.096746
ATT: Find Information Request (0x04) len 4
Handle range: 0x0011-0x0013
< ACL Data TX: Handle 64 flags 0x00 dlen 10 [hci0] 77.097040
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x0011
UUID: Characteristic Extended Properties (0x2900)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 77.226135
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 82.091793
ATT: Find Information Request (0x04) len 4
Handle range: 0x0012-0x0013
< ACL Data TX: Handle 64 flags 0x00 dlen 24 [hci0] 82.092049
ATT: Find Information Response (0x05) len 19
Format: UUID-128 (0x02)
Handle: 0x0012
UUID: Vendor specific (12345678-1234-5678-1234-56789abcdef6)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 82.227194
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 87.086846
ATT: Find Information Request (0x04) len 4
Handle range: 0x0013-0x0013
< ACL Data TX: Handle 64 flags 0x00 dlen 10 [hci0] 87.087178
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x0013
UUID: Characteristic User Description (0x2901)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 87.227231
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 92.081896
ATT: Find Information Request (0x04) len 4
Handle range: 0x0016-0x0018
< ACL Data TX: Handle 64 flags 0x00 dlen 10 [hci0] 92.082197
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x0016
UUID: Characteristic Extended Properties (0x2900)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 92.227292
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 97.077070
ATT: Find Information Request (0x04) len 4
Handle range: 0x0017-0x0018
< ACL Data TX: Handle 64 flags 0x00 dlen 24 [hci0] 97.077318
ATT: Find Information Response (0x05) len 19
Format: UUID-128 (0x02)
Handle: 0x0017
UUID: Vendor specific (12345678-1234-5678-1234-56789abcdef2)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 97.228332
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 102.072117
ATT: Find Information Request (0x04) len 4
Handle range: 0x0018-0x0018
< ACL Data TX: Handle 64 flags 0x00 dlen 10 [hci0] 102.072328
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x0018
UUID: Characteristic User Description (0x2901)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 102.228382
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 107.067171
ATT: Find Information Request (0x04) len 4
Handle range: 0x001b-0x001d
< ACL Data TX: Handle 64 flags 0x00 dlen 10 [hci0] 107.067470
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x001b
UUID: Characteristic Extended Properties (0x2900)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 107.229433
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 112.062345
ATT: Find Information Request (0x04) len 4
Handle range: 0x001c-0x001d
< ACL Data TX: Handle 64 flags 0x00 dlen 24 [hci0] 112.062584
ATT: Find Information Response (0x05) len 19
Format: UUID-128 (0x02)
Handle: 0x001c
UUID: Vendor specific (12345678-1234-5678-1234-56789abcdef4)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 112.229508
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 117.057396
ATT: Find Information Request (0x04) len 4
Handle range: 0x001d-0x001d
< ACL Data TX: Handle 64 flags 0x00 dlen 10 [hci0] 117.057701
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x001d
UUID: Characteristic User Description (0x2901)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 117.229534
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 122.052701
ATT: Read By Type Request (0x08) len 6
Handle range: 0x001e-0x0025
Attribute type: Include (0x2802)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 122.053006
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x001e
Error: Attribute Not Found (0x0a)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 122.230576
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 127.047783
ATT: Read By Type Request (0x08) len 6
Handle range: 0x001e-0x0025
Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 64 flags 0x00 dlen 27 [hci0] 127.048072
ATT: Read By Type Response (0x09) len 22
Attribute data length: 7
Attribute data list: 3 entries
Handle: 0x001f
Value: 022000382a
Handle: 0x0021
Value: 102200372a
Handle: 0x0024
Value: 082500392aQuoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 127.230664
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 11 [hci0] 132.042665
ATT: Read By Type Request (0x08) len 6
Handle range: 0x0025-0x0025
Attribute type: Characteristic (0x2803)
< ACL Data TX: Handle 64 flags 0x00 dlen 9 [hci0] 132.042936
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x0025
Error: Attribute Not Found (0x0a)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 132.231652
Num handles: 1
Handle: 64
Count: 1
Quoted 1 line
ACL Data RX: Handle 64 flags
0x02dlen 9 [hci0] 137.037598
ATT: Find Information Request (0x04) len 4
Handle range: 0x0023-0x0023
< ACL Data TX: Handle 64 flags 0x00 dlen 10 [hci0] 137.037799
ATT: Find Information Response (0x05) len 5
Format: UUID-16 (0x01)
Handle: 0x0023
UUID: Client Characteristic Configuration (0x2902)Quoted 1 line
HCI Event: Number of Completed Packets (
0x13) plen 5 [hci0] 137.231731
Num handles: 1
Handle: 64
Count: 1
Hi again,
forget about what I said in my previous email. I thought was an incompatibility between Bluez and the Ubuntu 16.04 Linux kernel. But after coming back on Bluez v5.37 + additional patchset to add DBus GATT Application support - these following patches:
d41a7bf shared/att: Fix not notifying the callback
8d3e9ca core/gatt-database: Don't always wait for response 98bf7ec gdbus/client: Use g_dbus_send_message if callback is not set b960430 test/example-gatt-server: Don't order objects
9175f5e gatt-database: Fix GATT object ordering
2ba5a6c shared/gatt-client: Fix not detecting BT_ATT_SECURITY_AUTO 24dc645 core/gatt-client: Fix printing errors if experimental is disabled 75c0728 shared/gatt-client: Fix not clearing database after discovery 6b86c86 tools/btgatt-client: Fix write-value byte parsing
bdd8b3e tools/avinfo: Fix big endian build
cb1bccf test: Fix scripts to run with python 3
7124468 shared/gatt-client: Fix regression
e4acec5 core/device: Fix not clearing Attributes before storing 0001c4c core/device: Fix not reseting database if attributes cannot be loaded 118633b core/device: Fix log when loading characteristic fails 166d698 shared/gatt-client: Rename tmp_queue to svcs
6f211c6 shared/gatt-client: Add debug log if characteristic cannot be added 757eef5 client: Fix removing all devices
ad68605 obexd: client: Fix memory leaks
63774ba adapter: Fix memory leak
29e2531 tools/gatt-service: Add missing methods
06ed769 tools/gatt-service: Add missing properties
e76fad8 tools/gatt-service: Fix using RegisterService
f0e5192 client: Fix not detecting connections when starting 6a1f8e6 shared/gatt-client: Fix crash unregistering notification 1561910 shared/gatt-client: Fix bogus asserts
fee0020 core/gatt-client: Fix not being able to cancel notifications 0d9b55c shared/gatt-client: Fix not resetting request id
3213d1a shared/gatt-client: Make read_long_value more robust 54ecf66 monitor/avctp: Print <empty> if folder lenght is 0 28a582b audio/avrcp: Fix not always requesting capabilities ca5a188 tools/btmgmt: Fix canceling pairing
6304273 client: Update remove command to support removing all devices 4c3c78b test: Add device discovery filter
cdc9435 core/gatt-database: Fix possible memory leaks
cd94d49 gdbus/client: Always call ready callback
758d2b4 test/example-gatt-server: Make use of RegisterApplication 60ebf90 core/gatt-database: Implement Application API
ae78365 doc/gatt-api: Make proper use of ObjectManager
218969a doc: fix typos in mgmt-api.txt
56776af Release 5.37
I still see the long duration during "Discovering Services" while connecting with Android.
I added the various log (Bluez + btmon) with the steps I used in this Github gist: https://gist.github.com/oliviermartin/bef59f3bb9a6e5e2bf2dea5178c429e4
I do not have any suspicious message in 'dmesg'. I have not changed any kernel settings to increase bluetooth debug messaging - can I? I also noticed many time with Android "BLE Scanner", it fails to read the Bluez GATT server characteristics when I request reading readable characteristics.
What I find suspicious (but I am not a Bluetooth expert) is that there are many error messages of this type in btmon log during the Discovering Services done by the Android phone:
< ACL Data TX: Handle 64 flags 0x00 dlen 9
[hci0]
ATT: Error Response (0x01) len 4
Read By Type Request (0x08)
Handle: 0x000a
Error: Attribute Not Found (0x0a)My bluetooth adapter Asus BT400 in 'dmesg':
[ 19.153383] Bluetooth: hci0: BCM20702A1 (001.002.014) build 1467 [ 19.169343] Bluetooth: hci0: Broadcom Bluetooth Device
Any idea?
Quoted 773 lines · Luiz Augusto von Dentz
Hi Oliver,
Quoted 44 lines · Olivier MARTIN
I am back on the thread.
What I noticed last week when I tried on Android phone with both "BLE Scanner" and "Nordic Connect", discovering GATT services is really really slow (it takes 2 min to discover allexample-gatt-serverGATT services) on Nexus 4 with Android 5.1.1 and Ubuntu 16.04 with Bluez v5.44 for the GATT server. I am using the Asus USB-BT400 (Broadcom chipset).I did more investigation this evening but I have not done any progress. I tried with
example-gatt-serverstarted by the user and root and no change in the poor performance.I do not know what is taking so long but for instance it takes many seconds to execute this part:
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:
0x005e
end:0x0061
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0060
end:0x0061
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0061end:0x0061
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0062
end:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0062
end:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x006e
end:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0065end:0x0067
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0066end:0x0067
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0067end:0x0067
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x006aend:0x006c
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x006bend:0x006c
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x006cend:0x006c
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x006fend:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0070end:0x0071
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0071end:0x0071Quoted 8 lines
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:
0x0072
end:0x0079
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0072
end:0x0079
bluetoothd[12913]: src/device.c:gatt_debug() Read By Type - start:0x0079
end:0x0079
bluetoothd[12913]: src/device.c:gatt_debug() Find Info - start:0x0077end:0x0077You should be able to see their timings in HCI with btmon, or just use journalctl if are thinking there is a delay in processing the packets but I think that is not the case. These many Find Info does indeed looks odd, and there are even repeated range.
Quoted 712 lines · Barry Byford
Quoted 17 lines
Hello Olivier,
Quoted 3 lines · Olivier MARTIN
Thanks Barry, setting 'ControllerMode = le' in
/etc/bluetooth/main.conffixed my issue. I can now see the GATT services.Good news!
Quoted 6 lines
But I guess my adapter now only works as BLE adapter and will ignore the non-LE devices.
In the comment of/etc/bluetooth/main.confit is written the adapter should
be by default set as 'dual'.Quoted 685 lines
Quoted 2 lines
Is it a bug in Bluez? Why GATT services are not exposed while using the default value for 'ControllerMode'?
This issue has come up before and was discuss here:
http://marc.info/?l=linux-bluetooth&m=146071596012263&w=2Quoted 675 lines · Barry Byford
Quoted 673 lines
Hello Olivier,
Quoted 6 lines · Olivier MARTIN
You are right Barry,
example-advertisementseems to work well (I installed
and tried Nordic nRF Connect and I can see the expected advertisemet data).Excellent!
Quoted 5 lines
But I cannot still manage to get
example-gatt-server:-( I am sure I got it working last year with an older version of Bluez. But
I
cannot make it work with Bluez v5.44.OK, I've taken a look at "example-gatt-server" and have it working...
Quoted 8 lines
My testing procedure:
1. [Laptop] First terminal: Start
sudo ./src/bluetoothd -E -n -d
2. [Laptop] Second terminal: Start unmodified Bluez ./test/example-gatt-server
3. [Laptop] Third terminal: Ensure the adapter is "Powered: yes" and "Discoverable: yes"OK, I've done this slightly different (details below). However, the first thing I did was edit "
/etc/bluetooth/main.conf"
I added the following line to the end of the file:ControllerMode = le
Then I did the following:
1. [SBC1:T1] sudo ./src/bluetoothd -E -n -d
2. [SBC1:T2] ./example-gatt-server
3. [SBC1:T3] ./example-advertisementQuoted 8 lines
4. [Android] Connect using Nordic nRF Connect (I also tried with "BLE Scanner") and check I see the exposed GATT services by
example-gatt-server
Unfortunately, I can only see:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I've used bluetoothctl on SBC2 to connect and read the battery values that the GATT server is counting down.
$ bluetoothctl [NEW] Controller 00:00:00:00:5A:AD linaro-alip [default] [bluetooth]# scan on Discovery started [CHG] Controller 00:00:00:00:5A:AD Discovering: yes [NEW] Device B8:27:EB:22:57:E0 BluezeroLight [bluetooth]# scan off Discovery stopped [CHG] Controller 00:00:00:00:5A:AD Discovering: no [bluetooth]# connect B8:27:EB:22:57:E0 Attempting to connect to B8:27:EB:22:57:E0 [CHG] Device B8:27:EB:22:57:E0 Connected: yes Connection successful [...snip...] [NEW] Primary Service /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a 0000180f-0000-1000-8000-00805f9b34fb Battery Service [NEW] Characteristic /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b 00002a19-0000-1000-8000-00805f9b34fb Battery Level [...snip...] [CHG] Device B8:27:EB:22:57:E0 ServicesResolved: yes [BluezeroLight]# select-attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [BluezeroLight:/service000a/char000b]# read Attempting to read /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 46 F [BluezeroLight:/service000a/char000b]# notify on [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: yes Notify started [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x46 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x44 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x42 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x40 [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Value: 0x3e [BluezeroLight:/service000a/char000b]# notify off [CHG] Attribute /org/bluez/hci0/dev_B8_27_EB_22_57_E0/service000a/char000b Notifying: no Notify stoppedThat seems to be working then. When I didn't have "ControllerMode = le" set then I did see it be unpredictable if it successfully connected or not.
This also worked connecting with the nRF app.Does that work for you?
Quoted 545 lines
If I had to suspect Bluez code, I will guess there is something missing around here:
bluetoothd[20429]: src/device.c:gatt_server_init() #
gatt_server_initbluetoothd[20429]: src/device.c:gatt_debug() Primary services found: 2 bluetoothd[20429]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[20429]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[20429]: src/device.c:gatt_client_ready_cb() status: success,
error: 0As Bluez daemon does not get the GATT services from Buez GATT Database. But
it might be me who miss a step...Quoted 521 lines · Barry Byford
example-advertisementHello Oliver,
Quoted 5 lines · Olivier MARTIN
Thanks for replying my message Barry,
Quoted 8 lines
Sorry, I forgot to mention but I start Bluez daemon with
sudo ./src/bluetoothd -E -n -d(after stopping the bluetooth service). So I
already run it with sudo and experimental option.I am not sure to understand what you mean by "this kind of error message".
Because I do not see any error message in the log I provided.OK, that was bad on my part. I read it as complaining that there were too many advertisements. Looking again that wasn't what it was say. Apologies.
Quoted 2 lines
Any other idea?
I am by Linux Single Board Computers (SBC) today so I'm able to run what you are running and can show you what I'm seeing. I'll focus on example-advertisement first as example-gatt-server doesn't change the advertisements.
I've started the BlueZ daemon with "./src/bluetoothd -E -n -d"
In another shell when I start "./example-advertisement" I see the following in the output:
bluetoothd[2325]: src/adapter.c:property_set_mode() sending Set Powered command for index 0
bluetoothd[2325]: src/adapter.c:property_set_mode_complete() Success (0x00)
bluetoothd[2325]: src/adapter.c:new_settings_callback() Settings:0x00000ad1
bluetoothd[2325]: src/adapter.c:settings_changed() Changed settings:0x00000001
bluetoothd[2325]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled
bluetoothd[2325]: src/adapter.c:trigger_passive_scanning() bluetoothd[2325]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[2325]: src/advertising.c:client_create() Adding proxy for /org/bluez/example/advertisement0
bluetoothd[2325]: src/advertising.c:register_advertisement() Registered advertisement at path /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[2325]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[2325]: src/advertising.c:parse_manufacturer_data() Adding ManufacturerData for ffff
bluetoothd[2325]: src/advertising.c:parse_service_data() Adding ServiceData for 9999
bluetoothd[2325]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[2325]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0On a second SBC, at the command line I run "bluetoothctl" and do "scan on". Once my first SBC is found I do "scan off". I then do "info B8:27:EB:22:57:E0" (this is the address of the first SBC) which gives the following output:
[bluetooth]# info B8:27:EB:22:57:E0
Device B8:27:EB:22:57:E0
Alias: B8-27-EB-22-57-E0
Paired: no
Trusted: no
Blocked: no
Connected: no
LegacyPairing: no
UUID: Heart Rate (0000180d-0000-1000-8000-00805f9b34fb)
UUID: Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
ManufacturerData Key:0xffff
ManufacturerData Value:0x00
ManufacturerData Value:0x01
ManufacturerData Value:0x02
ManufacturerData Value:0x03
ManufacturerData Value:0x04
ServiceData Key: 00009999-0000-1000-8000-00805f9b34fb ServiceData Value:0x00
ServiceData Value:0x01
ServiceData Value:0x02
ServiceData Value:0x03
ServiceData Value:0x04I've also done a scan from my Android phone (using the Nordic nRF Connect app) and can see the advertisements also (just hard to share that information on here).
Does that help?
Quoted 409 lines · Barry Byford
Quoted 401 lines
Hello Olivier,
Quoted 175 lines · Olivier MARTIN
Hi all,
I am having issue to advertise/export GATT services exposed through DBus
API. I tried./test/example-gatt-server. And I also tried to merge./test/example-advertisementinto./test/example-gatt-server. But
in
both cases I only see the two compulsory GATT services:
- Generic Access Service (0x1800)
- Generic Attribute Service (0x1801)I am using Bluez v5.44. And I also tried Bluez v5.37.
GATT Services seem to be discovered by Bluez (note: I added additional
debug
statement all prefixed with '#'):bluetoothd[16877]: src/gatt-database.c:manager_register_app() #
manager_register_app
bluetoothd[16877]: src/gatt-database.c:create_app() #create_appbluetoothd[16877]: src/gatt-database.c:manager_register_app() Registering
application: :1.404:/
bluetoothd[16877]: src/advertising.c:register_advertisement() RegisterAdvertisement
bluetoothd[16877]: src/advertising.c:client_create() Adding proxy for
/org/bluez/example/advertisement0
bluetoothd[16877]: src/advertising.c:register_advertisement() Registered
advertisement at path /org/bluez/example/advertisement0 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char2, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc0, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char1, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc3, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char1/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0/desc1, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char2/desc2, iface:
org.bluez.GattDescriptor1
bluetoothd[16877]: src/gatt-database.c:proxy_added_cb() Object received:
/org/bluez/example/service2/char0, iface:
org.bluez.GattCharacteristic1
bluetoothd[16877]: src/gatt-database.c:client_ready_cb() #client_ready_cb
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service2
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service1
bluetoothd[16877]: src/gatt-database.c:create_service() #create_service
from /org/bluez/example/service0
bluetoothd[16877]: src/gatt-database.c:database_add_app() #database_add_app
bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:cep_write_cb() Stored CEP value
in
the database
bluetoothd[16877]: src/gatt-database.c:database_add_cep() Created CEP
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:database_add_service() #database_add_service
bluetoothd[16877]: src/gatt-database.c:database_add_ccc() Created CCC
entry
for characteristic
bluetoothd[16877]: src/gatt-database.c:gatt_db_service_added() #gatt_db_service_added: GATT Service added to local database bluetoothd[16877]: src/gatt-database.c:client_ready_cb() GATT application
registered: :1.404:/
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180D
bluetoothd[16877]: src/advertising.c:parse_service_uuids() Adding
ServiceUUID: 180F
bluetoothd[16877]: src/advertising.c:parse_manufacturer_data() Adding
ManufacturerData for ffff
bluetoothd[16877]: src/advertising.c:parse_service_data() Adding ServiceData
for 9999
bluetoothd[16877]: src/advertising.c:refresh_advertisement() Refreshing
advertisement: /org/bluez/example/advertisement0 bluetoothd[16877]: src/advertising.c:add_adv_callback() Advertisement
registered: /org/bluez/example/advertisement0Quoted 4 lines
I start
./test/example-gatt-serveras a normal user. But Bluez does
not
seem to have any permission issue with it.Building from source I've seen something similar if I've used sudo for
the
make.To compile and install I use sudo for the install only:
make -j 4 && sudo make install
Quoted 135 lines
I am using 'BLE scanner' on Android to discover the GATT services. But
I
think the problem is coming from Bluez. When I connect the Android device
to
Bluez, I can see this log:bluetoothd[16877]: src/adapter.c:connected_callback() hci0 device 98:D6:F7:31:7B:0D connected
eir_len14 bluetoothd[16877]: src/gatt-database.c:connect_cb() New incoming BR/EDR
ATT
connection
bluetoothd[16877]: attrib/gattrib.c:g_attrib_ref()0x98cd908:
g_attrib_ref=1
bluetoothd[16877]: src/device.c:load_gatt_db() #load_gatt_db:
Restoring
98:D6:F7:31:7B:0D gatt database from file '/var/lib/bluetooth/5C:F3:70:6A:D9:3C/cache/98:D6:F7:31:7B:0D' bluetoothd[16877]: src/device.c:load_gatt_db_impl() #load_gatt_db_impl
bluetoothd[16877]: src/device.c:load_service() #load_service:
loading
service:0x0001, end:0x0005, uuid:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_service() #load_service:
loading
service:0x0014, end:0xffff, uuid:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0002, value handle:0x0003, properties0x0020uuid:
00002a05-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0015, value handle:0x0016, properties0x0002uuid:
00002a00-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_chrc() loading characteristic handle:0x0017, value handle:0x0018, properties0x0002uuid:
00002a01-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:load_gatt_db() List GATT Primaries before
being free:
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001801-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:print_primary() - Primary UUID:
00001800-0000-1000-8000-00805f9b34fb
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: profiles/gap/gas.c:gap_accept() GAP profile accept
(98:D6:F7:31:7B:0D)
bluetoothd[16877]: src/service.c:change_state()0x98c98e0: device 98:D6:F7:31:7B:0D profile gap-profile state changed: disconnected ->
connected (0)
bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_connected() Device
connected.
bluetoothd[16877]: src/device.c:gatt_server_init() #gatt_server_init
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found:
2
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() Registered handler for "Service
Changed": 0
bluetoothd[16877]: src/device.c:gatt_client_ready_cb() status:
success,
error: 0
bluetoothd[16877]: src/device.c:register_gatt_services() #register_gatt_services
bluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_primary() #add_primarybluetoothd[16877]: src/device.c:add_gatt_service() #add_gatt_service:
UUID:00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/gatt-client.c:btd_gatt_client_ready() GATT client
ready
bluetoothd[16877]: src/gatt-client.c:create_services() Exporting objects
for
GATT services: 98:D6:F7:31:7B:0D
bluetoothd[16877]: src/gatt-client.c:service_create() Exported GATT service:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001 bluetoothd[16877]: src/gatt-client.c:characteristic_create() Exported
GATT
characteristic:
/org/bluez/hci0/dev_98_D6_F7_31_7B_0D/service0001/char0002 bluetoothd[16877]: src/device.c:device_svc_resolved() /org/bluez/hci0/dev_98_D6_F7_31_7B_0D err 0 bluetoothd[16877]: src/device.c:store_gatt_db() #store_gatt_dbbluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: src/device.c:store_service() #store_servicebluetoothd[16877]: profiles/gap/gas.c:read_device_name_cb() GAP Device
Name:
Nexus 4
bluetoothd[16877]: profiles/gap/gas.c:read_appearance_cb() GAP Appearance:0x0000I also reduced DBus 'TestAdvertisement' interface to only expose one
GATT
Service as many BLE adapter got a limitation in the size of the advertisement packet:
class TestAdvertisement(Advertisement):def __init__(self, bus, index): Advertisement.__init__(self, bus, index, 'peripheral') #self.add_service_uuid('180D') # HeartRate self.add_service_uuid('180F') # Battery #self.add_manufacturer_data(0xffff, [0x00, 0x01, 0x02, 0x03, 0x04]) #self.add_service_data('9999', [0x00, 0x01, 0x02,
0x03,0x04])
self.include_tx_power = TrueMy concern is mainly these lines:
Quoted 10 lines
bluetoothd[16877]: src/device.c:gatt_debug() Primary services found:
2
bluetoothd[16877]: src/device.c:gatt_debug() start:0x0001, end:0x0005,
uuid: 00001801-0000-1000-8000-00805f9b34fb bluetoothd[16877]: src/device.c:gatt_debug() start:0x0014, end:0xffff,
uuid: 00001800-0000-1000-8000-00805f9b34fbI've seen this kind of error message when I've had a failure of a previous script and the Bluetooth daemon is in some unknown state. At
this point it is worth restarting the bluetooth service with:
sudo service bluetooth restartYou will see in the advertising DBus API documentation that it is still in experimental mode in 5.44.
https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/advertising-api.txt#n78
This means that you need to make sure bluetoothd is started in experimental mode. Have you done this?
You can check with "sudo service bluetooth status"Experimental can be switched on by default in the bluetooth.service file
Edit
/lib/systemd/system/bluetooth.servicefile to add --experimental
flag
e.g:sudo sed -i '/^ExecStart.*bluetoothd\s*$/ s/$/ --experimental/'
/lib/systemd/system/bluetooth.serviceQuoted 19 lines
I have not found the code that export GATT Services from GATT Database
to
the BLE central.From my search on Internet, it looks I am not the only one who is having
this issue
I am happy to share/test anything that could help to make some progress.Thanks,
Olivier
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html