* Fwd: GATT server example issues in BlueZ [not found] <CAHrp-j-pSj5kymb95W7dKPgqcq8eyvf_QzuwK2zaziDcOErTaA@mail.gmail.com> @ 2016-03-02 11:16 ` Ivan Deviatkin 2016-03-02 13:50 ` Luiz Augusto von Dentz 0 siblings, 1 reply; 9+ messages in thread From: Ivan Deviatkin @ 2016-03-02 11:16 UTC (permalink / raw) To: linux-bluetooth [-- Attachment #1: Type: text/plain, Size: 3114 bytes --] Dears, I am working on GATT server application and would like to use BlueZ for that. Unfortunately, I have faced different issues during trying to establish working GATT server from examples provided by Bluez. First of all, I have tried to run gatt_example plugin from Bluez package in Ubuntu environment (14.04 LTS 32 bit and 15.10 64 bit). For that I have rebuild from source 5.37 (Ubuntu 14.04, default BlueZ - 4.x) and 5.35 (Ubuntu 15.10 - default Bluez 5.35) with: $ ./configure --prefix=/usr --mandir=/usr/share/man --sysconfdir=/etc --localstatedir=/var --enable-experimental --enable-debug --enable-maintainer-mode --with-systemdsystemunitdir=/lib/systemd/system --with-systemduserunitdir=/usr/lib/systemd And I have ran "bluetoothd" (previously configured my Bluetooth dongle Cirago BTA8000) via: $ sudo ./bluetoothd --plugin=gatt_example -nEd To communicate to my Linux environment I have used Android Nexus 6 with "BLE Scanner" application (I have checked also with other applications - result the same). However it works as expected only for version 5.27. Starting from 5.28 till latest 5.37 it does not work to me. Logs shows issue: "Not enough free handles to register service" (See logs attached). It looks similar to one mentioned here - http://stackoverflow.com/questions/29891254/bluez-5-30-not-enough-free-handles-to-register-service-error-in-starting-blue. I have checked this link, and can see, that method which adding servers to "servers glist" btd_adapter_gatt_server_start() is called in 5.27 but not called in 5.37 at all. Additionally I have checked python example "example-gatt-server" from \tests - it reports that GATT server is running but in bluetoothd logs still the same issue. Also I have tried to work with BlueZ D-Bus interface (experimental) but I can see that some methods used during registering of external service via D-Bus are not fully implemented yet, see example (bluez 5.37/tools/gatt_service, line 414): “ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, "{sv}", &dict); /* TODO: Add options dictionary */ <-- it means what it is not finished, right? ” It seems to me, that without passing dictionary it is impossible to register external service. Because dictionary includes information about characteristics of service. May I kindly ask you to clarify to me next: - Should I apply manual fix (call of btd_adapter_gatt_server_start() method or some other way of adding server to list) for that in Bluez 5.37 source? If "yes" what is the proper place to do that from design point of view? - What is recommended (and working) example in BlueZ package to run GATT server? - What is recommended code to follow as example/sample for my own GATT server application? - If I would like to participate in development of BlueZ (http://git.kernel.org/cgit/bluetooth/bluez.git) who is the right person to get latest GATT serevr status and ask design questions, to apply fixes in proper place? BR, Ivan [-- Attachment #2: log.log --] [-- Type: application/octet-stream, Size: 10755 bytes --] ideviatkin@ideviatkin:/usr/libexec/bluetooth$ hciconfig hci0: Type: BR/EDR Bus: USB BD Address: 80:00:0B:BD:1C:E8 ACL MTU: 310:10 SCO MTU: 64:8 DOWN RX bytes:1280 acl:0 sco:0 events:82 errors:0 TX bytes:2199 acl:0 sco:0 commands:82 errors:0 ideviatkin@ideviatkin:/usr/libexec/bluetooth$ sudo hciconfig hci0 reset ideviatkin@ideviatkin:/usr/libexec/bluetooth$ sudo hciconfig hci0 pscan ideviatkin@ideviatkin:/usr/libexec/bluetooth$ sudo hciconfig hci0 leadv ideviatkin@ideviatkin:/usr/libexec/bluetooth$ hciconfig hci0: Type: BR/EDR Bus: USB BD Address: 80:00:0B:BD:1C:E8 ACL MTU: 310:10 SCO MTU: 64:8 UP RUNNING PSCAN RX bytes:1908 acl:0 sco:0 events:121 errors:0 TX bytes:2927 acl:0 sco:0 commands:121 errors:0 ideviatkin@ideviatkin:/usr/libexec/bluetooth$ sudo ./bluetoothd --plugin=gatt_example -nEd bluetoothd[1961]: Bluetooth daemon 5.35 bluetoothd[1961]: src/main.c:parse_config() parsing main.conf bluetoothd[1961]: src/main.c:parse_config() Key file does not have key 'DiscoverableTimeout' in group 'General' bluetoothd[1961]: src/main.c:parse_config() Key file does not have key 'PairableTimeout' in group 'General' bluetoothd[1961]: src/main.c:parse_config() Key file does not have key 'AutoConnectTimeout' in group 'General' bluetoothd[1961]: src/main.c:parse_config() Key file does not have key 'Name' in group 'General' bluetoothd[1961]: src/main.c:parse_config() Key file does not have key 'Class' in group 'General' bluetoothd[1961]: src/main.c:parse_config() Key file does not have key 'DeviceID' in group 'General' bluetoothd[1961]: src/main.c:parse_config() Key file does not have key 'ReverseServiceDiscovery' in group 'General' bluetoothd[1961]: src/adapter.c:adapter_init() sending read version command bluetoothd[1961]: Starting SDP server bluetoothd[1961]: src/sdpd-service.c:register_device_id() Adding device id record for 0002:1d6b:0246:0523 bluetoothd[1961]: src/plugin.c:plugin_init() Loading builtin plugins bluetoothd[1961]: Ignoring (cli) hostname bluetoothd[1961]: Ignoring (cli) wiimote bluetoothd[1961]: Ignoring (cli) autopair bluetoothd[1961]: Ignoring (cli) policy bluetoothd[1961]: src/plugin.c:add_plugin() Loading gatt_example plugin bluetoothd[1961]: Ignoring (cli) neard bluetoothd[1961]: Ignoring (cli) sap bluetoothd[1961]: Ignoring (cli) a2dp bluetoothd[1961]: Ignoring (cli) avrcp bluetoothd[1961]: Ignoring (cli) network bluetoothd[1961]: Ignoring (cli) input bluetoothd[1961]: Ignoring (cli) hog bluetoothd[1961]: Ignoring (cli) health bluetoothd[1961]: Ignoring (cli) gap bluetoothd[1961]: Ignoring (cli) scanparam bluetoothd[1961]: Ignoring (cli) deviceinfo bluetoothd[1961]: Ignoring (cli) alert bluetoothd[1961]: Ignoring (cli) time bluetoothd[1961]: Ignoring (cli) proximity bluetoothd[1961]: Ignoring (cli) thermometer bluetoothd[1961]: Ignoring (cli) heartrate bluetoothd[1961]: Ignoring (cli) cyclingspeed bluetoothd[1961]: src/plugin.c:plugin_init() Loading plugins /home/ideviatkin/projects/bluez-5.35/plugins/.libs bluetoothd[1961]: Ignoring (cli) external_dummy bluetoothd[1961]: src/main.c:main() Entering main loop bluetoothd[1961]: src/rfkill.c:rfkill_event() RFKILL event idx 0 type 2 op 0 soft 0 hard 0 bluetoothd[1961]: Bluetooth management interface 1.10 initialized bluetoothd[1961]: src/adapter.c:read_version_complete() sending read supported commands command bluetoothd[1961]: src/adapter.c:read_version_complete() sending read index list command bluetoothd[1961]: src/adapter.c:read_commands_complete() Number of commands: 61 bluetoothd[1961]: src/adapter.c:read_commands_complete() Number of events: 34 bluetoothd[1961]: src/adapter.c:read_commands_complete() enabling kernel-side connection control bluetoothd[1961]: src/adapter.c:read_index_list_complete() Number of controllers: 1 bluetoothd[1961]: src/adapter.c:read_index_list_complete() Found index 0 bluetoothd[1961]: src/adapter.c:index_added() index 0 bluetoothd[1961]: src/adapter.c:btd_adapter_new() System name: BlueZ 5.35 bluetoothd[1961]: src/adapter.c:btd_adapter_new() Major class: 0 bluetoothd[1961]: src/adapter.c:btd_adapter_new() Minor class: 0 bluetoothd[1961]: src/adapter.c:btd_adapter_new() Modalias: usb:v1D6Bp0246d0523 bluetoothd[1961]: src/adapter.c:btd_adapter_new() Discoverable timeout: 180 seconds bluetoothd[1961]: src/adapter.c:btd_adapter_new() Pairable timeout: 0 seconds bluetoothd[1961]: src/adapter.c:index_added() sending read info command for index 0 bluetoothd[1961]: src/adapter.c:read_info_complete() index 0 status 0x00 bluetoothd[1961]: src/adapter.c:clear_uuids() sending clear uuids command for index 0 bluetoothd[1961]: src/adapter.c:clear_devices() sending clear devices command for index 0 bluetoothd[1961]: src/gatt-database.c:btd_gatt_database_new() GATT Manager registered for adapter: /org/bluez/hci0 bluetoothd[1961]: src/adapter.c:adapter_service_add() /org/bluez/hci0 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10001 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000007-0000-1000-8000-00805f9 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001800-0000-1000-8000-00805f9 bluetoothd[1961]: src/adapter.c:adapter_service_insert() /org/bluez/hci0 bluetoothd[1961]: src/adapter.c:add_uuid() sending add uuid command for index 0 bluetoothd[1961]: src/gatt-database.c:gatt_db_service_added() GATT Service added to local database bluetoothd[1961]: Failed to obtain handles for "Service Changed" characteristic bluetoothd[1961]: src/adapter.c:adapter_service_add() /org/bluez/hci0 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10002 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000007-0000-1000-8000-00805f9 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001801-0000-1000-8000-00805f9 bluetoothd[1961]: src/adapter.c:adapter_service_insert() /org/bluez/hci0 bluetoothd[1961]: src/adapter.c:add_uuid() sending add uuid command for index 0 bluetoothd[1961]: src/gatt-database.c:gatt_db_service_added() GATT Service added to local database bluetoothd[1961]: src/advertising.c:btd_advertising_manager_new() LE Advertising Manager created for adapter: /org/bluez/hci0 bluetoothd[1961]: Not enough free handles to register service bluetoothd[1961]: plugins/gatt-example.c:gatt_example_adapter_probe() Battery service could not be registered bluetoothd[1961]: gatt-example-adapter-driver: Input/output error (5) bluetoothd[1961]: src/adapter.c:btd_adapter_unblock_address() hci0 00:00:00:00:00:00 bluetoothd[1961]: src/adapter.c:get_ltk_info() 5C:51:88:A3:D8:F7 bluetoothd[1961]: src/device.c:device_create_from_storage() address 5C:51:88:A3:D8:F7 bluetoothd[1961]: src/device.c:device_new() address 5C:51:88:A3:D8:F7 bluetoothd[1961]: src/device.c:device_new() Creating device /org/bluez/hci0/dev_5C_51_88_A3_D8_F7 bluetoothd[1961]: src/device.c:btd_device_set_temporary() temporary 0 bluetoothd[1961]: src/adapter.c:load_link_keys() hci0 keys 0 debug_keys 0 bluetoothd[1961]: src/adapter.c:load_ltks() hci0 keys 0 bluetoothd[1961]: src/adapter.c:load_irks() hci0 irks 0 bluetoothd[1961]: src/adapter.c:load_conn_params() hci0 conn params 0 bluetoothd[1961]: src/device.c:device_probe_profiles() Probing profiles for device 5C:51:88:A3:D8:F7 bluetoothd[1961]: src/adapter.c:load_connections() sending get connections command for index 0 bluetoothd[1961]: src/adapter.c:adapter_service_insert() /org/bluez/hci0 bluetoothd[1961]: src/adapter.c:add_uuid() sending add uuid command for index 0 bluetoothd[1961]: src/adapter.c:set_did() hci0 source 2 vendor 1d6b product 246 version 523 bluetoothd[1961]: src/adapter.c:adapter_register() Adapter /org/bluez/hci0 registered bluetoothd[1961]: src/adapter.c:set_dev_class() sending set device class command for index 0 bluetoothd[1961]: src/adapter.c:set_name() sending set local name command for index 0 bluetoothd[1961]: src/adapter.c:set_mode() sending set mode command for index 0 bluetoothd[1961]: src/adapter.c:adapter_start() adapter /org/bluez/hci0 has been enabled bluetoothd[1961]: src/adapter.c:trigger_passive_scanning() bluetoothd[1961]: src/adapter.c:add_whitelist_complete() 5C:51:88:A3:D8:F7 added to kernel whitelist bluetoothd[1961]: src/adapter.c:load_link_keys_complete() link keys loaded for hci0 bluetoothd[1961]: src/adapter.c:load_ltks_complete() LTKs loaded for hci0 bluetoothd[1961]: src/adapter.c:load_irks_complete() IRKs loaded for hci0 bluetoothd[1961]: src/adapter.c:load_conn_params_complete() Connection Parameters loaded for hci0 bluetoothd[1961]: src/adapter.c:get_connections_complete() Connection count: 0 bluetoothd[1961]: src/profile.c:register_profile() sender :1.50 bluetoothd[1961]: src/profile.c:create_ext() Created "Headset Voice gateway" bluetoothd[1961]: src/profile.c:ext_adapter_probe() "Headset Voice gateway" probed bluetoothd[1961]: src/profile.c:ext_start_servers() Headset Voice gateway listening on chan 12 bluetoothd[1961]: src/adapter.c:adapter_service_add() /org/bluez/hci0 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10003 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000003-0000-1000-8000-00805f9 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001108-0000-1000-8000-00805f9 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001112-0000-1000-8000-00805f9 bluetoothd[1961]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001203-0000-1000-8000-00805f9 bluetoothd[1961]: src/adapter.c:adapter_service_insert() /org/bluez/hci0 bluetoothd[1961]: src/adapter.c:add_uuid() sending add uuid command for index 0 bluetoothd[1961]: src/adapter.c:new_settings_callback() Settings: 0x00000ad1 bluetoothd[1961]: src/adapter.c:settings_changed() Changed settings: 0x00000002 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GATT server example issues in BlueZ 2016-03-02 11:16 ` Fwd: GATT server example issues in BlueZ Ivan Deviatkin @ 2016-03-02 13:50 ` Luiz Augusto von Dentz 2016-03-02 20:42 ` Kurt McAlpine 2016-03-03 11:11 ` Ivan Deviatkin 0 siblings, 2 replies; 9+ messages in thread From: Luiz Augusto von Dentz @ 2016-03-02 13:50 UTC (permalink / raw) To: Ivan Deviatkin; +Cc: linux-bluetooth@vger.kernel.org Hi Ivan, On Wed, Mar 2, 2016 at 1:16 PM, Ivan Deviatkin <devyatkin.ivan@gmail.com> wrote: > Additionally I have checked python example "example-gatt-server" > from \tests - it reports that GATT server is running but in bluetoothd > logs still the same issue. So you don't see something like this: ./example-gatt-server GetManagedObjects GATT application registered bluetoothd[16205]: src/gatt-database.c:manager_register_app() Registering application: :1.603:/ bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service0, iface: org.bluez.GattService1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service0/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service0/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service0/char2, iface: org.bluez.GattCharacteristic1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service1, iface: org.bluez.GattService1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service1/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service2, iface: org.bluez.GattService1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service2/char0, iface: org.bluez.GattCharacteristic1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service2/char0/desc0, iface: org.bluez.GattDescriptor1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service2/char0/desc1, iface: org.bluez.GattDescriptor1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service2/char1, iface: org.bluez.GattCharacteristic1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service2/char1/desc2, iface: org.bluez.GattDescriptor1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /org/bluez/example/service2/char1/desc3, iface: org.bluez.GattDescriptor1 bluetoothd[16205]: src/gatt-database.c:database_add_ccc() Created CCC entry for characteristic bluetoothd[16205]: src/gatt-database.c:gatt_db_service_added() GATT Service added to local database bluetoothd[16205]: src/gatt-database.c:database_add_ccc() Created CCC entry for characteristic bluetoothd[16205]: src/gatt-database.c:gatt_db_service_added() GATT Service added to local database bluetoothd[16205]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database bluetoothd[16205]: src/gatt-database.c:database_add_cep() Created CEP entry for characteristic bluetoothd[16205]: src/gatt-database.c:cep_write_cb() Stored CEP value in the database bluetoothd[16205]: src/gatt-database.c:database_add_cep() Created CEP entry for characteristic bluetoothd[16205]: src/gatt-database.c:gatt_db_service_added() GATT Service added to local database bluetoothd[16205]: src/gatt-database.c:client_ready_cb() GATT application registered: :1.603:/ > Also I have tried to work with BlueZ D-Bus interface > (experimental) but I can see that some methods used during registering > of external service via D-Bus are not fully implemented yet, see > example (bluez 5.37/tools/gatt_service, line 414): > “ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, > "{sv}", &dict); > /* TODO: Add options dictionary */ <-- it means what it > is not finished, right? > ” > It seems to me, that without passing dictionary it is impossible > to register external service. Because dictionary includes information > about characteristics of service. Also works just fine: ./gatt-service gatt-service unique name: :1.604 Registered service: /service1 Get Primary: True Get UUID: 00001802-0000-1000-8000-00805f9b34fb Exist Includes: 00001802-0000-1000-8000-00805f9b34fb Characteristic(00002a06-0000-1000-8000-00805f9b34fb): Get("Value") Descriptor(8260c653-1a54-426b-9e36-e84c238bc669): Get("Value") Get Primary: True Get UUID: 00001802-0000-1000-8000-00805f9b34fb Exist Includes: 00001802-0000-1000-8000-00805f9b34fb Characteristic(00002a06-0000-1000-8000-00805f9b34fb): Get("Value") Descriptor(8260c653-1a54-426b-9e36-e84c238bc669): Get("Value") RegisterApplication: OK bluetoothd[16205]: src/gatt-database.c:manager_register_app() Registering application: :1.604:/ bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /service1, iface: org.bluez.GattService1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /service1/characteristic1, iface: org.bluez.GattCharacteristic1 bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: path: /service1/characteristic1/descriptor2, iface: org.bluez.GattDescriptor1 bluetoothd[16205]: src/gatt-database.c:gatt_db_service_added() GATT Service added to local database bluetoothd[16205]: src/gatt-database.c:client_ready_cb() GATT application registered: :1.604:/ > May I kindly ask you to clarify to me next: > - Should I apply manual fix (call of > btd_adapter_gatt_server_start() method or some other way of adding > server to list) for that in Bluez 5.37 source? If "yes" what is the > proper place to do that from design point of view? Nope, just use the D-Bus API, perhaps you are missing some fixes upstream if so just use the latest git version. > - What is recommended (and working) example in BlueZ package to > run GATT server? Both python and C example should actually work, the tricky part is making Android not to attempt to connect over BR/EDR once it realize you are running in dual mode which is usually the case, if you connect using another BlueZ it should work just fine. > - What is recommended code to follow as example/sample for my own > GATT server application? That will probably depend on the D-Bus library and language you intend to use, we actually still have some problems with bindings that don't maintain the order of objects, but I believe I should have a fix for that pretty soon/ > - If I would like to participate in development of BlueZ > (http://git.kernel.org/cgit/bluetooth/bluez.git) who is the right > person to get latest GATT serevr status and ask design questions, to > apply fixes in proper place? I probably should be that person, but other individuals in the mailing list should be able to help as well, btw you could just figure this by looking at the git history but it seems you don't even have cloned the git tree. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GATT server example issues in BlueZ 2016-03-02 13:50 ` Luiz Augusto von Dentz @ 2016-03-02 20:42 ` Kurt McAlpine 2016-03-03 9:34 ` Luiz Augusto von Dentz 2016-03-03 11:24 ` Ivan Deviatkin 2016-03-03 11:11 ` Ivan Deviatkin 1 sibling, 2 replies; 9+ messages in thread From: Kurt McAlpine @ 2016-03-02 20:42 UTC (permalink / raw) To: Luiz Augusto von Dentz; +Cc: devyatkin.ivan, linux-bluetooth Hi Luiz, I too am having some with BlueZ 5.37 from git (I pulled today). On Wed, Mar 02, 2016 at 03:50:50PM +0200, Luiz Augusto von Dentz wrote: > Hi Ivan, > > On Wed, Mar 2, 2016 at 1:16 PM, Ivan Deviatkin <devyatkin.ivan@gmail.com> wrote: > > Additionally I have checked python example "example-gatt-server" > > from \tests - it reports that GATT server is running but in bluetoothd > > logs still the same issue. > > So you don't see something like this: > > > ./example-gatt-server > GetManagedObjects > GATT application registered > > bluetoothd[16205]: src/gatt-database.c:manager_register_app() > Registering application: :1.603:/ > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service0, iface: org.bluez.GattService1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service0/char0, iface: > org.bluez.GattCharacteristic1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service0/char1, iface: > org.bluez.GattCharacteristic1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service0/char2, iface: > org.bluez.GattCharacteristic1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service1, iface: org.bluez.GattService1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service1/char0, iface: > org.bluez.GattCharacteristic1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service2, iface: org.bluez.GattService1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service2/char0, iface: > org.bluez.GattCharacteristic1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service2/char0/desc0, iface: > org.bluez.GattDescriptor1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service2/char0/desc1, iface: > org.bluez.GattDescriptor1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service2/char1, iface: > org.bluez.GattCharacteristic1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service2/char1/desc2, iface: > org.bluez.GattDescriptor1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /org/bluez/example/service2/char1/desc3, iface: > org.bluez.GattDescriptor1 > bluetoothd[16205]: src/gatt-database.c:database_add_ccc() Created CCC > entry for characteristic > bluetoothd[16205]: src/gatt-database.c:gatt_db_service_added() GATT > Service added to local database > bluetoothd[16205]: src/gatt-database.c:database_add_ccc() Created CCC > entry for characteristic > bluetoothd[16205]: src/gatt-database.c:gatt_db_service_added() GATT > Service added to local database > bluetoothd[16205]: src/gatt-database.c:cep_write_cb() Stored CEP value > in the database > bluetoothd[16205]: src/gatt-database.c:database_add_cep() Created CEP > entry for characteristic > bluetoothd[16205]: src/gatt-database.c:cep_write_cb() Stored CEP value > in the database > bluetoothd[16205]: src/gatt-database.c:database_add_cep() Created CEP > entry for characteristic > bluetoothd[16205]: src/gatt-database.c:gatt_db_service_added() GATT > Service added to local database > bluetoothd[16205]: src/gatt-database.c:client_ready_cb() GATT > application registered: :1.603:/ I do see this but my android device cannot discover the GATT service within the app. It is possible to pair with it, but not discover the services or even the device within the app. I've tired "Bluetooth LE Scanner" and nRF Master Control Panel" Ivan if you have any success with this could you let me know how you did it? Thanks, Kurt ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GATT server example issues in BlueZ 2016-03-02 20:42 ` Kurt McAlpine @ 2016-03-03 9:34 ` Luiz Augusto von Dentz 2016-03-03 9:46 ` Andrei Emeltchenko 2016-03-03 11:20 ` Ivan Deviatkin 2016-03-03 11:24 ` Ivan Deviatkin 1 sibling, 2 replies; 9+ messages in thread From: Luiz Augusto von Dentz @ 2016-03-03 9:34 UTC (permalink / raw) To: Kurt McAlpine; +Cc: Ivan Deviatkin, linux-bluetooth@vger.kernel.org Hi Kurt, Ivan, On Wed, Mar 2, 2016 at 10:42 PM, Kurt McAlpine <kurt@linux.com> wrote: > Hi Luiz, > > I too am having some with BlueZ 5.37 from git (I pulled today). > > On Wed, Mar 02, 2016 at 03:50:50PM +0200, Luiz Augusto von Dentz wrote: >> Hi Ivan, >> >> On Wed, Mar 2, 2016 at 1:16 PM, Ivan Deviatkin <devyatkin.ivan@gmail.com> wrote: >> > Additionally I have checked python example "example-gatt-server" >> > from \tests - it reports that GATT server is running but in bluetoothd >> > logs still the same issue. >> >> So you don't see something like this: >> >> >> ./example-gatt-server >> GetManagedObjects >> GATT application registered >> >> bluetoothd[16205]: src/gatt-database.c:manager_register_app() >> Registering application: :1.603:/ >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service0, iface: org.bluez.GattService1 >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service0/char0, iface: >> org.bluez.GattCharacteristic1 >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service0/char1, iface: >> org.bluez.GattCharacteristic1 >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service0/char2, iface: >> org.bluez.GattCharacteristic1 >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service1, iface: org.bluez.GattService1 >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service1/char0, iface: >> org.bluez.GattCharacteristic1 >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service2, iface: org.bluez.GattService1 >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service2/char0, iface: >> org.bluez.GattCharacteristic1 >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service2/char0/desc0, iface: >> org.bluez.GattDescriptor1 >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service2/char0/desc1, iface: >> org.bluez.GattDescriptor1 >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service2/char1, iface: >> org.bluez.GattCharacteristic1 >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service2/char1/desc2, iface: >> org.bluez.GattDescriptor1 >> bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: >> path: /org/bluez/example/service2/char1/desc3, iface: >> org.bluez.GattDescriptor1 >> bluetoothd[16205]: src/gatt-database.c:database_add_ccc() Created CCC >> entry for characteristic >> bluetoothd[16205]: src/gatt-database.c:gatt_db_service_added() GATT >> Service added to local database >> bluetoothd[16205]: src/gatt-database.c:database_add_ccc() Created CCC >> entry for characteristic >> bluetoothd[16205]: src/gatt-database.c:gatt_db_service_added() GATT >> Service added to local database >> bluetoothd[16205]: src/gatt-database.c:cep_write_cb() Stored CEP value >> in the database >> bluetoothd[16205]: src/gatt-database.c:database_add_cep() Created CEP >> entry for characteristic >> bluetoothd[16205]: src/gatt-database.c:cep_write_cb() Stored CEP value >> in the database >> bluetoothd[16205]: src/gatt-database.c:database_add_cep() Created CEP >> entry for characteristic >> bluetoothd[16205]: src/gatt-database.c:gatt_db_service_added() GATT >> Service added to local database >> bluetoothd[16205]: src/gatt-database.c:client_ready_cb() GATT >> application registered: :1.603:/ > > I do see this but my android device cannot discover the GATT service within the > app. It is possible to pair with it, but not discover the services or even the > device within the app. > > I've tired "Bluetooth LE Scanner" and nRF Master Control Panel" > > Ivan if you have any success with this could you let me know how you did it? Do you guys remember that you have to advertise to be able to connect: < HCI Command: LE Set Advertising Data (0x08|0x0008) plen 32 [hci0] 686245.066488 Length: 30 Flags: 0x06 LE General Discoverable Mode BR/EDR Not Supported 16-bit Service UUIDs (complete): 2 entries Heart Rate (0x180d) Battery Service (0x180f) Company: internal use (65535) Data: 0001020304 Service Data (UUID 0x9999): 0001020304 TX power: 9 dBm > HCI Event: Command Complete (0x0e) plen 4 [hci0] 686245.139564 LE Set Advertising Data (0x08|0x0008) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Scan Response Data (0x08|0x0009) plen 32 [hci0] 686245.139585 Length: 0 > HCI Event: Command Complete (0x0e) plen 4 [hci0] 686245.140582 LE Set Scan Response Data (0x08|0x0009) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Advertising Parameters (0x08|0x0006) plen 15 [hci0] 686245.140628 Min advertising interval: 1280.000 msec (0x0800) Max advertising interval: 1280.000 msec (0x0800) Type: Connectable undirected - ADV_IND (0x00) Own address type: Public (0x00) Direct address type: Public (0x00) Direct address: 00:00:00:00:00:00 (OUI 00-00-00) Channel map: 37, 38, 39 (0x07) Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00) > HCI Event: Command Complete (0x0e) plen 4 [hci0] 686245.141553 LE Set Advertising Parameters (0x08|0x0006) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1 [hci0] 686245.141563 Advertising: Enabled (0x01) > HCI Event: Command Complete (0x0e) plen 4 [hci0] 686245.142554 LE Set Advertise Enable (0x08|0x000a) ncmd 2 Status: Success (0x00) Even with this I couldn't manage to connect using Android, even though it can find it but there is nothing set as a name (possible a bug in our end), if I do enable BR/EDR than it attempts to connect over it (priceless!) instead of LE where it got the advertisement. -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GATT server example issues in BlueZ 2016-03-03 9:34 ` Luiz Augusto von Dentz @ 2016-03-03 9:46 ` Andrei Emeltchenko 2016-03-03 11:20 ` Ivan Deviatkin 1 sibling, 0 replies; 9+ messages in thread From: Andrei Emeltchenko @ 2016-03-03 9:46 UTC (permalink / raw) To: Luiz Augusto von Dentz Cc: Kurt McAlpine, Ivan Deviatkin, linux-bluetooth@vger.kernel.org Hi, On Thu, Mar 03, 2016 at 11:34:04AM +0200, Luiz Augusto von Dentz wrote: > > I do see this but my android device cannot discover the GATT service within the > > app. It is possible to pair with it, but not discover the services or even the > > device within the app. > > > > I've tired "Bluetooth LE Scanner" and nRF Master Control Panel" > > > > Ivan if you have any success with this could you let me know how you did it? > > Do you guys remember that you have to advertise to be able to connect: I do it with btmgmt: [mgmt]# advertising on hci0 Set Advertising complete, settings: powered bondable ssp br/edr le advertising secure-conn [mgmt]# connectable on hci0 Set Connectable complete, settings: powered connectable bondable ssp br/edr le advertising secure-conn Best regards Andrei Emeltchenko ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GATT server example issues in BlueZ 2016-03-03 9:34 ` Luiz Augusto von Dentz 2016-03-03 9:46 ` Andrei Emeltchenko @ 2016-03-03 11:20 ` Ivan Deviatkin 1 sibling, 0 replies; 9+ messages in thread From: Ivan Deviatkin @ 2016-03-03 11:20 UTC (permalink / raw) To: Luiz Augusto von Dentz; +Cc: Kurt McAlpine, linux-bluetooth@vger.kernel.org Hi Luiz, > On 3 March 2016 at 10:34, Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote: > Do you guys remember that you have to advertise to be able to connect: > > ... > > Even with this I couldn't manage to connect using Android, even though > it can find it but there is nothing set as a name (possible a bug in > our end), if I do enable BR/EDR than it attempts to connect over it > (priceless!) instead of LE where it got the advertisement. > I have setup my Bluetooth dongle via: " # activate bluetooth sudo hciconfig hci0 up sudo hciconfig hci0 pscan # set advertise data: "hello world" sudo hcitool -i hci0 cmd 0x08 0x0008 48 45 4c 4c 4f 57 4f 52 4c 44 # start advertising as connectable sudo hciconfig hci0 leadv " And it works OK (pairing, retrieveing of services list) for BlueZ 5.27 in connection to my Android phone, except issues with name of services. Is anything missed or should be done additionally for latest BlueZ? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GATT server example issues in BlueZ 2016-03-02 20:42 ` Kurt McAlpine 2016-03-03 9:34 ` Luiz Augusto von Dentz @ 2016-03-03 11:24 ` Ivan Deviatkin 2016-03-03 16:31 ` Luiz Augusto von Dentz 1 sibling, 1 reply; 9+ messages in thread From: Ivan Deviatkin @ 2016-03-03 11:24 UTC (permalink / raw) To: Kurt McAlpine; +Cc: Luiz Augusto von Dentz, linux-bluetooth Hi Kurt, > On 2 March 2016 at 21:42, Kurt McAlpine <kurt@linux.com> wrote: > Hi Luiz, > > I too am having some with BlueZ 5.37 from git (I pulled today). > > I do see this but my android device cannot discover the GATT service within the > app. It is possible to pair with it, but not discover the services or even the > device within the app. > > I've tired "Bluetooth LE Scanner" and nRF Master Control Panel" > > Ivan if you have any success with this could you let me know how you did it? Unfortunately I have cloned BlueZ today too and have exactly the same issues as you. I believe some more investigation and fixes are required to make it work. BR, Ivan ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GATT server example issues in BlueZ 2016-03-03 11:24 ` Ivan Deviatkin @ 2016-03-03 16:31 ` Luiz Augusto von Dentz 0 siblings, 0 replies; 9+ messages in thread From: Luiz Augusto von Dentz @ 2016-03-03 16:31 UTC (permalink / raw) To: Ivan Deviatkin; +Cc: Kurt McAlpine, linux-bluetooth@vger.kernel.org Hi Ivan, On Thu, Mar 3, 2016 at 1:24 PM, Ivan Deviatkin <devyatkin.ivan@gmail.com> wrote: > Hi Kurt, > >> On 2 March 2016 at 21:42, Kurt McAlpine <kurt@linux.com> wrote: >> Hi Luiz, >> >> I too am having some with BlueZ 5.37 from git (I pulled today). >> >> I do see this but my android device cannot discover the GATT service within the >> app. It is possible to pair with it, but not discover the services or even the >> device within the app. >> >> I've tired "Bluetooth LE Scanner" and nRF Master Control Panel" >> >> Ivan if you have any success with this could you let me know how you did it? > > Unfortunately I have cloned BlueZ today too and have exactly the > same issues as you. > I believe some more investigation and fixes are required to make it work. > After removing the device, turn off/on the bluetooth, discover the device using Android UI and then connecting using nRF master, or whatever else since this apparently is bluedroid fault, this is the outcome http://ix.io/oMm It does connects, we do start sending responses but as soon as we send any ATT request ourselves Bluedroid just seems unable to send any request anymore. The spec is quite clear that we can send request as well regardless if we are the peripheral or not, perhaps we can disable our discovery when acting as a peripheral but not all profiles have the GAP Peripheral must be the GATT server only and it is too bad the test specification actually don't test this because now there are probably a ton of Android devices just broken in this regard. -- Luiz Augusto von Dentz ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: GATT server example issues in BlueZ 2016-03-02 13:50 ` Luiz Augusto von Dentz 2016-03-02 20:42 ` Kurt McAlpine @ 2016-03-03 11:11 ` Ivan Deviatkin 1 sibling, 0 replies; 9+ messages in thread From: Ivan Deviatkin @ 2016-03-03 11:11 UTC (permalink / raw) To: Luiz Augusto von Dentz; +Cc: linux-bluetooth@vger.kernel.org Hi Luiz, Thanks for fast reply and interesting details from your side. Please find my explanations and questions below. On 2 March 2016 at 14:50, Luiz Augusto von Dentz <luiz.dentz@gmail.com> wrote: > Hi Ivan, > > On Wed, Mar 2, 2016 at 1:16 PM, Ivan Deviatkin <devyatkin.ivan@gmail.com> wrote: >> Additionally I have checked python example "example-gatt-server" >> from \tests - it reports that GATT server is running but in bluetoothd >> logs still the same issue. > > So you don't see something like this: > > > ./example-gatt-server > GetManagedObjects > GATT application registered > ... > Service added to local database > bluetoothd[16205]: src/gatt-database.c:client_ready_cb() GATT > application registered: :1.603:/ I have seen "GATT server registered" in console for "example-gatt-server" in BlueZ 5.37 - but that fact does not mean that service is visible and available on my Android Phone (Motorola Nexus 6, Android 5.1, LMY47I) via BLE Scanner, Bluetooth LE Scanner or BLE Reader. I have seen a little bit different logs for bluetoothd, but I think it is mainly because of using releases, not git upstream code. > > >> Also I have tried to work with BlueZ D-Bus interface >> (experimental) but I can see that some methods used during registering >> of external service via D-Bus are not fully implemented yet, see >> example (bluez 5.37/tools/gatt_service, line 414): >> “ dbus_message_iter_open_container(&iter, DBUS_TYPE_ARRAY, >> "{sv}", &dict); >> /* TODO: Add options dictionary */ <-- it means what it >> is not finished, right? >> ” >> It seems to me, that without passing dictionary it is impossible >> to register external service. Because dictionary includes information >> about characteristics of service. > > Also works just fine: > > ./gatt-service > gatt-service unique name: :1.604 > Registered service: /service1 > Get Primary: True > Get UUID: 00001802-0000-1000-8000-00805f9b34fb > Exist Includes: 00001802-0000-1000-8000-00805f9b34fb > Characteristic(00002a06-0000-1000-8000-00805f9b34fb): Get("Value") > Descriptor(8260c653-1a54-426b-9e36-e84c238bc669): Get("Value") > Get Primary: True > Get UUID: 00001802-0000-1000-8000-00805f9b34fb > Exist Includes: 00001802-0000-1000-8000-00805f9b34fb > Characteristic(00002a06-0000-1000-8000-00805f9b34fb): Get("Value") > Descriptor(8260c653-1a54-426b-9e36-e84c238bc669): Get("Value") > RegisterApplication: OK > > bluetoothd[16205]: src/gatt-database.c:manager_register_app() > Registering application: :1.604:/ > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /service1, iface: org.bluez.GattService1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /service1/characteristic1, iface: org.bluez.GattCharacteristic1 > bluetoothd[16205]: src/gatt-database.c:proxy_added_cb() Object added: > path: /service1/characteristic1/descriptor2, iface: > org.bluez.GattDescriptor1 > bluetoothd[16205]: src/gatt-database.c:gatt_db_service_added() GATT > Service added to local database > bluetoothd[16205]: src/gatt-database.c:client_ready_cb() GATT > application registered: :1.604:/ > As I noticed above - I am afraid that logs from BlueZ by itself does not mean that it works as it should. I have checked DBus interfaces via d-feet and dbus-monitor. And as it was mentioned before - it was empty to me. I have checked that on "example-gatt-server" - because it uses DBus to register services. >> May I kindly ask you to clarify to me next: >> - Should I apply manual fix (call of >> btd_adapter_gatt_server_start() method or some other way of adding >> server to list) for that in Bluez 5.37 source? If "yes" what is the >> proper place to do that from design point of view? > > Nope, just use the D-Bus API, perhaps you are missing some fixes > upstream if so just use the latest git version. > I think it makes sense to check this issue, because check of server list to NULL is done through a code in Bluez, but adding to that list only in one place - method "btd_adapter_gatt_server_start()". And this method is not called anywhere in BlueZ 5.37. >> - What is recommended (and working) example in BlueZ package to >> run GATT server? > > Both python and C example should actually work, the tricky part is > making Android not to attempt to connect over BR/EDR once it realize > you are running in dual mode which is usually the case, if you connect > using another BlueZ it should work just fine. > Thanks for explanation. However, not clear - that do you mean by "over BR/EDR" in retrospective to my Android phone - I can't find any option to setup differently bluetooth. Actually my goal is to use usual Android phone to connect to Linux with Bluez using Bluetooth LE. I see that all examples BlueZ have right now not working to me and other users as they should - that is the problem to investigate and fix. Does BlueZ releases tested with devices on market with Android or iOS? Because to me using Linux BlueZ to connect another Linux Bluez seriously limitates it's usage. >> - If I would like to participate in development of BlueZ >> (http://git.kernel.org/cgit/bluetooth/bluez.git) who is the right >> person to get latest GATT serevr status and ask design questions, to >> apply fixes in proper place? > > I probably should be that person, but other individuals in the mailing > list should be able to help as well, btw you could just figure this > by looking at the git history but it seems you don't even have cloned > the git tree. Thank you for an explanation. A small remark - I have cloned the git tree and have seen your name. However in BlueZ guidelines strictly recommended to avoid direct contacts first ("Contact" section on BlueZ site). So for me it is only gentle way of communication - to avoid messy bothering of developers. BR, Ivan ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2016-03-03 16:31 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <CAHrp-j-pSj5kymb95W7dKPgqcq8eyvf_QzuwK2zaziDcOErTaA@mail.gmail.com>
2016-03-02 11:16 ` Fwd: GATT server example issues in BlueZ Ivan Deviatkin
2016-03-02 13:50 ` Luiz Augusto von Dentz
2016-03-02 20:42 ` Kurt McAlpine
2016-03-03 9:34 ` Luiz Augusto von Dentz
2016-03-03 9:46 ` Andrei Emeltchenko
2016-03-03 11:20 ` Ivan Deviatkin
2016-03-03 11:24 ` Ivan Deviatkin
2016-03-03 16:31 ` Luiz Augusto von Dentz
2016-03-03 11:11 ` Ivan Deviatkin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox