Buggy parameter passing using hci.cmd in bluetoothctl

"Vanwezemael Kris (DGJ)" <[email protected]>
Newsgroups org.kernel.vger.linux-bluetooth
Message-ID <AM7PR03MB61504B7CDB46CF6F9FD1EF81D7A72@AM7PR03MB6150.eurprd03.prod.outlook.com>
Dear,

I would like to report a particularity with executing hci commands though the bluetoothctrl program.

My system is:
Linux XXXXXX 6.12.47+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.12.47-1+rpt1 (2025-09-16) aarch64 GNU/Linux
My Bluez version is:
bluetoothctl: 5.82

While executing site examples, there is something not going right when parameter processing is needed, as errors like ‘invalid packet size’ and ‘invalid parameter size’ are reported.
I captured as much as a could below.

Thank you for your feedback

sudo bluetoothctl
hci0 new_settings: powered bondable ssp br/edr le secure-conn
Agent registered
[CHG] Controller 2C:CF:67:6D:5A:17 Pairable: yes
[bluetoothctl]> hci.open 0 raw
HCI index 0 raw channel opened
[bluetoothctl]> hci.cmd 0x1003
HCI Command complete:
  00 bf fe cf fe db ff 7b 87                       .......{.
[bluetoothctl]> hci.cmd 0x1009
HCI Command complete:
  00 17 5a 6d 67 cf 2c                             ..Zmg.,
[bluetoothctl]> hci.cmd 0x0c01 0x01
HCI Command complete:
  12                                               .
[bluetoothctl]> hci.cmd 0x200f 0x00 0x08
HCI Command complete:
  00 80                                            ..
[bluetoothctl]> hci.cmd 0x2008 0x20 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08
HCI Command complete:
  00                                               .
[bluetoothctl]> hci.cmd 0x0c05 0x02
HCI Command complete:
  00                                               .
[bluetoothctl]> hci.cmd 0x0c2a 0x01
HCI Command complete:
  00                                               .
[bluetoothctl]> hci.cmd 0x0c23 0x00 0x08
HCI Command complete:
  12                                               .
[bluetoothctl]>

Sudo btmon gives me this :

sudo btmon
Bluetooth monitor ver 5.82
btmon[26844]: = Note: Linux version 6.12.47+rpt-rpi-v8 (aarch64)                                             0.359032
btmon[26844]: = Note: Bluetooth subsystem version 2.22                                                       0.359043
= New Index: 2C:CF:67:6D:5A:17 (Primary,UART,hci0)                                                    [hci0] 0.359046
= Open Index: 2C:CF:67:6D:5A:17                                                                       [hci0] 0.359048
= Index Info: 2C:CF:67:6D:5A:17 (Cypress Semiconductor)                                               [hci0] 0.359050
bluetoothctl[26788]: @ RAW Open: bluetoothctl (privileged) version 2.22                      {0x0003} [hci0] 0.359053
bluetoothctl[26788]: @ MGMT Open: bluetoothctl (privileged) version 1.23                            {0x0002} 0.359056
bluetoothd[26729]: @ MGMT Open: bluetoothd (privileged) version 1.23                                {0x0001} 0.359060
bluetoothctl[26788]: @ MGMT Close: bluetoothctl                                                    {0x0002} 12.664823
bluetoothctl[26788]: @ RAW Close: bluetoothctl                                              {0x0003} [hci0] 12.666624
bluetoothd[26729]: @ MGMT Command: Set Bondable (0x0009) plen 1                             {0x0001} [hci0] 12.713440
        Bondable: Disabled (0x00)
@ MGMT Event: Command Complete (0x0001) plen 7                                              {0x0001} [hci0] 12.713468
      Set Bondable (0x0009) plen 4
        Status: Success (0x00)
        Current settings: 0x00000ac1
          Powered
          Secure Simple Pairing
          BR/EDR
          Low Energy
          Secure Connections
bluetoothctl[26849]: @ MGMT Open: bluetoothctl (privileged) version 1.23                           {0x0002} 15.897158
bluetoothd[26729]: @ MGMT Command: Set Bondable (0x0009) plen 1                             {0x0001} [hci0] 15.971613
        Bondable: Enabled (0x01)
@ MGMT Event: Command Complete (0x0001) plen 7                                              {0x0001} [hci0] 15.971629
      Set Bondable (0x0009) plen 4
        Status: Success (0x00)
        Current settings: 0x00000ad1
          Powered
          Bondable
          Secure Simple Pairing
          BR/EDR
          Low Energy
          Secure Connections
@ MGMT Event: New Settings (0x0006) plen 4                                                  {0x0002} [hci0] 15.971632
        Current settings: 0x00000ad1
          Powered
          Bondable
          Secure Simple Pairing
          BR/EDR
          Low Energy
          Secure Connections
bluetoothd[26729]: @ MGMT Command: Set IO Capability (0x0018) plen 1                        {0x0001} [hci0] 15.971720
        Capability: KeyboardDisplay (0x04)
@ MGMT Event: Command Complete (0x0001) plen 3                                              {0x0001} [hci0] 15.971724
      Set IO Capability (0x0018) plen 0
        Status: Success (0x00)
bluetoothctl[26849]: @ RAW Open: bluetoothctl (privileged) version 2.22                     {0x0003} [hci0] 36.172604
bluetoothctl[26849]: @ RAW Close: bluetoothctl                                              {0x0003} [hci0] 44.460094
bluetoothctl[26849]: @ MGMT Close: bluetoothctl                                                    {0x0002} 46.645576
bluetoothd[26729]: @ MGMT Command: Set Bondable (0x0009) plen 1                             {0x0001} [hci0] 46.688706
        Bondable: Disabled (0x00)
@ MGMT Event: Command Complete (0x0001) plen 7                                              {0x0001} [hci0] 46.688752
      Set Bondable (0x0009) plen 4
        Status: Success (0x00)
        Current settings: 0x00000ac1
          Powered
          Secure Simple Pairing
          BR/EDR
          Low Energy
          Secure Connections
bluetoothctl[26855]: @ MGMT Open: bluetoothctl (privileged) version 1.23                           {0x0002} 48.404793
bluetoothd[26729]: @ MGMT Command: Set Bondable (0x0009) plen 1                             {0x0001} [hci0] 48.469700
        Bondable: Enabled (0x01)
@ MGMT Event: Command Complete (0x0001) plen 7                                              {0x0001} [hci0] 48.469719
      Set Bondable (0x0009) plen 4
        Status: Success (0x00)
        Current settings: 0x00000ad1
          Powered
          Bondable
          Secure Simple Pairing
          BR/EDR
          Low Energy
          Secure Connections
@ MGMT Event: New Settings (0x0006) plen 4                                                  {0x0002} [hci0] 48.469723
        Current settings: 0x00000ad1
          Powered
          Bondable
          Secure Simple Pairing
          BR/EDR
          Low Energy
          Secure Connections
bluetoothd[26729]: @ MGMT Command: Set IO Capability (0x0018) plen 1                        {0x0001} [hci0] 48.469848
        Capability: KeyboardDisplay (0x04)
@ MGMT Event: Command Complete (0x0001) plen 3                                              {0x0001} [hci0] 48.469853
      Set IO Capability (0x0018) plen 0
        Status: Success (0x00)
bluetoothctl[26855]: @ MGMT Close: bluetoothctl                                                    {0x0002} 50.227543
bluetoothd[26729]: @ MGMT Command: Set Bondable (0x0009) plen 1                             {0x0001} [hci0] 50.269123
        Bondable: Disabled (0x00)
@ MGMT Event: Command Complete (0x0001) plen 7                                              {0x0001} [hci0] 50.269146
      Set Bondable (0x0009) plen 4
        Status: Success (0x00)
        Current settings: 0x00000ac1
          Powered
          Secure Simple Pairing
          BR/EDR
          Low Energy
          Secure Connections
bluetoothctl[26861]: @ MGMT Open: bluetoothctl (privileged) version 1.23                           {0x0002} 54.599424
bluetoothd[26729]: @ MGMT Command: Set Bondable (0x0009) plen 1                             {0x0001} [hci0] 54.663378
        Bondable: Enabled (0x01)
@ MGMT Event: Command Complete (0x0001) plen 7                                              {0x0001} [hci0] 54.663395
      Set Bondable (0x0009) plen 4
        Status: Success (0x00)
        Current settings: 0x00000ad1
          Powered
          Bondable
          Secure Simple Pairing
          BR/EDR
          Low Energy
          Secure Connections
@ MGMT Event: New Settings (0x0006) plen 4                                                  {0x0002} [hci0] 54.663398
        Current settings: 0x00000ad1
          Powered
          Bondable
          Secure Simple Pairing
          BR/EDR
          Low Energy
          Secure Connections
bluetoothd[26729]: @ MGMT Command: Set IO Capability (0x0018) plen 1                        {0x0001} [hci0] 54.663485
        Capability: KeyboardDisplay (0x04)
@ MGMT Event: Command Complete (0x0001) plen 3                                              {0x0001} [hci0] 54.663489
      Set IO Capability (0x0018) plen 0
        Status: Success (0x00)
bluetoothctl[26861]: @ RAW Open: bluetoothctl (privileged) version 2.22                     {0x0003} [hci0] 58.502480
bluetoothctl[26861]: < HCI Command: Read Local Supported Features (0x04|0x0003) plen 0           #1 [hci0] 204.076330
> HCI Event: Command Complete (0x0e) plen 12                                                     #2 [hci0] 204.076756
      Read Local Supported Features (0x04|0x0003) ncmd 1
        Status: Success (0x00)
        Features: 0xbf 0xfe 0xcf 0xfe 0xdb 0xff 0x7b 0x87
          3 slot packets
          5 slot packets
          Encryption
          Slot offset
          Timing accuracy
          Role switch
          Sniff mode
          Power control requests
          Channel quality driven data rate (CQDDR)
          SCO link
          HV2 packets
          HV3 packets
          u-law log synchronous data
          A-law log synchronous data
          CVSD synchronous data
          Paging parameter negotiation
          Power control
          Transparent synchronous data
          Flow control lag (most significant bit)
          Broadcast Encryption
          Enhanced Data Rate ACL 2 Mbps mode
          Enhanced Data Rate ACL 3 Mbps mode
          Enhanced inquiry scan
          Interlaced inquiry scan
          Interlaced page scan
          RSSI with inquiry results
          Extended SCO link (EV3 packets)
          EV4 packets
          EV5 packets
          AFH capable peripheral
          AFH classification peripheral
          LE Supported (Controller)
          3-slot Enhanced Data Rate ACL packets
          5-slot Enhanced Data Rate ACL packets
          Sniff subrating
          Pause encryption
          AFH capable central
          AFH classification central
          Enhanced Data Rate eSCO 2 Mbps mode
          Enhanced Data Rate eSCO 3 Mbps mode
          3-slot Enhanced Data Rate eSCO packets
          Extended Inquiry Response
          Simultaneous LE and BR/EDR (Controller)
          Secure Simple Pairing
          Encapsulated PDU
          Erroneous Data Reporting
          Non-flushable Packet Boundary Flag
          Link Supervision Timeout Changed Event
          Inquiry TX Power Level
          Enhanced Power Control
          Extended features
bluetoothctl[26861]: < HCI Command: Read BD ADDR (0x04|0x0009) plen 0                            #3 [hci0] 212.433915
> HCI Event: Command Complete (0x0e) plen 10                                                     #4 [hci0] 212.434301
      Read BD ADDR (0x04|0x0009) ncmd 1
        Status: Success (0x00)
        Address: 2C:CF:67:6D:5A:17 (Raspberry Pi (Trading) Ltd)
bluetoothctl[26861]: < HCI Command: Set Event Mask (0x03|0x0001) plen 1                          #5 [hci0] 225.962367
        invalid packet size
        01                                               .
> HCI Event: Command Complete (0x0e) plen 4                                                      #6 [hci0] 225.962708
      Set Event Mask (0x03|0x0001) ncmd 1
        Status: Invalid HCI Command Parameters (0x12)
bluetoothctl[26861]: < HCI Command: LE Read Accept List Size (0x08|0x000f) plen 1                #7 [hci0] 236.666394
        invalid packet size
        00                                               .
> HCI Event: Command Complete (0x0e) plen 5                                                      #8 [hci0] 236.666770
      LE Read Accept List Size (0x08|0x000f) ncmd 1
        Status: Success (0x00)
        Size: 128
bluetoothctl[26861]: < HCI Command: LE Set Advertising Data (0x08|0x0008) plen 1                 #9 [hci0] 302.700321
        invalid packet size
        20
> HCI Event: Command Complete (0x0e) plen 4                                                     #10 [hci0] 302.700735
      LE Set Advertising Data (0x08|0x0008) ncmd 1
        Status: Success (0x00)
bluetoothctl[26861]: < HCI Command: Set Event Filter (0x03|0x0005) plen 1                       #11 [hci0] 311.468582
        Type: Connection Setup (0x02)
          invalid parameter size
> HCI Event: Command Complete (0x0e) plen 4                                                     #12 [hci0] 311.468958
      Set Event Filter (0x03|0x0005) ncmd 1
        Status: Success (0x00)
bluetoothctl[26861]: < HCI Command: Write Num Broadcast Retransmissions (0x03|0x002a) plen 1    #13 [hci0] 321.421130
        Number of broadcast retransmissions: 1
> HCI Event: Command Complete (0x0e) plen 4                                                     #14 [hci0] 321.421552
      Write Num Broadcast Retransmissions (0x03|0x002a) ncmd 1
        Status: Success (0x00)
bluetoothctl[26861]: < HCI Command: Read Class of Device (0x03|0x0023) plen 1                   #15 [hci0] 329.832604
        invalid packet size
        00                                               .
> HCI Event: Command Complete (0x0e) plen 4                                                     #16 [hci0] 329.833014
      Read Class of Device (0x03|0x0023) ncmd 1
        Status: Invalid HCI Command Parameters (0x12)

________________________________
Als u niet de beoogde ontvanger van deze email bent, lees onze disclaimer<https://www.politie.be/nl/maildisclaimer>.
Si vous n’êtes pas le destinataire prévu de cet email, lisez notre disclaimer<https://www.politie.be/fr/maildisclaimer>.
Wenn Sie nicht der beabsichtigte Empfänger dieser email sind, lesen Sie unseren disclaimer<https://www.politie.be/de/maildisclaimer>.
If you aren’t the intended recipient of this email, read our disclaimer<https://www.politie.be/en/maildisclaimer>.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.