Debugging the QtBluetooth module



  • Hello all,

    I have some problems with the BLE device handling of the Qt 5.7.0. I have not been able to connect to any BLE device with Qt. hcitool and gattool works as expected, so it is not a system/hardware level problem.

    The official lowenergyscanner example throws the following error when trying to discover services on the device:

    Error:  "Unknown Error"
    qt.bluetooth.bluez: void QBluetoothSocketPrivate::_q_readNotify() 25 error: -1 "Resource not available"
    Error:  "Unknown Error"
    Disconnect from device
    

    I have decided to try debugging this issue.
    Cloned the http://code.qt.io/cgit/qt/qtconnectivity.git/ and built the bluetooth module.
    I have removed the QT += bluetooth line from the project file, and added

    LIBS += -L/home/mm/Projektek/qt/qtconnectivity/lib/ -l:/home/mm/Projektek/qt/qtconnectivity/lib/libQt5Bluetooth.so.5.7.1
    

    But the ldd still shows the following even after setting the LD_LIBRARY_PATH:

    mm@lapos:/opt/qt-5.7.0/Examples/Qt-5.7/bluetooth/build-lowenergyscanner-Desktop_Qt_5_7_0_GCC_64bit-Debug$ ldd ./lowenergyscanner  | grep Blue
            libQt5Bluetooth.so.5 => /opt/qt-5.7.0/5.7/gcc_64/lib/libQt5Bluetooth.so.5 (0x00007f73aca4e000)
    
    

    How can I use a locally built Qt module with a Qt application?


  • Lifetime Qt Champion

    Hi,

    IIRC, you have to set the LD_LIBRARY_PATH environment variable to select the order in which the loader will search for these files.

    Hope it helps



  • @SGaist Yepp it sloved it, my mistake. Also the QtBluetooth uses the QLoggingCategory, so with ```
    QLoggingCategory::setFilterRules("*.debug=false\n"
    "qt.bluetooth.bluez.debug=true\n"
    "qt.bluetooth.debug=true");

    I was able to get extended debug out.

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.