Btchat example doesn’t work correctly on Ubuntu 20.04
-
I have two computers with freshly installed ubuntu 20.04 connected by Bluetooth. I installed Qt 5.15.2, then compiled and run btchat example on both computers.
Btchat “client” successfully locates btchat “server”. But after connection “server” displays that client has joined the chat and immediately has left.
Btchat "server" log contains
qt.bluetooth.bluez: void QBluetoothSocketPrivateBluez::_q_readNotify() 19 error: -1 "Connection reset by peer"
In the meantime log of Btchat “client”reports that “ConnectToService done”, however any attempt to send message results with “OperrationError occurred”. Seems that btchat “client” is unaware that it has been already disconnected from server.
It is interesting that another qt example qml_chat successfully connects to the same btchat “server” and sends messages.
So btchat + btchat do not work properly on Ubuntu 20.04. But btchat + qml_chat work fine. It seems to me that something is wrong with client part of btchat.
btchat server log: 10:48:54: Starting /home/sgaidukov/Workshop/build-btchat-Desktop_Qt_5_15_2_GCC_64bit-Debug/btchat ... qt.bluetooth.bluez: Bluez 5 detected. qt.bluetooth.bluez: Registering profile under "/qt/profile/btchat13393/0" "e8e10f95-1a70-4b27-9ccf-02010264e9c8" qt.bluetooth.bluez: void QBluetoothSocketPrivateBluez::_q_readNotify() 19 error: -1 "Connection reset by peer"
btchat client log: 10:56:21: Starting /home/sgaidukov/Workshop/build-btchat-Desktop_Qt_5_15_2_GCC_64bit-Debug/btchat ... qt.bluetooth.bluez: Bluez 5 detected. qt.bluetooth.bluez: Registering profile under "/qt/profile/btchat14041/0" "e8e10f95-1a70-4b27-9ccf-02010264e9c8" qt.bluetooth.bluez: Missing CAP_NET_ADMIN permission. Cannot determine whether a found address is of random or public type. qt.bluetooth.bluez: Creating QtBluezDiscoveryManager qt.bluetooth.bluez: Discovered: "L-GAIDUKOV" "C0:E4:34:A5:77:1A" Num UUIDs 23 total device 0 cached RSSI 0 Num ManufacturerData 0 qt.bluetooth.bluez: Discovered: "LG Monitor(5D)" "C4:30:18:0B:16:5D" Num UUIDs 6 total device 1 cached RSSI -41 Num ManufacturerData 0 qt.bluetooth.bluez: Discovered: "[TV] Samsung 8 Series (50)" "BC:7E:8B:9D:C6:E3" Num UUIDs 5 total device 2 cached RSSI -90 Num ManufacturerData 1 qt.bluetooth.bluez: Updating RSSI for "C4:30:18:0B:16:5D" QVariant(short, -41) qt.bluetooth.bluez: Updating RSSI for "BC:7E:8B:9D:C6:E3" QVariant(short, -92) qt.bluetooth.bluez: Discovery on: "BC:7E:8B:9D:C6:E3" Mode: QBluetoothServiceDiscoveryAgent::FullDiscovery SDP for BC:7E:8B:9D:C6:E3 94:E6:F7:C6:6C:80 Target scan for {e8e10f95-1a70-4b27-9ccf-02010264e9c8} qt.bluetooth.bluez: Discovery on: "C4:30:18:0B:16:5D" Mode: QBluetoothServiceDiscoveryAgent::FullDiscovery SDP for C4:30:18:0B:16:5D 94:E6:F7:C6:6C:80 Target scan for {e8e10f95-1a70-4b27-9ccf-02010264e9c8} qt.bluetooth.bluez: Discovery on: "C0:E4:34:A5:77:1A" Mode: QBluetoothServiceDiscoveryAgent::FullDiscovery SDP for C0:E4:34:A5:77:1A 94:E6:F7:C6:6C:80 Target scan for {e8e10f95-1a70-4b27-9ccf-02010264e9c8} qt.bluetooth.bluez: Discovered services "C0:E4:34:A5:77:1A" "Custom Service" "{e8e10f95-1a70-4b27-9ccf-02010264e9c8}" >>> ("{00001101-0000-1000-8000-00805f9b34fb}") got click "L-GAIDUKOV Custom Service" Connecting to service 2 "Custom Service" on "L-GAIDUKOV" Going to create client Connecting... Start client qt.bluetooth.bluez: Detecting bluetoothd version qt.bluetooth.bluez: Using /proc/<pid>/exe qt.bluetooth.bluez: Using /proc/<pid>/cmdline qt.bluetooth.bluez: Detected bluetoothd version 5.53 qt.bluetooth.bluez: Bluetoothd: "5.53" qt.bluetooth: Using Bluetooth dbus socket implementation Create socket qt.bluetooth.bluez: Registering client profile on "/qt/btsocket/btchat14041/1701724585" with options: qt.bluetooth.bluez: QMap(("Name", QVariant(QString, "QBluetoothSocket-14041"))("Role", QVariant(QString, "client"))("Service", QVariant(QString, "e8e10f95-1a70-4b27-9ccf-02010264e9c8"))) ConnectToService done