I\'m trying to do a lescan using hcitool on the raspberry pi.
The command prints out
Set scan parameters failed: Input/output error.
I had the same error with hcitool
, while bluetoothctl
worked just fine. Then I ran across this article stating that all "tools using raw socket shall be considered deprecated" (hcitool, hcicfg, etc.).
So maybe just open bluetoothctl
and issue a scan on
command.
I have removed Bluez and then I just installed it again, and it worked for me:
sudo apt remove --purge bluez bluez-* -y
apt install bluez
And then
hcitool lescan
That should be enough.
What worked for me though is opening up the Bluetooth settings on my Ubuntu and manually removing the unused devices. Immediately lescan started working.
I am using Version 5.53 I have two Bluetooth devices (hic0 and hic1) I tried all kinds of ways to to reset the devices ... The only way that worked was to physically unplug and re-insert the hic1 dongle. This is the one that supports ble. Then it works until I reboot. I really wish there was a pure software solution way to do this.
Upgrading to bluez v5.43 fixed this for me.
To upgrade to the newest bluez, you need to do a "manual" installation (not apt-get), downloading from the bluez website. I recommend this video walkthrough if you are new installing packages or need help.
After installing the latest bluez, I had to run a couple commands before it worked.
systemctl daemon-reload
: Restarts the system daemon.
sudo service bluetooth restart
: Restarts the Bluetooth service.
sudo hciconfig hci0 up
: This was needed for my Raspberry Pi 3, with the built-in BT found at hci0
.
After these commands, sudo hcitool lescan
and its variants all seem to work.
It is possible, that HCI is currently in use. In my case I must stop Node-Red and it works. So take care, that the HCI isn't in use.
Restart the HCI is a way, to solve the problem temporarily, but it doesn't solve the problem right.