YIO-Remote / remote-software

💎 YIO Remote Software repository
GNU General Public License v3.0
164 stars 21 forks source link

Initial setup: Dock setup fails due to bluetooth errors #513

Closed zehnm closed 3 years ago

zehnm commented 3 years ago

Description

During the initial setup the dock cannot be setup and integrated into the wifi network. According to the system logs the Bluetooth communication fails.

How to Reproduce

Steps to reproduce the behavior:

  1. Create a fresh SD card image
  2. Perform setup until dock integration
  3. Make sure the dock led is blinking: ready for integration
  4. See error

Expected behavior

It just works :-)

Screenshots

Relevant Journal log:

Oct 16 14:57:13 YIO-Remote-b827eb48a8d9 remote[207]: DEBUG [yio.bluetooth]:        Creating bluetooth discovery agent        [../sources/bluetooth.cpp:58]
Oct 16 14:57:13 YIO-Remote-b827eb48a8d9 remote[207]: DEBUG [yio.bluetooth]:        Starting Bluetooth discovery...        [../sources/bluetooth.cpp:65]
Oct 16 14:57:19 YIO-Remote-b827eb48a8d9 kernel: Bluetooth: hci0: Frame reassembly failed (-84)
Oct 16 14:57:19 YIO-Remote-b827eb48a8d9 kernel: Bluetooth: hci0: last event is not cmd complete (0x00)
Oct 16 14:57:21 YIO-Remote-b827eb48a8d9 kernel: Bluetooth: hci0: inquiry failed: status 0x1f
Oct 16 14:57:21 YIO-Remote-b827eb48a8d9 kernel: Bluetooth: hci0: command 0x200c tx timeout
Oct 16 14:57:33 YIO-Remote-b827eb48a8d9 remote[207]: DEBUG [yio.bluetooth]:        Bluetooth discovery finished.        [../sources/bluetooth.cpp:94]
Oct 16 14:57:36 YIO-Remote-b827eb48a8d9 remote[207]: DEBUG [yio.bluetooth]:        Creating bluetooth discovery agent        [../sources/bluetooth.cpp:58]
Oct 16 14:57:36 YIO-Remote-b827eb48a8d9 remote[207]: DEBUG [yio.bluetooth]:        Starting Bluetooth discovery...        [../sources/bluetooth.cpp:65]
Oct 16 14:57:56 YIO-Remote-b827eb48a8d9 remote[207]: DEBUG [yio.bluetooth]:        Bluetooth discovery finished.        [../sources/bluetooth.cpp:94]
Oct 16 14:57:56 YIO-Remote-b827eb48a8d9 remote[207]: DEBUG [yio.bluetooth]:        Creating bluetooth discovery agent        [../sources/bluetooth.cpp:58]
Oct 16 14:57:56 YIO-Remote-b827eb48a8d9 remote[207]: DEBUG [yio.bluetooth]:        Starting Bluetooth discovery...        [../sources/bluetooth.cpp:65]
Oct 16 14:57:57 YIO-Remote-b827eb48a8d9 dbus-daemon[133]: [system] Rejected send message, 0 matched rules; type="error", sender=":1.4" (uid=0 pid=132 comm="/usr/libexec/bluetooth/bluetoothd --noplugin=sap -") interface="(unset)" member="(unset)" error name="org.bluez.Error.InProgress" requested_reply="0" destination=":1.10" (uid=0 pid=207 comm="/opt/yio/app/remote ")

The last dbus-daemon error message is repeated whenever you attempt a retry in the setup screen.

Your Environment

Additional context

There aren't many log messages in the remote app. Even though there's a kernel error, the error isn't handled (or ignored) in the app. First step is probably to check error handling and add more logging. Since the consecutive kernel error while retrying says error name="org.bluez.Error.InProgress" one might have to reset the bluetooth communication in the app before a retry.

Another test is to restart the bluez daemon after the first error to see if this fixes the issue.

zehnm commented 3 years ago

Good news: it's not generally broken :-) But there seem some issues with the 4.19 kernel and RPi firmware. E.g. https://github.com/raspberrypi/firmware/issues/1150 (even though this is with a RPi 3B)

With some test code calling BluetoothControl::lookForDocks() during app startup and systemctl restart bluetooth after journalctl showed hci0: last event is not cmd complete (0x00) kernel errors, I was able to discover, pair & communicate with the YIO dock:

2020-10-16 22:19:35:827 CEST INFO  [yio.bluetooth]: Bluetooth starting  [../sources/bluetooth.cpp:31]
2020-10-16 22:19:35:836 CEST DEBUG [yio.bluetooth]: Bluetooth init OK   [../sources/bluetooth.cpp:36]
2020-10-16 22:19:35:864 CEST DEBUG [yio.bluetooth]: Creating bluetooth discovery agent  [../sources/bluetooth.cpp:58]
2020-10-16 22:19:35:878 CEST INFO  [yio.bluetooth]: Starting Bluetooth discovery... [../sources/bluetooth.cpp:66]
2020-10-16 22:19:35:981 CEST INFO  [yio.bluetooth]: YIO Dock found. Request pairing "YIO-Dock-246F283FCDCC" [../sources/bluetooth.cpp:87]
2020-10-16 22:19:38:922 CEST INFO  [yio.bluetooth]: Pairing done: "24:6F:28:3F:CD:CE"   [../sources/bluetooth.cpp:116]
2020-10-16 22:19:39:025 CEST DEBUG [yio.bluetooth]: Connecting to bluetooth service "24:6F:28:3F:CD:CE" with uuid "{00001101-0000-1000-8000-00805f9b34fb}"  [../sources/bluetooth.cpp:124]
2020-10-16 22:19:40:375 CEST DEBUG [yio.bluetooth]: Opening bluetooth socket to dock    [../sources/bluetooth.cpp:129]
2020-10-16 22:19:40:383 CEST DEBUG [yio.bluetooth]: Sending message to dock: "\n"   [../sources/bluetooth.cpp:137]
2020-10-16 22:19:40:398 CEST INFO  [yio.bluetooth]: Message sent to dock.   [../sources/bluetooth.cpp:142]
2020-10-16 22:19:46:478 CEST INFO  [yio.bluetooth]: Bluetooth off   [../sources/bluetooth.cpp:52]

I'll add further error handling and test error recovery strategies with retry & restarting the bluetooth daemon.

zehnm commented 3 years ago

Dock setup works again in remote-os v1.1.0 release!