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

[REQ]: Bluetooth Device Exception List for Virtual Bridge #2695

Open
Novamusix opened this issue Oct 24, 2024 · 8 comments
Open

[REQ]: Bluetooth Device Exception List for Virtual Bridge #2695

Novamusix opened this issue Oct 24, 2024 · 8 comments
Assignees
Labels
enhancement New feature or request

Comments

@Novamusix
Copy link

Feature Request:
Is it possible to create an exception list to ignore specific Bluetooth devices/ID's from trying to connect to the virtual bridge? So in my case, I want to prevent the Echelon bike (ECHEX-3-189898, CE:AF:39:CD:C0:37) from trying to connect to the bridge and maybe other conflicting devices I may have identified, but allow all other devices such as the family's phones/tablets to connect via a 3rd party app.

Description:
I’m using QZ on a Raspberry Pi to connect to a Proform Treadmill with the Virtual Bluetooth bridge enabled. I successfully connect to the bridge via the Runna app (Android) to control the treadmill and follow structured training programs.

Recently, I purchased an Echelon Ex3 smart bike and use the QZ Android app to bridge it. However, I’ve noticed that when the Echelon bike is powered on, the treadmill bridge stops broadcasting.

Steps to Reproduce:

  1. Turn off all known Bluetooth devices
  2. Use phone to view available Bluetooth devices but don't pair
  3. Turn on only the treadmill and the Raspberry Pi
  4. Verify the treadmill bridge is broadcasting via the phone
  5. Wait 5 minutes and check treadmill bridge remains broadcasting and visible.
  6. Power on the Echelon bike.
  7. Observe that the treadmill bridge stops broadcasting and is no longer visible
  8. Raspberry PI remains connected to the treadmill but can longer be bridged

Additional Observations:

  • It appears the Echelon bike is trying to auto-connect to the treadmill’s virtual bridge but fails.
  • When my Garmin watch is set to manually broadcast heart rate within settings, the Echelon automatically connects to it after about a minute, even though I did not pair it.
  • Attached is debug file debug-Thu_Oct_24_11_59_44_2024.log with lines between 5060 to 5071 showing some attempt to connect and then being ignored at the same time I switched the Echelon on and when the bridge stopped being visible.

Thank you for you consideration

@Novamusix Novamusix added the enhancement New feature or request label Oct 24, 2024
@cagnulein
Copy link
Owner

cagnulein commented Oct 24, 2024 via email

@cagnulein
Copy link
Owner

cagnulein commented Oct 24, 2024 via email

@Novamusix
Copy link
Author

Thank you for looking into this.

I was able to do the following

  • Switch treadmill off
  • Switch echelon on
  • Restart RPi and type the following
# On the RPi, Block echelon mac address
bluetoothctl trust XX:XX:XX:XX:XX:XX
bluetoothctl block XX:XX:XX:XX:XX:XX
  • turn treadmill on with RPi connecting to treadmill
  • This kept the virtual bridge up and running for that session.
  • But restarting RPi , the echelon tried reconnecting bringing the virtual bridge down again.

In an attempt to make it permanent am investigating UDEV rules to trigger when echelon bluetooth tries to do an add action. Anyway, this will be a learning curve and not solved overnight, one step at a time :-)

Thanks once again for your direction and for the quick response.

@cagnulein
Copy link
Owner

image

@Novamusix
Copy link
Author

Thanks, but that didn’t work. When I ran sudo journalctl -u bluetooth, I got the following message:

Oct 25 09:15:30 treadmill bluetoothd[490]: src/main.c:check_options() Unknown key BlockedDevices for group Policy in /etc/bluetooth/main.conf

I also tried BlockDevices as suggested by ChatGPT, but still no luck.

After checking the GitHub source code for BlueZ (src/main.c), I found no reference to BlockedDevices, so it seems this option might be deprecated

static const char *policy_options[] = {
	"ReconnectUUIDs",
	"ReconnectAttempts",
	"ReconnectIntervals",
	"AutoEnable",
	"ResumeDelay",
	NULL
};

For now, I will revert to the old fashioned, switch the echelon off and on as needed :-). But will still keep exploring out of curiosity. Cheers

@cagnulein
Copy link
Owner

what about

sudo nano /etc/udev/rules.d/81-bluetooth-block.rules
Add this line:

ACTION=="add", ATTR{address}=="XX:XX:XX:XX:XX:XX", ATTR{authorized}="0"

@Novamusix
Copy link
Author

We’ve made some progress, but it’s not quite what I expected.

First, the UDEV rules seemed to be triggered (writing to a temporary log file), but the Bluetooth device was still able to connect when manually using bluetoothctl connect XX:XX:XX:XX:XX:XX, even with the rule ACTION=="add", ATTR{address}=="XX:XX:XX:XX:XX:XX", ATTR{authorized}="0".

It turns out the Echelon wasn’t connecting as I initially thought. Instead, when it became visible, it triggered something with the virtual bridge, causing it to go down.

To simplify things, I changed the QZ script from:

qdomyos-zwift -no-log -no-heart-service -qml -platform webgl:port=80

to:

qdomyos-zwift -no-gui -no-log -no-heart-service -name I_TL

To my surprise, the Raspberry Pi connects to the treadmill, controls it, and creates the virtual bridge, which stays up and running even with the Echelon on, with no interference.

It seems that using the QML web option was causing issues with the virtual bridge.

I’m happy to continue with this simpler approach since I only used the QML web option for the initial setup. However, it’s good to know in case this issue arises in the future.

@cagnulein
Copy link
Owner

cagnulein commented Oct 25, 2024 via email

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

No branches or pull requests

2 participants