0

I have a CSR 4.0 Bluetooth dongle on my Raspberry Pi. When Raspbian starts, hciconfig shows that the state of hci0 is "UP RUNNING PSCAN".

However, every time I connect to the Pi's Bluetooth serial port (I configured that myself) from my laptop or Android phone, its state changes to "UP RUNNING" and never changes back. Same thing happens when I run cgps on the Pi to connect to a Bluetooth GPS module.

I checked my Ubuntu laptop, the state of hci0 on my laptop is just "UP RUNNING PSCAN", and is not changed even when I connect it to the Raspberry Pi. I am wondering if I have mis-configured somewhere in Raspbian or something else... However, I am not sure because my laptop uses its built-in Bluetooth adapter, not the CSR 4.0 module.


Updated 7/11/2015:

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...
  5. Effect of 4 is NOT kept after hci0 is unplugged and plugged back, but is kept after hci0 is reset by hciconfig hci0 reset.

Updated 7/16/2015:

The Raspberry Pi with the described problem runs Raspbian w/ Linux 3.18.11+

I just noticed that the same problem is NOT reproduced on another Raspberry Pi which runs Raspbian w/ Linux 3.10-3-rpi. However, I cannot be sure if this problem is kernel-specific.

0

I still don't know what is the cause of this problem. Therefore if any of you find out what the cause is or have a better solution than my workaround, please append it to your answer here.


I made a workaround that periodically check the state of HCI devices using hciconfig, and also call hciconfig to bring those who are not in PSCAN state back to PSCAN state.

The code can be found on my GitHub, in this repo: https://github.com/bfrggit/hci_pscan. Implementation details can be found in the README file. My scripting language is Ruby, so you will need Ruby if you want to apply this workaround.

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.