I have a USB Bluetooth dongle on my Raspberry Pi. I added an SP (serial port) service to my Pi.
Every time, the other device that has been connected to the Pi through the SP service disconnects, the Bluetooth dongle shuts down. The LED no longer blinks and I can no longer connect to it either.
dmesg doesn't observe any device change,
lsusb still has the dongle.
When this happens, there are two ways to get the dongle back working. One is to re-plug the USB dongle, the other is to sudo
service bluetoothd restart. The second one will re-initialize all Bluetooth services and remove my SP service, therefore I usually use the first solution.
Does any one know what the problem might be? The Pi has a powered USB hub, and all other USB devices are connected to the powered hub.
I am not sure how related this is, but every time the Bluetooth dongle on the Raspberry Pi connects or is connected to some other device (including my Android phone's serial terminal or the Bluetooth GPS modules), the state output in
hciconfig of hci0 is changed from "UP RUNNING PSCAN" to "UP RUNNING", and is never changed back even when the other device is disconnected.
hciconfig reset will get the state "UP RUNNING PSCAN" back, but I need the Pi running independently without keyboard or other manually interruption. What might be a solution?