Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-82407

No error signal is emitted with latest Bluez version

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.15.3, 5.15.8, 6.2.0 Beta4
    • 5.14.1, 5.15.2
    • None
    • Linux peppy 5.5.4-arch1-1 #1 SMP PREEMPT Sat, 15 Feb 2020 00:36:29 +0000 x86_64 GNU/Linux
      python-pyqt5 5.14.1-2
      bluez 5.53-1
    • Linux/X11
    • 7aa19c8a512fdceac12cf4ee6587626e3de61c25 (qt/qtconnectivity/dev) e61994ab9d82470fe15f4476eecf2aef1d570f35 (qt/tqtc-qtconnectivity/tqtc/lts-5.15)

    Description

      Code is broken since bluez version 5.46. Downgrading to 5.45 fix the issue.

      When trying to connect to a known, but unavailable device, the connection timeout never occur. No error signal is emitted and it hang in the connecting state for ever. Likewise, no error occur when the adapter is powered off during the connection, so it seems like a communication problem between Bluez and Qt.

       

      systemctl status bluetooth output the following error for HC05 (with both 5.45 and 5.46):

      Feb 21 11:55:29 peppy bluetoothd[531]: Unable to get QBluetoothSocket-3619 SDP record: Host is down
      

       

      Script output in 5.45-1:

      connecting ...
      qt.bluetooth.bluez: SDP scan failure QProcess::NormalExit 3
      qt.bluetooth.bluez: SDP search failed for "98:D3:31:40:31:2C"
      Service cannot be found
      

       

      Script output in 5.46-2 (hang)

      connecting ...
      

       

      Sample code:

      #!/usr/bin/python3
      import sys
      from PyQt5 import QtWidgets, QtBluetooth, QtCore
      
      class Main(QtWidgets.QMainWindow):
          def __init__(self, parent):
              super().__init__()
              unavailable_host = "98:D3:31:40:31:2C"  # HC05 bluetooth module
              addr = QtBluetooth.QBluetoothAddress(unavailable_host)
              uuid = QtBluetooth.QBluetoothUuid(QtBluetooth.QBluetoothUuid.SerialPort)        
      
              print("connecting ...")
              self.socket = QtBluetooth.QBluetoothSocket(QtBluetooth.QBluetoothServiceInfo.RfcommProtocol)
              self.socket.connectToService(addr, uuid, QtCore.QIODevice.ReadWrite)
              self.socket.connected.connect(self.connected)
              self.socket.error.connect(self.error)
      
          def error(self, error):
              # Error signal is never emitted
              print(self.socket.errorString())
      
          def connected(self):
              # Connected signal is never emitted
              print("connected")
      
      if __name__ == '__main__':
          app = QtWidgets.QApplication(sys.argv)
          gui = Main(app)
          sys.exit(app.exec_())
      
      

      Attachments

        For Gerrit Dashboard: QTBUG-82407
        # Subject Branch Project Status CR V

        Activity

          People

            ablasche Alex Blasche
            william.belanger William Belanger
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes