Details
-
Bug
-
Resolution: Cannot Reproduce
-
P3: Somewhat important
-
None
-
5.14, 6.2.4
-
None
-
-
Foundation PM Staging
Description
Hello,
on my Linux desktop, Qt fails to enable BLE advertising.
I'm running the heart rate server sample code as root, with the following line uncommented:
QLoggingCategory::setFilterRules(QStringLiteral("qt.bluetooth* = true"));
The output of the application is:
sudo ./heartrate-server
qt.bluetooth: Using BlueZ kernel ATT interface
qt.bluetooth.bluez: Bluez 5 detected.
qt.bluetooth.bluez: Starting to advertise
qt.bluetooth.bluez: sending command; ogf: 8 ocf: 7
qt.bluetooth.bluez: command sent successfully
qt.bluetooth.bluez: HCI event triggered, type: e
qt.bluetooth.bluez: command 7 failed with status 12
qt.bluetooth.bluez: reading power level failed, leaving it out of the advertising data
qt.bluetooth.bluez: advertising parameters: "000800080000000000000000000700"
qt.bluetooth.bluez: advertising data: "18020106100948656172745261746553657276657203030d1800000000000000"
qt.bluetooth.bluez: scan response data: "15100948656172745261746553657276657203030d1800000000000000000000"
qt.bluetooth.bluez: sending command; ogf: 8 ocf: 10
qt.bluetooth.bluez: command sent successfully
qt.bluetooth.bluez: HCI event triggered, type: e
qt.bluetooth.bluez: command 10 failed with status 12
qt.bluetooth.bluez: Advertising disable failed, ignoring
qt.bluetooth.bluez: sending command; ogf: 8 ocf: 6
qt.bluetooth.bluez: command sent successfully
qt.bluetooth.bluez: HCI event triggered, type: e
qt.bluetooth.bluez: command 6 failed with status 12
qt.bluetooth.bluez: received advertising error
The output of btmon is the following:
sudo btmon
Bluetooth monitor ver 5.64
= Note: Linux version 5.18.6 (x86_64) 0.730093
= Note: Bluetooth subsystem version 2.22 0.730094
= New Index: 34:E1:2D:E9:39:90 (Primary,USB,hci0) [hci0] 0.730094
= Open Index: 34:E1:2D:E9:39:90 [hci0] 0.730094
= Index Info: 34:E1:2D:E9:39:90 (Intel Corp.) [hci0] 0.730095
@ MGMT Open: bluetoothd (privileged) version 1.22 {0x0001} 0.730095
@ RAW Open: heartrate-serve (privileged) version 2.22 {0x0002} 5.982295
@ RAW Close: heartrate-serve {0x0002} 5.982311
@ RAW Open: heartrate-serve (privileged) version 2.22 {0x0002} [hci0] 5.982312
< HCI Command: LE Read Advertising Channel TX Power (0x08|0x0007) plen 0 #1 [hci0] 5.982400
> HCI Event: Command Complete (0x0e) plen 5 #2 [hci0] 5.982986
LE Read Advertising Channel TX Power (0x08|0x0007) ncmd 1
Status: Command Disallowed (0x0c)
TX power: 7 dbm (0x07)
< HCI Command: LE Set Advertise Enable (0x08|0x000a) plen 1 #3 [hci0] 5.983161
Advertising: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4 #4 [hci0] 5.984018
LE Set Advertise Enable (0x08|0x000a) ncmd 1
Status: Command Disallowed (0x0c)
< HCI Command: LE Set Advertising Parameters (0x08|0x0006) plen 15 #5 [hci0] 5.984205
Min advertising interval: 1280.000 msec (0x0800)
Max advertising interval: 1280.000 msec (0x0800)
Type: Connectable undirected - ADV_IND (0x00)
Own address type: Public (0x00)
Direct address type: Public (0x00)
Direct address: 00:00:00:00:00:00 (OUI 00-00-00)
Channel map: 37, 38, 39 (0x07)
Filter policy: Allow Scan Request from Any, Allow Connect Request from Any (0x00)
> HCI Event: Command Complete (0x0e) plen 4 #6 [hci0] 5.984975
LE Set Advertising Parameters (0x08|0x0006) ncmd 1
Status: Command Disallowed (0x0c)
I did some tests with older versions of linux kernel (4.19.251) and bluez (5.43) and the same occurs.
The same code on an arm target with yocto and same Qt version runs fine.
I also wrote a sample code on my desktop that uses hci_le_set_advertise_enable function from bluez library (the function uses the same HCI commands as Qt), and it fails too on desktop, and works on yocto board.
On the other hand, enabling BLE advertising from btmgmt works. I suspect that this has to do with the Bluetooth 5 extended advertising (maybe the devices that support extended advertising refuse the legacy hci advertising commands ?)
Is there any plan in Qt to support extended advertising ?