Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Internal BT wont work if USB-dongle is attached at boot #2

Closed
Appelg opened this issue Dec 29, 2020 · 6 comments
Closed

Internal BT wont work if USB-dongle is attached at boot #2

Appelg opened this issue Dec 29, 2020 · 6 comments

Comments

@Appelg
Copy link

Appelg commented Dec 29, 2020

This is probably a more generic BT/Linux/Raspbian-question but I'll try since you might have had the same problem.

I bought the ZEXMTE USB dongle. Got everything working fine.

But with one problem: If the USB-ZEXMTE-BT-dongle is attached when I boot the RPI-zero-w, the internal BT-adapter isn't found.
Only way to do it is to first boot the PI, then attach the USB-dongle. Minor problem, but still an inconvenience.

Do you have any pointers on how to troubleshoot this?

@Appelg
Copy link
Author

Appelg commented Dec 29, 2020

Ok so I figured it out.

The hciuart.service won't start if the bluetooth-usb-dongle is connected. Unless this is running, the internal BT-adapter won't show up.
No idea if this is working as intended or if I did something wrong.

Workaround:

  • disable USB device
  • start hciuart.service
  • enable USB device

@djwasser
Copy link

@Appelg - thanks for the info. Using this as a start I modified run.sh on my installation so that the keiser service is able to start automatically on powerup/reboot. I used info from here to figure out how to enable/disable the specific port the USB BLE dongle is using and put that into run.sh
Pretty much of a hack, but everything starts up and works fine and has been rock solid. Here is contents of my modified run.sh for reference:

#!/bin/sh

echo '1-1.3' | sudo tee /sys/bus/usb/drivers/usb/unbind
sudo systemctl start hciuart.service
echo '1-1.3' | sudo tee /sys/bus/usb/drivers/usb/bind

hciconfig hci0 up
hciconfig hci1 up
/home/pi/.config/nvm/versions/node/v10.22.0/bin/node index.js

@Appelg
Copy link
Author

Appelg commented Jan 22, 2021

I did about the same, works well!

@Appelg Appelg closed this as completed Jan 22, 2021
@robcalm
Copy link

robcalm commented Jan 24, 2021

I was living with this issue too. Thanks very much for the workaround!

@nealjane
Copy link

nealjane commented Jan 27, 2021

Dont think the extra text has worked in my run.sh as it didn’t show until I pulled and plugged in the extra usb bluetooth after boot for some reason..

But, I’ve worked it out -
echo '1-1.3' = is specific to you as you are probably using a hub,
By altering it to - echo '1-1' Switches off everything on my usb for 10 seconds (whether I’m using a hub or headless with only Bluetooth plugged in)

@djwasser
Copy link

@nealjane @robcalm @Appelg @hypermoose:

FYI, I found what I believe is a better and more generic fix for the BT startup issue. As sudo, edit /etc/rc.local and add the following line:

modprobe -r btusb && systemctl start hciuart.service && modprobe btusb

/etc/rc.local runs on reboot after all of the system services have started and before switching to multiuser run level.

Then the (non-generic!) lines added to run.sh are no longer needed and can be removed:

echo '1-1.3' | sudo tee /sys/bus/usb/drivers/usb/unbind
sudo systemctl start hciuart.service
echo '1-1.3' | sudo tee /sys/bus/usb/drivers/usb/bind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants