SFU-Embedded-Cosplay / Halo-Suit-BeagleBone

2 stars 0 forks source link

Bluetooth silently fails #35

Closed Tyler-R closed 8 years ago

Tyler-R commented 8 years ago

When Bluetooth in being initialized it calls set_bluetooth_mode which will occasionally fail if it cannot set the scan mode. When this error occurs the error message: " Can't set scan mode on hci0: Connection timed out (110)" or "Can't set scan mode on hci-1: No such device (19)" will be logged and printed to standard error. This causes BeagleBlue_init to skip spawning the threads that handle connection and communication from the Android device and Google glass resulting in it not being possible for the Andorid phone to connect to the BeagleBone.

I am currently not certain as to specifically what the two error messages mean, but we should find this out and discover a way to gracefully handle this error condition.

dakcanada commented 8 years ago

He He He, "Gracefully".

So this rules out pulling our hair and shaking our fists?

Deanna Kehler P: 604-953-0664 E: deannakehler@gmail.com

On Mon, Mar 21, 2016 at 6:10 PM, Tyler Rubenuik notifications@github.com wrote:

When Bluetooth in being initialized it calls set_bluetooth_mode which will occasionally fail if it cannot set the scan mode. When this error occurs the error message: " Can't set scan mode on hci0: Connection timed out (110)" or "Can't set scan mode on hci-1: No such device (19)" will be logged and printed to standard error. This causes BeagleBlue_init to skip spawning the threads that handle connection and communication from the Android device and Google glass resulting in it not being possible for the Andorid phone to connect to the BeagleBone.

I am currently not certain as to specifically what the two error messages mean, but we should find this out and discover a way to gracefully handle this error condition.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/SFU-Embedded-Cosplay/Halo-Suit-BeagleBone/issues/35

Tyler-R commented 8 years ago

no, I'm sure we can find a way to gracefully pull out our hair :)

Tyler-R commented 8 years ago

It looks like the error message "Can't set scan mode on hci-1: No such device (19)" occurs when the Bluetooth dongle does not get enough power on boot, thus not turning on. When this occurs it is impossible to send Bluetooth messages until the Beaglebone is rebooted. We could add automatic rebooting when Bluetooth is not enabled, but I suspect this will result in an infinite reboot loop at some point, so I would advise against it.

To make it easier to detect when there is an issue with the Bluetooth dongle, I added a module that will change the led's on the Beaglebone when the program does not detect the Bluetooth dongle. In this situation it will turn on the boards 2 right most led's to give you a way to physically detect when Bluetooth is not working and which indicates that you should manually reboot the system. The change can be seen in pull request #38, specifically commit 617a0ff8f1a342f71ede697e943fed8ba9562e1e.