'hcitool lescan fails on ubuntu

I am trying to do a "hcitool lescan" on ubuntu with an external USB adapter but instead of getting BLE scan results I get this error

Set scan parameters failed: Input/output error

My BT adapter is an unbranded one from ebay with a CSR radio dmesg tells the following when inserting the dongle

[14841.127898] usb 3-1: New USB device found, idVendor=0a12, idProduct=0001
[14841.127902] usb 3-1: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[14841.127904] usb 3-1: Product: CSR8510 A10'''

lsusb says:
Bus 003 Device 006: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)

I'm on Ubuntu 18.04.03 with bluez version 5.50 and a 4.15.0.72 kernel

hciconfig -a gives this:
hci0:   Type: Primary  Bus: USB
    BD Address: 00:1A:7D:DA:71:10  ACL MTU: 640:4  SCO MTU: 64:8
    UP RUNNING PSCAN 
    RX bytes:1059 acl:0 sco:0 events:68 errors:0
    TX bytes:4856 acl:0 sco:0 commands:59 errors:0
    Features: 0xff 0xff 0x8f 0xfa 0x9b 0xff 0x59 0x87
    Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3 
    Link policy: RSWITCH HOLD SNIFF PARK 
    Link mode: SLAVE ACCEPT 
    Name: 'm4'
    Class: 0x0005a0
    Service Classes: Unspecified
    Device Class: Peripheral, Pointing device/(reserved)
    HCI Version: 4.0 (0x6)  Revision: 0x3120
    LMP Version: 4.0 (0x6)  Subversion: 0x22bb
    Manufacturer: Cambridge Silicon Radio (10)

HCI version 0x6 tells this is BT 4.0 so I expect this to support low energy

and when running btmon while doing the hcitool lescan I get:

@ RAW Open: hcitool (privileged) version 2.22                                                                                                                                      {0x0003} [hci0] 4.241634
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7                                                                                                                               #1 [hci0] 4.241692
        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] 4.244446
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Unknown HCI Command (0x01)
@ RAW Close: hcitool  

Anyone a suggestion to get this working?


Solution 1:[1]

Just to mention -- you can use the following command to request your dongle's Local Supported Features:

sudo hcitool -i hci0 cmd 0x4 0x3
< HCI Command: ogf 0x04, ocf 0x0003, plen 0
> HCI Event: 0x0e plen 12
  01 03 10 00 FF FF 8F FA 9B FF 59 87

You can also manually parse the output of your hciconfig -a command above, since that already gives you the same result, if you look closely:

Features: 0xff 0xff 0x8f 0xfa 0x9b 0xff 0x59 0x87

According to the Bluetooth Core spec, your Byte 4 (0x9b) maps to:

                                        Byte  Bit
32 EV4 packets                            4   0
33 EV5 packets                            4   1
34 Reserved for future use                4   2
35 AFH capable Peripheral                 4   3
36 AFH classification Peripheral          4   4
37 BR/EDR Not Supported                   4   5
38 LE Supported (Controller)              4   6
39 3-slot Enhanced Data Rate ACL packets  4   7

...where the Bit 6 is cleared, indicating LE is not supported by your Controller.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1