cagnulein / qdomyos-zwift

Zwift bridge for smart treadmills and bike/cyclette
https://www.qzfitness.com/
GNU General Public License v3.0
386 stars 110 forks source link

[BUG] Bluetooth volume controls on Android not working to change gears #2614

Closed marklogan17 closed 3 weeks ago

marklogan17 commented 1 month ago

Running QZ on android - tried Samsung Galaxy tab 6 lite, S20FE phone and OnePlus Open phone. Connecting to Echelon EX-1 bike. Configured setting for ‘volume buttons to change gears’. Run QZ, connect to bike, hit start (tried while paused with same results), Resistance gets set to the minimum that is configured. Use volume buttons on device and gears change as expected. Use volume changer on Bluetooth device and the ‘Bluetooth’ volume changes on the tablet or phone but no change to gears. Tried a Bluetooth audio device with volume and prev/next buttons - neither the volume nor the prev/next buttons worked. Also tried my Bluetooth earbuds with same result.

Note that when you use the volume buttons the ‘volume’ on the phone/tab doesn’t change. When I use the Bluetooth volume controls the actual volume on the phone/tab changes.

Looked in the log file (attached) and you can see the OnVolumeUpButton call when using the physical buttons but no other log entries at all that I could find for when the Bluetooth volume changed.

I did a little research and found that Android passes media events to the most recent media source. Some people have worked around it by playing a quick sound at start to make it a media source. Not sure if that’s the problem since the physical volume buttons worked, but I guess it’s possible. All the devices are on recent android so there could also have been a change to the API.

This link shows the flow chart for how they find the right app to send media events to. I’m not sure its changed recently so again, not convinced that this is the source of the problem https://developer.android.com/media/legacy/media-buttons

Two logs attached, one from S6 tab and one from OnePlus Open phone. OnePlus log has a ‘volume down’ event too.

debug-Sat_Sep_21_14_31_33_2024.log debug-Sat_Sep_21_15_20_42_2024.log

cagnulein commented 1 month ago

thanks mark i will try to investigate this. the only strange thing is that it's working with the majority of the users, maybe it's something about the bluetooth remote that you are using? is it a bluetooth 2.0? i will try on my pixel 6 to check that's working properly and i will update you

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

Il giorno dom 22 set 2024 alle 01:01 marklogan17 @.***> ha scritto:

Assigned #2614 https://github.com/cagnulein/qdomyos-zwift/issues/2614 to @cagnulein https://github.com/cagnulein.

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2614#event-14350697894, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWAUDKN3ELIV3WNDLETZXX3GLAVCNFSM6AAAAABOT7EOGKVHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJUGM2TANRZG44DSNA . You are receiving this because you were assigned.Message ID: @.***>

marklogan17 commented 1 month ago

The problem could be the device, although it’s the same one that @Brodie01 uses for iOS (he opened the issue for the prev/next track suggestions - #2347. I also tested with a pair of Bluetooth earbuds and got the same result. Happy to try something else too.

Here’s the device. It’s Bluetooth 5.3: https://www.amazon.ca/dp/B0C5CZDT65?ref=ppx_yo2ov_dt_b_fed_asin_title

cagnulein commented 1 month ago

ok i guess the difference it's because it's not a bluetooth 2.0 i will check this in the next days

cagnulein commented 4 weeks ago

@marklogan17 i created a branch for this the new apk will be here at the bottom https://github.com/cagnulein/qdomyos-zwift/actions/runs/10990878591

can you try to give it a go: i'm just logging the events, it will not change the gears. let's see if it's better show me a debug log then thanks

cagnulein commented 4 weeks ago

sorry new link https://github.com/cagnulein/qdomyos-zwift/actions/runs/10992013380/job/30515561534

cagnulein commented 4 weeks ago

new one https://github.com/cagnulein/qdomyos-zwift/actions/runs/10995996933/artifacts/1966678511 @marklogan17

marklogan17 commented 4 weeks ago

New log... debug-Mon_Sep_23_10_50_23_2024.log

Nagusia commented 4 weeks ago

Just to say that by chance I downloaded the QZ app today and have experienced the exactly same problem as described by marklogan17 in the first post above. My setup is Zwift on ATV with QZ app on a Pixel 4A. I have tried three different bluetooth headphones (Bluetooth 3.0, 4.1 and 5.1). I can get everything working (including Zwift Play controllers and HRM) via QZ and can use the phone volume control to change gear but not the bluetooth. If it helps I will work out how to get a debug log to you.

cagnulein commented 4 weeks ago

@Nagusia Hi, give it a try to this build too https://github.com/cagnulein/qdomyos-zwift/actions/runs/10995996933/artifacts/1966678511

It's promising

Nagusia commented 4 weeks ago

Hi. I've given it a try but still can't get gear changes with bluetooth volume control. Here's a debug log - hope I've done it right. With Android these days the only way to get at settings/profile/debug files is using ADB. debug-Mon_Sep_23_20_18_26_2024.log

cagnulein commented 4 weeks ago

Thanks I will check it tomorrow. What do you mean about adb?

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

Il giorno lun 23 set 2024 alle 20:35 Nagusia @.***> ha scritto:

Hi. I've given it a try but still can't get gear changes with bluetooth volume control. Here's a debug log - hope I've done it right. With Android these days the only way to get at settings/profile/debug files is using ADB. debug-Mon_Sep_23_20_18_26_2024.log https://github.com/user-attachments/files/17102568/debug-Mon_Sep_23_20_18_26_2024.log

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2614#issuecomment-2369069643, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWEOUCZWNAW4E75KTGTZYBNPHAVCNFSM6AAAAABOT7EOGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRZGA3DSNRUGM . You are receiving this because you were mentioned.Message ID: @.***>

marklogan17 commented 4 weeks ago

Hi. I've given it a try but still can't get gear changes with bluetooth volume control. Here's a debug log - hope I've done it right. With Android these days the only way to get at settings/profile/debug files is using ADB. debug-Mon_Sep_23_20_18_26_2024.log

The debug logs are in the Documents/QZ folder. You should be able to get there with any Android File manager app....

Nagusia commented 4 weeks ago

The debug logs are in the Documents/QZ folder. You should be able to get there with any Android File manager app....

Not on my Pixel 4A (Android 13), but on a Samsung Tab A8 (Android 14) the folder is there.

What do you mean about adb?

On the Pixel, I get "access denied" with the folders where the QZ files are stored, even if I use the CX File Manager. The only way I can access them is via ADB and a terminal window on a PC.

Anyway, I am going to try this using the Samsung Tab tomorrow.

cagnulein commented 4 weeks ago

Enable the android document setting in the experimental setting to fix this

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

Il giorno lun 23 set 2024 alle 22:22 Nagusia @.***> ha scritto:

The debug logs are in the Documents/QZ folder. You should be able to get there with any Android File manager app....

Not on my Pixel 4A (Android 13), but on a Samsung Tab A8 (Android 14) the folder is there.

What do you mean about adb?

On the Pixel, I get "access denied" with the folders where the QZ files are stored, even if I use the CX File Manager. The only way I can access them is via ADB and a terminal window on a PC.

Anyway, I am going to try this using the Samsung Tab tomorrow.

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2614#issuecomment-2369301911, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWB474OY52CHWYL6MCDZYB2B7AVCNFSM6AAAAABOT7EOGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRZGMYDCOJRGE . You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 4 weeks ago

Hi. I've given it a try but still can't get gear changes with bluetooth volume control. Here's a debug log - hope I've done it right. With Android these days the only way to get at settings/profile/debug files is using ADB. debug-Mon_Sep_23_20_18_26_2024.log

I checked the log and I can see 5 events of volume up in this log with gears up for 5 times. Don't you see that? Or were you using the volume of your phone?

Nagusia commented 4 weeks ago

Yes, I 'm afraid I could only change gear with the phone's volume control (no effect on volume). The bluetooth headphones would only change volume with no effect on gears.On 24 Sept 2024 09:18, Roberto Viola @.***> wrote:

Hi. I've given it a try but still can't get gear changes with bluetooth volume control. Here's a debug log - hope I've done it right. With Android these days the only way to get at settings/profile/debug files is using ADB. debug-Mon_Sep_23_20_18_26_2024.log

I checked the log and I can see 5 events of volume up in this log with gears up for 5 times. Don't you see that? Or were you using the volume of your phone?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 4 weeks ago

so in the log you pressed the phone one? are you able to collect an adb logcat from this phone while you are changing the volume with the bluetooth one?

Nagusia commented 4 weeks ago

I pressed both but it seems the log only picks up the phone volume control.Re the logcat I will have a go. A bit above my skill level but it can't be that difficult, can it?I also need to try the tablet as well to see if that works.On 24 Sept 2024 14:06, Roberto Viola @.***> wrote: so in the log you pressed the phone one? are you able to collect an adb logcat from this phone while you are changing the volume with the bluetooth one?

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 4 weeks ago

I guess the tablet will have the same behaviour. If you can run a adb logcat it will be perfect otherwise we can wait @marklogan17 for the end of the week.

Nagusia commented 4 weeks ago

Do you need the logcat with QZ running at the same time as the bluetooth controller? Or just the bluetooth? It's a logistics problem at my end.On 24 Sept 2024 14:40, Roberto Viola @.***> wrote: I guess the tablet will have the same behaviour. If you can run a adb logcat it will be perfect otherwise we can wait @marklogan17 for the end of the week.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 4 weeks ago

yes with QZ running and also with the remote connected and while you are pressing several times the buttons, thanks

Nagusia commented 4 weeks ago

Here you go. I changed gear with the phone volume control once or twice, and then tried with the Bluetooth headphone which I was listening to.

From: Roberto Viola @.> Sent: Tuesday, September 24, 2024 3:00 PM To: cagnulein/qdomyos-zwift @.> Cc: Nagusia @.>; Mention @.> Subject: Re: [cagnulein/qdomyos-zwift] [BUG] Bluetooth volume controls on Android not working to change gears (Issue #2614)

yes with QZ running and also with the remote connected and while you are pressing several times the buttons, thanks

— Reply to this email directly, view it on GitHubhttps://github.com/cagnulein/qdomyos-zwift/issues/2614#issuecomment-2371204647, or unsubscribehttps://github.com/notifications/unsubscribe-auth/BLQVTMANILOWMQOEDVNKEN3ZYFO3PAVCNFSM6AAAAABOT7EOGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZRGIYDINRUG4. You are receiving this because you were mentioned.Message ID: @.**@.>>

cagnulein commented 4 weeks ago

thanks but you have to attach the file on github web interface otherwise i can't see it @Nagusia

Nagusia commented 4 weeks ago

logcatQZ.zip Like this?

cagnulein commented 4 weeks ago

yes perfect, i'm checking it

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

Il giorno mar 24 set 2024 alle ore 16:40 Nagusia @.***> ha scritto:

logcatQZ.zip https://github.com/user-attachments/files/17116276/logcatQZ.zip Like this?

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2614#issuecomment-2371506441, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWBSUNFKTCPY4FVILBDZYF2VJAVCNFSM6AAAAABOT7EOGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZRGUYDMNBUGE . You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 4 weeks ago

perfect i did a modification based on

09-24 16:19:00.055 2465 2465 I vol.VolumeDialogImpl: showH r=volume_changed

on your logcat.

I will publish it the new apk when it's ready, more or less 30 minutes

Nagusia commented 4 weeks ago

Great. I have done another logcat with the Samsung Tab. Same process and result re gear change. logcatQZtab.zip

cagnulein commented 4 weeks ago

here the new one https://github.com/cagnulein/qdomyos-zwift/actions/runs/11016387178/artifacts/1972313610 it will not change the gears yet, but you can share a log cat with the debug log enabled also in qz so i can check if the flow is correct let me know!

cagnulein commented 4 weeks ago

wait i need to do another small thing

cagnulein commented 4 weeks ago

new one here https://github.com/cagnulein/qdomyos-zwift/actions/runs/11016941179/artifacts/1972483227 same as above, show me a adb logcat when you test, thanks!

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

Il giorno mar 24 set 2024 alle 17:02 Nagusia @.***> ha scritto:

Great. I have done another logcat with the Samsung Tab. Same process and result re gear change. logcatQZtab.zip https://github.com/user-attachments/files/17116617/logcatQZtab.zip

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2614#issuecomment-2371568588, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWG7Z3OBY46GYRY5NQDZYF5JNAVCNFSM6AAAAABOT7EOGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZRGU3DQNJYHA . You are receiving this because you were mentioned.Message ID: @.***>

Nagusia commented 4 weeks ago

I had an issue with a trial expired notification with this version but I managed to make a couple of clicks with the bluetooth volume control before this happened. Here is the logcat: logcatQZ2.zip

Nagusia commented 3 weeks ago

debug-Tue_Sep_24_19_43_03_2024.log Here is the debug.

cagnulein commented 3 weeks ago

It's working! Tomorrow I will do the final implementation! Thanks for your help

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

Il giorno mar 24 set 2024 alle 20:08 Nagusia @.***> ha scritto:

debug-Tue_Sep_24_19_43_03_2024.log https://github.com/user-attachments/files/17118730/debug-Tue_Sep_24_19_43_03_2024.log Here is the debug.

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2614#issuecomment-2371972440, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWHD2GR5ZZJNOWWQQV3ZYGTCXAVCNFSM6AAAAABOT7EOGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZRHE3TENBUGA . You are receiving this because you were mentioned.Message ID: @.***>

cagnulein commented 3 weeks ago

@Nagusia if i'm right this will work! https://github.com/cagnulein/qdomyos-zwift/actions/runs/11028066142/artifacts/1975526018

Nagusia commented 3 weeks ago

Almost there. Both + or - on the volume control shift gears down. -1, -2 etc. Can't shift up.

cagnulein commented 3 weeks ago

can you share a debug log?

Nagusia commented 3 weeks ago

debug-Wed_Sep_25_10_01_24_2024.log

cagnulein commented 3 weeks ago

ok i guess i fixed, i will send you the new one in 30 minutes

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

Il giorno mer 25 set 2024 alle ore 10:15 Nagusia @.***> ha scritto:

debug-Wed_Sep_25_10_01_24_2024.log https://github.com/user-attachments/files/17127662/debug-Wed_Sep_25_10_01_24_2024.log

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2614#issuecomment-2373385046, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWCAYGNRM567ATIA5VTZYJWL7AVCNFSM6AAAAABOT7EOGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZTGM4DKMBUGY . You are receiving this because you were mentioned.Message ID: @.***>

Nagusia commented 3 weeks ago

OK. Will try later. Going out for a coffee!

cagnulein commented 3 weeks ago

new build https://github.com/cagnulein/qdomyos-zwift/actions/runs/11029092930/artifacts/1975805752

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

Il giorno mer 25 set 2024 alle ore 10:20 Nagusia @.***> ha scritto:

OK. Will try later. Going out for a coffee!

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2614#issuecomment-2373393989, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWCFX766OI3I625OUMLZYJW3HAVCNFSM6AAAAABOT7EOGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZTGM4TGOJYHE . You are receiving this because you were mentioned.Message ID: @.***>

Nagusia commented 3 weeks ago

Yes. That seems to work. With one headset the change was a bit chaotic with the shifting jumping around (Shokz Open Pro). With the older Griffin iClip headphone, which has more of solid click it works perfectly with the gears changing in order one at a time. (I am not sure where I can adjust how many gears can be shifted with each click.). Will try out more thoroughly this afternoon but for now debug-Wed_Sep_25_13_35_14_2024.log debug-Wed_Sep_25_13_50_35_2024.log I have attached the debugs for each.

Nagusia commented 3 weeks ago

Found gears gain option. :-)

cagnulein commented 3 weeks ago

perfect! so do you have a problem of "debouncing" the click or you are good to go?

Nagusia commented 3 weeks ago

Depends which headphones I use. Is there a denouncing option? I think I've seen it somewhere but wasn't sure what it meant.

cagnulein commented 3 weeks ago

there is the setting but i didn't handle for this specific case, would you like to add this as well?

Nagusia commented 3 weeks ago

If it could avoid erratic shifts I guess it would be a good idea. Where is the denouncing option?

cagnulein commented 3 weeks ago

ok i'm adding it, i will send the new apk in 30 minutes it's under the accessories->zwift->debounce

cagnulein commented 3 weeks ago

new build https://github.com/cagnulein/qdomyos-zwift/actions/runs/11033778084/artifacts/1977078856

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

Il giorno mer 25 set 2024 alle ore 15:12 Nagusia @.***> ha scritto:

If it could avoid erratic shifts I guess it would be a good idea. Where is the denouncing option?

— Reply to this email directly, view it on GitHub https://github.com/cagnulein/qdomyos-zwift/issues/2614#issuecomment-2374050800, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAALYWEPG55ZH2N3DBQ6XUTZYKZDTAVCNFSM6AAAAABOT7EOGKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNZUGA2TAOBQGA . You are receiving this because you were mentioned.Message ID: @.***>

Nagusia commented 3 weeks ago

All good now. The only problem is that the app's trial period times out! Would it be possible to have a full version? In any case, I've enjoyed helping you with this. The app is fantastic and seems to work better than the Zwift Companion (much faster connection and apparently more solid with ATV), as well as offering the option of virtual shifting.

cagnulein commented 3 weeks ago

sure @Nagusia send me an email to roberto.viola83 at gmail.com indicating this ticket! Set then the same email where you are sending me it to the email setting in qz all lower case to unlock it