It has turned out to me that hcitool
is not capable of running lescan
on Bluetooth v5.X hardware. Running sudo hcitool lescan
would result in this error: Set scan parameters failed: Input/output error
.
The community suggests to use bluetoothctl
instead (e.g. here) but gatttool
is dependent on hcitool
for scanning ble devices. While gatttool
serves as a ble backend on many apps, still no solution is provided to resolve the Input/output error mentioned above. Does anybody know how to resolve the above error?
I have tested the full functionality of my BLE on Windows 10 but in Ubuntu I have failed so far. My laptop has the following bluetooth hardware:
$ hciconfig -a
hci0: Type: Primary Bus: USB
BD Address: 4C:1D:96:30:83:6E ACL MTU: 1021:4 SCO MTU: 96:6
UP RUNNING
RX bytes:8099 acl:34 sco:0 events:591 errors:0
TX bytes:11990 acl:34 sco:0 commands:452 errors:0
Features: 0xbf 0xfe 0x0f 0xfe 0xdb 0xff 0x7b 0x87
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH SNIFF
Link mode: SLAVE ACCEPT
Name: 'xxxx'
Class: 0x0c010c
Service Classes: Rendering, Capturing
Device Class: Computer, Laptop
HCI Version: 5.1 (0xa) Revision: 0x100
LMP Version: 5.1 (0xa) Subversion: 0x100
Manufacturer: Intel Corp. (2)
I have Ubuntu 20.04 with bluez v5.53.
gatttool and hcitool were both deprecated back in 2017.
D-Bus API is documented at: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc
And there are examples at: https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/test.
For exploration on the command line then either
btmgmt
orbluetoothctl
should cover most situations.