1

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?

1 Answer 1

3

I managed to figure out the possible problem myself. However, I didn't find an elegant solution to that.

The problem does not occur upon disconnection. Actually it occurs upon connection. Every time my Pi connects to my Bluetooth GPS module, or my laptop connects to my Pi, the state of hci0 changes from "UP RUNNING PSCAN" to "UP RUNNING", and prevents succeeding incoming connections.

Simply speaking, Raspbian starts up with Bluetooth set to "UP RUNNING PSCAN", but "PSCAN" is lost when a connection is established.

Since the problem has not been elegantly solved, please refer to this thread for a more reasonable description of the problem, and possible solutions or workarounds. USB Bluetooth dongle loses its "PSCAN" state when connected via Bluetooth serial port

The following operations will reset the "PSCAN" state:

  1. sudo service bluetooth restart. Not recommended because this clears my manually created SP service. Same problem happens the next time a device connects to the Pi.
  2. Manually unplug the USB Bluetooth dongle and plug it back in. Same problem happens the next time a device connects to the Pi.
  3. sudo hciconfig hci0 reset. Same problem happens the next time a device connects to the Pi.
  4. sudo hciconfig hci0 pscan. Surprisingly, the same problem does not happen the next time a device connects to the Pi. Namely, after I manually run sudo hciconfig hci0 pscan, the "PSCAN" state is kept...

Due to 4, I am thinking if there is a configuration file for hciconfig or the bluetooth service that controls the "PSCAN" state. AGAIN, since the problem has not been elegantly solved, please refer to this thread for a more reasonable description of the problem, and possible solutions or workarounds. USB Bluetooth dongle loses its "PSCAN" state when connected via Bluetooth serial port

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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