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

[BUG] QZ-Raspberry Pi 4 does not connect with Zwift on Windows 10 #3132

Open
yetanotherbrian opened this issue Feb 1, 2025 · 45 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@yetanotherbrian
Copy link

Describe the bug
QZ built and running on fresh Raspberry Pi 4 Desktop does not connect to a fresh install of Zwift on Windows 10 using a TP-Link UB400 v1.6 Bluetooth 4.0 adapter (debug log "1--"). The QZ-RPi 4 DOES WORK with Zwift on iOS (debug log "2--") as well as a Windows 11 PC with embedded Intel Bluetooth.

The Zwift/Win10/UB400 DOES work fine with the QZ-iOS beta build (debug log "3--") so I don't believe Win10 is the entire issue.

To Reproduce

  1. Ensure no other apps running that should affect BT
  2. Start QZ on RPi4, wait for solid blue BT indicator in application
  3. Start Zwift on Win10/UB400 PC, select "POWER SOURCE" on Paired Devices screen

Expected behavior
Expect to see "QZPI" as available device. SOMETIMES it will appear and it can be selected. Selecting "RESISTANCE" on Paired Devices will not show QZPI as expected and will show the "Wahoo KICKR 0000 33" (virtual?) device and/or the regular "Wahoo KICKR C1E2 96" device. While on the RESISTANCE screen the POWER screen will unpair in the background (turn orange) and switching back to it the QZPI device will show "No Signal" and cannot be selected/will not be displayed if close/reopen/restart pairing screens.

Desktop (please complete the following information):
Windows 10, latest updates
newly bought TP-LINK UB400 v1.6 Bluetooth adapter. Have also tried with ~4 year old UB400 v1.0 Bluetooth adapter, and some other random ~4 year old'ish adapter.

Raspberry Pi 4, fresh install image updated/upgraded with git repository cloned on Jan 31.

Smartphone (please complete the following information):
iPhone 12 Pro Max,
iOS v18.1.1
QZ beta release

Append a debug log

QZ-RPi4-to-Win10-Zwift-Debug.zip

@yetanotherbrian yetanotherbrian added the bug Something isn't working label Feb 1, 2025
@yetanotherbrian
Copy link
Author

This is a pic from Win10 after first selecting QZPI on the "POWER" pop-up, switching to the "RESISTANCE" pop-up and selecting the only available "Wahoo KICKR 0000 33" option, and then returning to the "POWER" pop-up.

Image

@cagnulein
Copy link
Owner

Are you able to run nrfconnect on pc to check how you see qz from rpi4 from both windows pc?

@yetanotherbrian
Copy link
Author

Are you able to run nrfconnect on pc to check how you see qz from rpi4 from both windows pc?

I'm not familiar with nrfconnect, but yes.

So install "nRF Connect Desktop" separately on the Windows 10 AND the Windows 11 PCs and then check their interactions with RPi4 QZ?

@cagnulein
Copy link
Owner

cagnulein commented Feb 1, 2025 via email

@yetanotherbrian
Copy link
Author

Yes exactly. Theoritically we should see the same things

Roberto Viola
Software engineer and open source enthusiast
http://robertoviola.cloud

Il giorno sab 1 feb 2025 alle 21:01 yetanotherbrian <
@.***> ha scritto:

I've installed nRF Connect for Desktop v5.1.0 but I don't know what to do with it next. Do I need a Nordic dev kit to use it? I tried using the "Bluetooth Low Energy" module and the "Start scan" is grayed out, with "SELECT DEVICE" option at top telling me to "Connect a Nordic development kit to your computer".

Does one of the modules work with any brand BT radio?

I'm able to install the "nRF Connect for Mobile" on my iPhone just fine.

Image

@cagnulein
Copy link
Owner

I never used the nrfconnect on pc but should work as the ios one.
Otherwise try to find a similar app for pc that make a Bluetooth scan reporting Bluetooth characteristics from a Bluetooth device

I'm going to bed now
Have a nice evening

@yetanotherbrian
Copy link
Author

yetanotherbrian commented Feb 2, 2025

I found a program called BLE Scout that was supposed to be able to connect to a device and show its characteristics. It worked fine on Windows 11 (pic below) however it caused the RPi4 to stop advertising the QZPI address when done with Windows 10. I didn't wait more than a minute to see if the RPi4 recovered, and just quit the application.

Image

Below are the QZ debug files for three attempts at getting the characteristics, first from the iPhone with nRF Connect, second with BLE Scout and Windows 10, and third with BLE Scout and Windows 11. I rebooted the RPi4 between each run, started the BLE analyzer after the BT icon in QZ went solid (as soon as I could anyways -- the Win11 machine is on the other side of the house so there was a delay), and then closed QZ with the GUI quit option as soon as I could.

I diff'd the files a bit and see there is a GATT log entry for the iPhone and Win11 that isn't there for the Win10 PC.

RPi-debug-trying-to-Connect-with-BT-analyzer.zip

@cagnulein
Copy link
Owner

Ok I will check the log in the next days
Thanks

@yetanotherbrian
Copy link
Author

yetanotherbrian commented Feb 2, 2025

Ok I will check the log in the next days Thanks

EDIT: debug logs are from starting QZ on the RPi4, waiting for it to connect to the KICKRv5, and then using the Windows "BLE Scout" program to try to Connect to the "QZPI" that was being advertised.

Looking at the log files again, it seemed there might have been some noise from my Win11 PC being on the other side of the house and it not having a reliable connection to the KICKRv5.

I took the Win11 PC out in the garage and captured the debug log from the RPi4 using both the onboard Intel Bluetooth radio and then separately using the TP-Link UB400 v1.6 Bluetooth adapter (and default/generic Microsoft drivers). Intel worked, UB400 failed, so I'm confident it has nothing to do with Windows 10 now.

The RPi4 was restarted between each capture.

ZIP of log also has my filtered version that made visual diff'ing a little easier.
grep -v -E 'Current watt:|Current Speed:|Current Distance:|Current KCal:|Current CrankRevs:|Last CrankEventTime:|homeform|ergtable'

win11-bluetooth-probing-of-RPi4.zip

@cagnulein
Copy link
Owner

from the log i can't see anything unusual on the QZ side. the only thing that is very obvious is that on the FAIL one, no device is connected to the virtual interface of the raspberry at all.
But since the QZPI is always the same, i don't think the problem is there.

Stupid question: the UB400 is working fine for connecting zwift to your trainer directly?

@yetanotherbrian
Copy link
Author

yetanotherbrian commented Feb 3, 2025

from the log i can't see anything unusual on the QZ side. the only thing that is very obvious is that on the FAIL one, no device is connected to the virtual interface of the raspberry at all. But since the QZPI is always the same, i don't think the problem is there.

Stupid question: the UB400 is working fine for connecting zwift to your trainer directly?

Not only does the UB400 fine work in the PC with Zwift alone, it works fine when using QZ on the iPhone beta (and release) apps.

So problem somewhere in the Linux BT driver? I can rebuild code if there are debug levels that could be increased.

The iPhone using QZ with the UB400 log is in the first message of the issue.

@cagnulein
Copy link
Owner

ok with the BLE scout using the UB400 are you able to connect to QZPI?

@yetanotherbrian
Copy link
Author

ok with the BLE scout using the UB400 are you able to connect to QZPI?

Yes, BLE Scout did not crash when attaching to QZPI.

@cagnulein
Copy link
Owner

do you also see the same characteristic between running ble scout with intel and ub400?

@yetanotherbrian
Copy link
Author

do you also see the same characteristic between running ble scout with intel and ub400?

Disregard my last message. I was thinking you were asking about QZ on iOS-beta.

I cannot Connect to the QZPI Characteristics with the UB400 using BLE Scout, however I can connect to it with the Intel BT. That is the only actional done in the debug log I attached -- let QZ start up and find my KICKR, then before doing anything else try using BLE Scout to connect to the QZPI name.

@cagnulein
Copy link
Owner

that's the main thing. so you don't see the QZPI at all, or you can't connect to it?

@yetanotherbrian
Copy link
Author

yetanotherbrian commented Feb 3, 2025 via email

@cagnulein
Copy link
Owner

so it means that it can't connect somehow. i guess it's something about timing or similar

@yetanotherbrian
Copy link
Author

so it means that it can't connect somehow. i guess it's something about timing or similar

I saw lots of compiler warnings when I built on the RPi 4 but assumed they were all to be expected.

I don't know what the binary compatibility is between all the Pi's ... is there a binary you've built that I could try instead of my own?

@cagnulein
Copy link
Owner

cagnulein commented Feb 3, 2025 via email

@yetanotherbrian
Copy link
Author

Yes it's in the release page here on github but I don't think it's the issue

I'm a noob when it comes to Linux, but I get "sudo: unable to execute./qdomyos-zwift: No such file or directory" when trying to run the release file. Sudo'ing to su doesn't make a difference (tho results in slightly different error message?).

Image

@yetanotherbrian
Copy link
Author

yetanotherbrian commented Feb 3, 2025

Yes it's in the release page here on github but I don't think it's the issue

I'm a noob when it comes to Linux, but I get "sudo: unable to execute./qdomyos-zwift: No such file or directory" when trying to run the release file. Sudo'ing to su doesn't make a difference (tho results in slightly different error message?).

Image

I see strings on qdomyos-zwift shows a "/lib/ld-linux-armhf.so.3", and I don't see that existing on my system. Again, Linux noob (beyond Unix in the 90s I have faint memories of. 🤣).

Edit: but maybe that is a statically linked library.

@cagnulein
Copy link
Owner

cagnulein commented Feb 3, 2025 via email

@yetanotherbrian
Copy link
Author

chmod a+x qdomyos-zwift
To put it executable

No difference. See action/permissions in pic:

Image

@cagnulein
Copy link
Owner

Did you download the 32 or 64 bit? Your image is 32 or 64 bit? Must be the same

@yetanotherbrian
Copy link
Author

Did you download the 32 or 64 bit? Your image is 32 or 64 bit? Must be the same

I'm using "qdomyos-zwift" that is in

https://github.com/cagnulein/qdomyos-zwift/releases

@cagnulein
Copy link
Owner

cagnulein commented Feb 3, 2025 via email

@yetanotherbrian
Copy link
Author

This is the 32 bit version
https://github.com/cagnulein/qdomyos-zwift/actions/runs/13108575712/artifacts/2525637948

I believe I need the 64 bit? I'm using the default Raspberry Pi Desktop install from the Pi Imager.

My "uname -a" in screen pic above says it is "aarch64".

@cagnulein
Copy link
Owner

cagnulein commented Feb 3, 2025 via email

@yetanotherbrian
Copy link
Author

Yes I disabled auto build 64 bit because of bug of github actions in the
last month

Would it be worth trying to install the 32-bit Desktop on an SD card and trying the release build? I would like to get as close to a known good (that you are aware of) state as I can.

The RPi4 w/ my 64-bit QZ works fine with the UB400 BT adapter when using Win11 though.

@cagnulein
Copy link
Owner

cagnulein commented Feb 3, 2025 via email

@yetanotherbrian
Copy link
Author

As I said I don't think it's the cause
We can try to simplify the signal from qz to check when it starts to
connect.
I can do this in the next days

Ok, thanks!

@cagnulein
Copy link
Owner

cagnulein commented Feb 4, 2025 via email

@yetanotherbrian
Copy link
Author

one question: did you try to toggle "Relaxed Bluetooth for mad devices" in
the experimental settings in the QZPI and restarting QZ?

I had not previously tried.

I've done so now -- no change in the Win10 behavior. Now probing QZPI from either nRF Mobile (iPhone 12) or AE Scout (Win11) will cause the QZPI device name to stop being advertised/detected. Previously only probing with the AE Scout on Win10 did that.

@cagnulein
Copy link
Owner

cagnulein commented Feb 4, 2025 via email

@yetanotherbrian
Copy link
Author

Ok so probably the right spot? I mean changing it seems to extend the issue?

Yes, I would say that makes it worse.

@cagnulein
Copy link
Owner

cagnulein commented Feb 4, 2025 via email

@yetanotherbrian
Copy link
Author

Ok perfect so I will try to reduce that value layer today

Thanks.

I will be around the systems all day (at least during GMT+1) if you have anything you'd like me to try.

@cagnulein
Copy link
Owner

cagnulein commented Feb 4, 2025 via email

@yetanotherbrian
Copy link
Author

i created this, pull it and build it
#3146
let's see if it makes any difference. leave the mad device setting as
default

My noob'ness strikes again. I haven't seriously used a versioning system since ClearCase.

What exactly do I need to do with git from the command line to get that branch (?). I am still on the cloned repository.

Thanks.

@yetanotherbrian
Copy link
Author

i created this, pull it and build it
#3146
let's see if it makes any difference. leave the mad device setting as
default

If you missed it, I don't know what I'm doing with git.

I've tried the below, but still unsure how to pull it.

Image

@yetanotherbrian
Copy link
Author

i created this, pull it and build it
#3146
let's see if it makes any difference. leave the mad device setting as
default

If you missed it, I don't know what I'm doing with git.

I've tried the below, but still unsure how to pull it.

Image

I diff'd the virtualbike.cpp file on the repo and saw the changes to pars.setInterval. I modified my file and am building with that. I still need to learn the proper way to pull a dev branch/changes though.

@yetanotherbrian
Copy link
Author

Unclear how to check out the branch, it looked like the change was 2x instances of pars.setInterval(100,100) changing to 10,10, and I made the change to my local file and built it.

The QZPI appearing felt quicker to pop up in the Bluetooth monitors, but I don't think there was a change in behavior. The BLE Scout locked up when trying to Connect to the QZPI name/service from the Win10/UB400 adapter but continued to work fine from Win11/Intel and iOS.

Attached are two zips, one with the relaxed mode enabled, the other with relaxed mode disabled. I wasn't sure what was meant by default.

RPi4-relaxed-disabled-logs.zip
RPi4-relaxed-logs.zip

@cagnulein
Copy link
Owner

ok so i guess it's a dead end from the QZPI side.
Question: did you try to use different drivers version for the UB400?

@yetanotherbrian
Copy link
Author

ok so i guess it's a dead end from the QZPI side. Question: did you try to use different drivers version for the UB400?

I tried the vendor's drivers in the very beginning when I was only logging the Zwift app showing but not maintaining a connection to the QZPI name. When I didn't see a difference from the generic Microsoft drivers I switched back to Microsoft's.

I have downloaded some of the Bluetooth SIG docs recommended on the BlueZ.org site and will look through the code. I think leave the issue open for awhile and I'll come back later to provide an update if I've found the issue or gave up. In the meantime I'll use the iOS beta with the Win10+UB400+Zwift.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants