Reputation: 1
When I run my code, written in C++ on geany it successfully connects then disconnects to a BLE device, which is good. However, after it has been run once whenever I try to run it again it fails to identify any devices. I then run:
sudo hciconfig hci0 down
sudo hciconfig hci0 up
and get the error:
Can't init device hci0: Connection timed out (110)
Currently the only thing that works is restarting the Raspberry Pi. I have been pretty stumped trying to fix this without restarting the raspberry Pi.
For additional context to first run the code I must first turn off bluetooth in the OS then:
raspberrypi:~/Documents/my_project $ sudo hciconfig hci0 down
sudo hciconfig hci0 up
raspberrypi:~/Documents/my_project $ sudo ./bluetooth 90:39:5E:7F:D0:BB
Failed to bind to HCI device: Device or resource busy
raspberrypi:~/Documents/my_project $ sudo ./bluetooth 90:39:5E:7F:D0:BB
Failed to bind to HCI device: Operation not possible due to RF-kill
raspberrypi:~/Documents/my_project $ sudo rfkill unblock bluetooth
raspberrypi:~/Documents/my_project $ sudo ./bluetooth 90:39:5E:7F:D0:BB
Finally my code connects on this line^
Any help on initialization steps to add to my c++ code would be great.
Honestly just been using chatgpt so far to try solve the isssue however nothing has worked
Upvotes: 0
Views: 66