noble / noble

A Node.js BLE (Bluetooth Low Energy) central module
MIT License
3.41k stars 865 forks source link

onSocketError: File descriptor in bad state #660

Open Mierenga opened 7 years ago

Mierenga commented 7 years ago

I have been experiencing an issue on a number of Debian pi 2 devices. Every so often something in the bluetooth stack crashes and brings down hci0 (not sure why at this point). After bringing back up hci0 and successfully testing its abilities (with various tools such as bluetoothctl, hcitool lescan, python-bluez, and noble's own dependency bluetooth-hci-socket), I can't get a new instance of a noble app to move noble from the 'unknown' state.

I did a little logging in noble/lib/hci-socket/hci.js Hci.prototype.onSocketError and found the error.message to be File descriptor in bad state.

Currently trying to trace where/what/why that error comes from and how to fix without a full reboot.

sandeepmistry commented 7 years ago

Hi @Mierenga,

Maybe a HCI dump capture will provide more info sudo hcidump -t -x. What Bluetooth adapter are you using? Have you tried others?