50ButtonsEach / fliclib-linux-dist

114 stars 19 forks source link

Connect/disconnect infinite loop #41

Open robertopierpaoli opened 8 years ago

robertopierpaoli commented 8 years ago

I'm running on Ubuntu Linux 15.10 32 bit, inside a Virtualbox VM. The BT4.0 dongle is an ASUS device providing a Broadcom BCM20702A0 module.

Library versions are:

To compete the compile phase and to run fliclib I had to install the further following packages:

I have built bluez 5.39 from sources, applying the two suggested options (enable-experimental, enable-library).

No other bluetooth service is running, since none is installed in the system.

This is how I have proceeded: 1) hciconfig -a hci0 reset

2) I have launched bluetoothd from the src directory $> ./bluetoothd -nEd

3) Through the interactive bluetoothctl shell: [bluetooth] power off [bluetooth] power on

4) From the i386 distibution folder $> ./daemon -l -f flic.sqlite3

5) Same as above, but in a different shell $> ./flic startScan (click on the button =>) Button discovered: 80:E4:DA:70:F2:0A (button pressed for 10s then released =>) connect 80:E4:DA:70:F2:0A

At this point a infinite loop of "connect" / "disconnect" has started.

I have attached some outputs as excerpt in txt files. They are also pasted below.

I don't get what I did wrong...

Any help?

Thanks in advance,

Roberto

btmon_excerpt.txt bluetoothctl_shell.txt bluetoothd.txt flic_client.txt flic_deamon.txt syslog_excerpt.txt

[btmon] ` @ Device Connected: 80:E4:DA:70:F2:0A (1) flags 0x0000 02 01 06 11 07 1b c5 d5 a5 02 00 dc 9e e4 11 e7 ................ 26 c0 df 2a f0 09 09 66 30 31 38 63 50 49 4b &..*...f018cPIK

HCI Event: Command Status (0x0f) plen 4 [hci0] 155.783300 LE Read Remote Used Features (0x08|0x0016) ncmd 1 Status: Success (0x00) HCI Event: LE Meta Event (0x3e) plen 12 [hci0] 155.959897 LE Read Remote Used Features (0x04) Status: Remote User Terminated Connection (0x13) Handle: 64 Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00 LE Encryption HCI Event: Disconnect Complete (0x05) plen 4 [hci0] 155.961853 Status: Success (0x00) Handle: 64 Reason: Remote User Terminated Connection (0x13) @ Device Disconnected: 80:E4:DA:70:F2:0A (1) reason 3 < HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7 [hci0] 155.983964 Type: Passive (0x00) Interval: 60.000 msec (0x0060) Window: 30.000 msec (0x0030) Own address type: Public (0x00) Filter policy: Ignore not in white list (0x01) HCI Event: Command Complete (0x0e) plen 4 [hci0] 155.985747 LE Set Scan Parameters (0x08|0x000b) ncmd 1 Status: Success (0x00) < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 [hci0] 155.986005 Scanning: Enabled (0x01) Filter duplicates: Enabled (0x01) HCI Event: Command Complete (0x0e) plen 4 [hci0] 155.991304 LE Set Scan Enable (0x08|0x000c) ncmd 1 Status: Success (0x00) HCI Event: LE Meta Event (0x3e) plen 43 [hci0] 156.001395 LE Advertising Report (0x02) Num reports: 1 Event type: Connectable undirected - ADV_IND (0x00) Address type: Public (0x00) Address: 80:E4:DA:70:F2:0A (OUI 80-E4-DA) Data length: 31 Flags: 0x06 LE General Discoverable Mode BR/EDR Not Supported 128-bit Service UUIDs (complete): 1 entry f02adfc0-26e7-11e4-9edc-0002a5d5c51b Name (complete): f018cPIK RSSI: -62 dBm (0xc2) < HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2 [hci0] 156.001667 Scanning: Disabled (0x00) Filter duplicates: Disabled (0x00) HCI Event: Command Complete (0x0e) plen 4 [hci0] 156.006302 LE Set Scan Enable (0x08|0x000c) ncmd 1 Status: Success (0x00) < HCI Command: LE Create Connection (0x08|0x000d) plen 25 [hci0] 156.006512 Scan interval: 60.000 msec (0x0060) Scan window: 30.000 msec (0x0030) Filter policy: White list is not used (0x00) Peer address type: Public (0x00) Peer address: 80:E4:DA:70:F2:0A (OUI 80-E4-DA) Own address type: Public (0x00) Min connection interval: 50.00 msec (0x0028) Max connection interval: 70.00 msec (0x0038) Connection latency: 0x0000 Supervision timeout: 420 msec (0x002a) Min connection length: 0.000 msec (0x0000) Max connection length: 0.000 msec (0x0000) HCI Event: Command Status (0x0f) plen 4 [hci0] 156.009295 LE Create Connection (0x08|0x000d) ncmd 1 Status: Success (0x00) HCI Event: LE Meta Event (0x3e) plen 19 [hci0] 156.024604 LE Connection Complete (0x01) Status: Success (0x00) Handle: 64 Role: Master (0x00) Peer address type: Public (0x00) Peer address: 80:E4:DA:70:F2:0A (OUI 80-E4-DA) Connection interval: 67.50 msec (0x0036) Connection latency: 0.00 msec (0x0000) Supervision timeout: 420 msec (0x002a) Master clock accuracy: 0x05 < HCI Command: LE Read Remote Used Features (0x08|0x0016) plen 2 [hci0] 156.025012 Handle: 64 `

[syslog] Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/gatt-database.c:profile_exited() ":1.17" exited Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/gatt-database.c:profile_remove() Removed ":1.17/org/flic/5C_F3_70_6A_D1_B1/f02adfc0-26e7-11e4-9edc-0002a5d5c51b" Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/service.c:change_state() 0x86a4120: device 80:E4:DA:70:F2:0A profile :1.17/org/flic/5C_F3_70_6A_D1_B1/f02adfc0-26e7-11e4-9edc-0002a5d5c51b state changed: connecting -> disconnected ( -103) Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/device.c:device_profile_connected() :1.17/org/flic/5C_F3_70_6A_D1_B1/f02adfc0-26e7-11e4-9edc-0002a5d5c51b Software caused connection abort (103) Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/service.c:change_state() 0x86a4120: device 80:E4:DA:70:F2:0A profile :1.17/org/flic/5C_F3_70_6A_D1_B1/f02adfc0-26e7-11e4-9edc-0002a5d5c51b state changed: disconnected -> unavailable (0) Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/gatt-database.c:profile_device_remove() :1.17/org/flic/5C_F3_70_6A_D1_B1/f02adfc0-26e7-11e4-9edc-0002a5d5c51b removed Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/service.c:btd_service_unref() 0x86a4120: ref=0 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:discovery_disconnect() owner :1.17 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:trigger_passive_scanning() Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:discovery_destroy() owner :1.17 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/device.c:device_set_rssi_with_delta() rssi 0 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: message repeated 3 times: [ src/device.c:device_set_rssi_with_delta() rssi 0] Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/device.c:device_set_tx_power() tx_power 127 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/device.c:device_set_rssi_with_delta() rssi 0 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:connected_callback() hci0 device 80:E4:DA:70:F2:0A connected eir_len 31 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:dev_disconnected() Device 80:E4:DA:70:F2:0A disconnected, reason 3 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:adapter_remove_connection() Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: plugins/policy.c:disconnect_cb() reason 3 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 80:E4:DA:70:F2:0A type 1 status 0xe Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/device.c:device_bonding_failed() status 14 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:resume_discovery() Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:connected_callback() hci0 device 80:E4:DA:70:F2:0A connected eir_len 31 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:dev_disconnected() Device 80:E4:DA:70:F2:0A disconnected, reason 3 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:adapter_remove_connection() Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: plugins/policy.c:disconnect_cb() reason 3 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 80:E4:DA:70:F2:0A type 1 status 0xe Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/device.c:device_bonding_failed() status 14 Apr 11 19:07:35 miniubuntu151032 bluetoothd[4667]: src/adapter.c:resume_discovery() Apr 11 19:07:36 miniubuntu151032 bluetoothd[4667]: src/adapter.c:connected_callback() hci0 device 80:E4:DA:70:F2:0A connected eir_len 31 Apr 11 19:07:36 miniubuntu151032 bluetoothd[4667]: src/adapter.c:dev_disconnected() Device 80:E4:DA:70:F2:0A disconnected, reason 3 Apr 11 19:07:36 miniubuntu151032 bluetoothd[4667]: src/adapter.c:adapter_remove_connection() Apr 11 19:07:36 miniubuntu151032 bluetoothd[4667]: plugins/policy.c:disconnect_cb() reason 3 Apr 11 19:07:36 miniubuntu151032 bluetoothd[4667]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 80:E4:DA:70:F2:0A type 1 status 0xe Apr 11 19:07:36 miniubuntu151032 bluetoothd[4667]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e Apr 11 19:07:36 miniubuntu151032 bluetoothd[4667]: src/device.c:device_bonding_failed() status 14 Apr 11 19:07:36 miniubuntu151032 bluetoothd[4667]: src/adapter.c:resume_discovery() ...

[client] startScan Button discovered: 80:E4:DA:70:F2:0A connect 80:E4:DA:70:F2:0A Connecting to: 80:E4:DA:70:F2:0A Disconnecting from: 80:E4:DA:70:F2:0A Disconnected from: 80:E4:DA:70:F2:0A Connecting to: 80:E4:DA:70:F2:0A Disconnecting from: 80:E4:DA:70:F2:0A Disconnected from: 80:E4:DA:70:F2:0A Connecting to: 80:E4:DA:70:F2:0A Disconnecting from: 80:E4:DA:70:F2:0A Disconnected from: 80:E4:DA:70:F2:0A Connecting to: 80:E4:DA:70:F2:0A Disconnecting from: 80:E4:DA:70:F2:0A Disconnected from: 80:E4:DA:70:F2:0A Connecting to: 80:E4:DA:70:F2:0A Disconnecting from: 80:E4:DA:70:F2:0A Disconnected from: 80:E4:DA:70:F2:0A Connecting to: 80:E4:DA:70:F2:0A Disconnecting from: 80:E4:DA:70:F2:0A Disconnected from: 80:E4:DA:70:F2:0A Connecting to: 80:E4:DA:70:F2:0A Disconnecting from: 80:E4:DA:70:F2:0A ...

[daemon] Button::gdBusDeviceSignalCallback, message received: PropertiesChanged [80:E4:DA:70:F2:0A] ('org.bluez.Device1', {'Connected': <true>}, @as []) [80:E4:DA:70:F2:0A] check [80:E4:DA:70:F2:0A] Disconnected -> Connecting [80:E4:DA:70:F2:0A] Button connecting [80:E4:DA:70:F2:0A] check [80:E4:DA:70:F2:0A] Button::gdBusDeviceSignalCallback, message received: PropertiesChanged [80:E4:DA:70:F2:0A] ('org.bluez.Device1', {'Connected': <false>}, @as []) [80:E4:DA:70:F2:0A] check [80:E4:DA:70:F2:0A] Connecting -> Disconnecting [80:E4:DA:70:F2:0A] Button disconnecting [80:E4:DA:70:F2:0A] close [80:E4:DA:70:F2:0A] cancelCalls [80:E4:DA:70:F2:0A] stopCharacteristics [80:E4:DA:70:F2:0A] check [80:E4:DA:70:F2:0A] Disconnecting -> Disconnected [80:E4:DA:70:F2:0A] Button disconnected [80:E4:DA:70:F2:0A] check [80:E4:DA:70:F2:0A] Button::gdBusDeviceSignalCallback, message received: PropertiesChanged [80:E4:DA:70:F2:0A] ('org.bluez.Device1', {'Connected': <true>, 'Name': <'f018cPIK'>, 'Alias': <'f018cPIK'>}, @as []) [80:E4:DA:70:F2:0A] check [80:E4:DA:70:F2:0A] Disconnected -> Connecting [80:E4:DA:70:F2:0A] Button connecting [80:E4:DA:70:F2:0A] check [80:E4:DA:70:F2:0A] Button::gdBusDeviceSignalCallback, message received: PropertiesChanged [80:E4:DA:70:F2:0A] ('org.bluez.Device1', {'Connected': <false>}, @as []) [80:E4:DA:70:F2:0A] check [80:E4:DA:70:F2:0A] Connecting -> Disconnecting [80:E4:DA:70:F2:0A] Button disconnecting [80:E4:DA:70:F2:0A] ...

[bluetoothctl shell] [CHG] Device 80:E4:DA:70:F2:0A Connected: yes [CHG] Device 80:E4:DA:70:F2:0A Connected: no [CHG] Device 80:E4:DA:70:F2:0A Connected: yes [CHG] Device 80:E4:DA:70:F2:0A Name: f018cPIK [CHG] Device 80:E4:DA:70:F2:0A Alias: f018cPIK [CHG] Device 80:E4:DA:70:F2:0A Connected: no [CHG] Device 80:E4:DA:70:F2:0A Connected: yes [CHG] Device 80:E4:DA:70:F2:0A Connected: no [CHG] Device 80:E4:DA:70:F2:0A Connected: yes [CHG] Device 80:E4:DA:70:F2:0A Connected: no [CHG] Device 80:E4:DA:70:F2:0A Connected: yes [CHG] Device 80:E4:DA:70:F2:0A Connected: no [CHG] Device 80:E4:DA:70:F2:0A Connected: yes [CHG] Device 80:E4:DA:70:F2:0A Connected: no [CHG] Device 80:E4:DA:70:F2:0A Connected: yes [CHG] Device 80:E4:DA:70:F2:0A Connected: no [CHG] Device 80:E4:DA:70:F2:0A Connected: yes [CHG] Device 80:E4:DA:70:F2:0A Connected: no [CHG] Device 80:E4:DA:70:F2:0A Connected: yes [CHG] Device 80:E4:DA:70:F2:0A Connected: no [CHG] Device 80:E4:DA:70:F2:0A Connected: yes [CHG] Device 80:E4:DA:70:F2:0A Connected: no [CHG] Device 80:E4:DA:70:F2:0A Connected: yes [CHG] Device 80:E4:DA:70:F2:0A Connected: no ...

[bluetoothd] bluetoothd[4667]: src/adapter.c:connected_callback() hci0 device 80:E4:DA:70:F2:0A connected eir_len 31 bluetoothd[4667]: src/adapter.c:dev_disconnected() Device 80:E4:DA:70:F2:0A disconnected, reason 3 bluetoothd[4667]: src/adapter.c:adapter_remove_connection() bluetoothd[4667]: plugins/policy.c:disconnect_cb() reason 3 bluetoothd[4667]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 80:E4:DA:70:F2:0A type 1 status 0xe bluetoothd[4667]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e bluetoothd[4667]: src/device.c:device_bonding_failed() status 14 bluetoothd[4667]: src/adapter.c:resume_discovery() bluetoothd[4667]: src/adapter.c:connected_callback() hci0 device 80:E4:DA:70:F2:0A connected eir_len 31 bluetoothd[4667]: src/adapter.c:dev_disconnected() Device 80:E4:DA:70:F2:0A disconnected, reason 3 bluetoothd[4667]: src/adapter.c:adapter_remove_connection() bluetoothd[4667]: plugins/policy.c:disconnect_cb() reason 3 bluetoothd[4667]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 80:E4:DA:70:F2:0A type 1 status 0xe bluetoothd[4667]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e bluetoothd[4667]: src/device.c:device_bonding_failed() status 14 bluetoothd[4667]: src/adapter.c:resume_discovery() bluetoothd[4667]: src/adapter.c:connected_callback() hci0 device 80:E4:DA:70:F2:0A connected eir_len 31 bluetoothd[4667]: src/adapter.c:dev_disconnected() Device 80:E4:DA:70:F2:0A disconnected, reason 3 bluetoothd[4667]: src/adapter.c:adapter_remove_connection() bluetoothd[4667]: plugins/policy.c:disconnect_cb() reason 3 bluetoothd[4667]: src/adapter.c:bonding_attempt_complete() hci0 bdaddr 80:E4:DA:70:F2:0A type 1 status 0xe bluetoothd[4667]: src/device.c:device_bonding_complete() bonding (nil) status 0x0e bluetoothd[4667]: src/device.c:device_bonding_failed() status 14 bluetoothd[4667]: src/adapter.c:resume_discovery() bluetoothd[4667]: src/adapter.c:connected_callback() hci0 device 80:E4:DA:70:F2:0A connected eir_len 31 bluetoothd[4667]: src/adapter.c:dev_disconnected() Device 80:E4:DA:70:F2:0A disconnected, reason 3 bluetoothd[4667]: src/adapter.c:adapter_remove_connection() bluetoothd[4667]: plugins/policy.c:disconnect_cb() reason 3 ...

morganm commented 8 years ago

Hi Roberto,

I saw the same thing as you when I tried over the weekend. From other issues here, it appears 5.37 of bluez is the only known stable version. I haven't had a chance to test it myself yet, but that's my next step and others have reported success with it. The following bluez tag is for the 5.37 release:

git checkout 56776afd51651215a5f96ebf23adaae9164d8e88

Button won't connect issue#38 fliclib does not work with the current bluez master issue#34

Emill commented 8 years ago

Maybe you could show a bit more of the hci log? Den 11 apr 2016 19:52 skrev "Mark Morgan" notifications@github.com:

Hi Roberto,

I saw the same thing as you when I tried over the weekend. From other issues here, it appears 5.37 of bluez is the only known stable version. I haven't had a chance to test it myself yet, but that's my next step and others have reported success with it. The following bluez tag is for the 5.37 release:

git checkout 56776afd51651215a5f96ebf23adaae9164d8e88

Button won't connect issue#38 https://github.com/50ButtonsEach/fliclib-linux-dist/issues/38 fliclib does not work with the current bluez master issue#34 https://github.com/50ButtonsEach/fliclib-linux-dist/issues/34

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/50ButtonsEach/fliclib-linux-dist/issues/41#issuecomment-208472841

fabianbergmark commented 8 years ago

I have now updated the Readme to state that 5.37 is the way to go right now. Sorry for the slow update

robertopierpaoli commented 8 years ago

@morganm Thank you Morgan, I'll try with the 5.37 tag asap.

@Emill I'm sorry Emill, which is the log content you are more interested in of the six that I've posted? Just tell me and I'll post the full log.

@fabianbergmark I Fabian, don't worry, maybe a slow update, but very quick answers when asked ;-) Thanks again.

robertopierpaoli commented 8 years ago

Hi guys, I have just made a test compiling bluez with the 5.37 tag: the resulting behavior seems identical, the same connect/disconnect loop...

In theory I have no differences from the tutorial, now...

Would it be possibile for you to share a minimal VM that shows the lib running correctly? This way one could compare his own environment with a certainly working one, maybe finding the reason of the failure more rapidly.

fabianbergmark commented 8 years ago

At the moment I'm working on releasing the 2.0 version of the Android app. After that I will work full time on the Linux SDK, and fix the reported bugs. In the meanwhile I would suggest issuing a power off/power on in bluetoothctl if things act weird.

Jash-ugan commented 8 years ago

Any news here? Unfortunately I run into the same loop here. If flic is not working with a raspberryPi, it is of no use for me. :-/

@robertopierpaoli Did you make it work by now, or are you waiting for @fabianbergmark?

I am running Raspian Jessie on a raspberryPi 1 with all the versions in the guide (bluez, ...).

fabianbergmark commented 8 years ago

Hi

See the update in the Readme

Cheers, Fabian

fabianbergmark commented 8 years ago

Hi

See the update in the Readme

Cheers, Fabian

IOOOTARobby commented 8 years ago

@Jash-ugan sorry, I did not get your message! Anyway I still have not solved the problem and I was actually waiting for the new library... that seems to have just been published, as Fabian pointed out: great!

richbeales commented 8 years ago

Fabian the new library looks really good, and I was up and running in minutes! Just need to re-implement the python client now :-)

fabianbergmark commented 8 years ago

That's great to hear!

HarishSEMP commented 6 years ago

I'm using bluez-5.37, From bluetoothctl I've connected my phone. i have forgot the device(which has bluetoothctl) from my phone. and trying to connect from phone. It is throwing an error perfectly, but immediately going into the infinite loop of connection and disconnection.