Govee Thermomètre/Hygromètre
Petit Moniteur - amazon / GoveeBTTempLogger / Govee-monitor
Bluetooth scan
[NEW] Device A4:C1:38:32:15:9E GVH5075_159E
[NEW] Device A4:C1:38:12:7D:CD GVH5075_7DCD
[NEW] Device A4:C1:38:E8:44:16 GVH5075_4416
Set scan parameters failed: Operation not permitted
TL;DR: on my system the standard scan parameters are not allowed, only extended scan: that’s what
bluetoothctl
is using. see Failing on ubuntu 22.04 (linux mint 21) - LE Set Scan Parameters Command Disallowed #43
LE Scan is working with bluetoothctl non root - bluetoothctl scan le
But not with sudo hcitool lescan
You can observe HCI communication using sudo btmon
hcitool is deprecated, and behave like GoveeBTTempLogger. It seems that the code must be change to send reset cmd to fix the command disallowed, see:
- CYBT-413034-02: “LE Set Scan Parameters Command” returns “COMMAND DISALLOWED (0x0C)” - You have to send HCI reset command first and see if you are getting a success response.
- LE connection failure with “Error: Command Disallowed” #864 - resetting the device before connect (and a fraction of sleep as reset command doesn’t have return event), solves this issue.
hcitool lescan
@ RAW Open: hcitool (privileged) version 2.22 {0x0002} [hci0] 8.979713
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7 #1 [hci0] 8.979769
Type: Active (0x01)
Interval: 10.000 msec (0x0010)
Window: 10.000 msec (0x0010)
Own address type: Public (0x00)
Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4 #2 [hci0] 9.096956
LE Set Scan Parameters (0x08|0x000b) ncmd 1
Status: Command Disallowed (0x0c)
@ RAW Close: hcitool {0x0002} [hci0] 9.097866
The “Operation not permitted” error is generated by a writev system call, with the call stack locking as follows (all functions implemented in hci.c, see the bluez source code):
hci_le_set_scan_parameters -> hci_send_req -> hci_send_cmd -> writev
(This can be confirmed using strace
)
bluetoothctl scan le
@ MGMT Command: Start Discovery (0x0023) plen 1 {0x0001} [hci0] 417.485906
Address type: 0x07
BR/EDR
LE Public
LE Random
< HCI Command: LE Set Random Address (0x08|0x0005) plen 6 #9 [hci0] 417.485978
Address: 15:AA:C3:57:A4:AB (Non-Resolvable)
> HCI Event: Command Complete (0x0e) plen 4 #10 [hci0] 417.601091
LE Set Random Address (0x08|0x0005) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Extended Scan Parameters (0x08|0x0041) plen 8 #11 [hci0] 417.601406
Own address type: Random (0x01)
Filter policy: Accept all advertisement (0x00)
PHYs: 0x01
Entry 0: LE 1M
Type: Active (0x01)
Interval: 22.500 msec (0x0024)
Window: 11.250 msec (0x0012)
> HCI Event: Command Complete (0x0e) plen 4 #12 [hci0] 417.602985
LE Set Extended Scan Parameters (0x08|0x0041) ncmd 1
Status: Success (0x00)
< HCI Command: LE Set Extended Scan Enable (0x08|0x0042) plen 6 #13 [hci0] 417.603273
Extended scan: Enabled (0x01)
Filter duplicates: Enabled (0x01)
Duration: 0 msec (0x0000)
Period: 0.00 sec (0x0000)
> HCI Event: Command Complete (0x0e) plen 4 #14 [hci0] 417.604925
LE Set Extended Scan Enable (0x08|0x0042) ncmd 2
Status: Success (0x00)
< HCI Command: Inquiry (0x01|0x0001) plen 5 #15 [hci0] 417.605193
Access code: 0x9e8b33 (General Inquiry)
Length: 10.24s (0x08)
Num responses: 0
> HCI Event: Command Status (0x0f) plen 4 #16 [hci0] 417.605931
Inquiry (0x01|0x0001) ncmd 2
Status: Success (0x00)
@ MGMT Event: Command Complete (0x0001) plen 4 {0x0001} [hci0] 417.606096
Start Discovery (0x0023) plen 1
Status: Success (0x00)
Address type: 0x07
BR/EDR
LE Public
LE Random
@ MGMT Event: Discovering (0x0013) plen 2 {0x0001} [hci0]
...
also kernel change
see Set scan parameters failed: Input/output error - but no answer