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'm not sure, what exactly happens here. My iPhone is advertising here.
I'm using a BLE dongle from IOGear.
However, if I restart my machine, it shows the a MAC address after I issue the lescan
command, and starts showing the same error after I issue the lescan command a couple of more times. Is it like, the lescan command cannot be issued more than once?
Just use sudo & will scan
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.
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 athci0
.After these commands,
sudo hcitool lescan
and its variants all seem to work.I had the same error with
hcitool
, whilebluetoothctl
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 ascan on
command.To those finding this question now, it is fixed as of Bluez v5.41. All you need to to is download and install. You can download the lastest version from http://www.bluez.org/download/.
What worked for me though is opening up the Bluetooth settings on my Ubuntu and manually removing the unused devices. Immediately lescan started working.