I have a C program that works well the first time it runs (BLUEZ C API) but if I press CTRL+C to stop it and then if I run it again it never finds any BLE device (scanning function). If I reboot linux it works again. My program is in a while(1) loop scanning and printing device info (including manufacturer data) and calls:


are outside loop.

The program must survive to this event (CTRL+C) because I am planning to put it into a linux service in order to be possible to restart it automatically if it hangs or something.

So, it seems that I need to perform some cleaning before launching program the second time (to avoid reboot), right?

But what?


You can use (at the command line):

sudo hciconfig hci0 reset

I don't know the C equivalent...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.