Closed olee closed 5 months ago
Hey @olee
That sounds like a genius idea!! I never thought about it.
Indeed, if we could capture the volume key, or any other key that isn't captured by the USB streaming software, that would make things much easier!
Do you know by any chance how we could do that? Do you have maybe a snippet of code that shows how to capture volume buttons (or any other relevant button)?
I didn't investigate this any further yet, but my current guess is that changing the volume will modify a system file the same way as eg. the brightness modification you are doing. So just watching that particular file for any change could a really simple ... though kinda hacky ... solution, to get this resolved 🤔
That's a good idea.
Unfortunately, I looked into it a bit and I couldn't find a super straightforward way to find the volume.
amixer
, but unfortunately I'm not using a standard audio setup. I have a custom virtual sink that does convolution to get 7.1 surround sound. So my output of amixer
is vastly different from what other people would have, and we would end up with the same issue we have with the touchscreen at the moment (can't reproduce if there are issues)xbindkeys
may work, but it seems the steam deck is already using it with a custom config and I don't want to mess that up, it would make uninstalling more tricky)If you have more ideas I'd be happy to try
Wow ... seems like it is surprisingly difficult... One thing about your problem with having a different audio setup: Wouldn't it be fine to just watch all playback devices if any of them changes? There aren't many and if any one changes, it's definitely caused by some user interaction.
It's probably possible. The tricky part is that because I have a different setup than anyone else, I won't be able to make sure whatever I code works on non-modified steam decks. So this can quickly become a maintainability nightmare, with simple issues taking days or weeks to fix due to the back and forth, regaining context, etc...
My output at the moment is this:
Simple mixer control 'Master',0
Capabilities: pvolume pswitch pswitch-joined
Playback channels: Front Left - Front Right - Rear Left - Rear Right - Front Center - Woo
fer - Side Left - Side Right
Limits: Playback 0 - 65536
Mono:
Front Left: Playback 65398 [100%] [on]
Front Right: Playback 65398 [100%] [on]
Rear Left: Playback 65398 [100%] [on]
Rear Right: Playback 65398 [100%] [on]
Front Center: Playback 65398 [100%] [on]
Woofer: Playback 65398 [100%] [on]
Side Left: Playback 65398 [100%] [on]
Side Right: Playback 65398 [100%] [on]
Simple mixer control 'Capture',0
Capabilities: cvolume cswitch cswitch-joined
Capture channels: Front Left - Front Right
Limits: Capture 0 - 65536
Front Left: Capture 26213 [40%] [on]
Front Right: Capture 26213 [40%] [on]
Could you post your output for the amixer
command? Then please change the volume and post again.
I'm thinking maybe I could monitor Playback XXXXX
and see when that changes. I'm not sure how to monitor a value for change in bash, but if that's the only unknown I should be able to figure it out quickly
I checked it as well on my side and indeed, the Playback
value should be usable for this:
So simply running amixer
periodically and checking for Playback
value changes by regex (sed
?) etc. should already be working just fine. Actually, even just checking for any change in the whole output of amixer could be enough already.
Hi @olee
Thanks for the update. Yes, it does look like our outputs are similar enough to consider this a viable solution.
One thing I was a bit worried about was the fact that changing volume would change at different places in a vanilla setup vs my custom setup. And it is confirmed, when you changed the volume you can see it changed a different part of the output.
That being said, as you mentioned, checking for any change in the output should be enough. That's a very good point.
I'll try a quick prototype when I'll have some time to look at it.
Update
Unfortunately it wasn't as easy as expected. When running the amixer
within a the run_as_root
function, I get this error
amixer: Mixer attach default error: Host is down
I tried a couple of things to be able to call amixer
as the root user, but none of them worked.
My next thought was to see if I needed root at all, if we use the volume buttons. But we do need sudo for the virtualhere
tool itself. I also use sudo to ensure 2 things while Deckpad is running: Brightness remains low, the device doesn't go to sleep.
I could maybe rework the whole thing to split the process into parts that don't require sudo and parts that do. But there are 2 problems:
amixer
investigation today. I can see this large refactor take another 3-4h hours, and I unfortunately don't prioritize this project enough at the moment to dedicate it an entire afternoon.If you do have ideas or suggestions you'd like me to try, feel free to share. Maybe we can get around this amixer
error in some way? Or if you want to try and implement it yourself, I'd be happy to receive a PR.
Thanks for your help so far 👍
why not a combo of keys, like the four back buttons at the same time? the terminal quit method doesn't work on my device.
@DarkionAvey Yeah, that would be cool, but unfortunately, the whole reason I'm using the touchscreen and tried with the volume buttons is because the regular buttons are all sent to the remote computer and as far as I know we don't have access to them once 'virtualhere' is connected to the remote PC.
However, if you can think of a way to actually get notify of button presses and/or combos of buttons that would be super nice. Do you have an idea how to do that?
Since there hasn't been any update on this in a while, I'm closing it. Feel free to re-open if you want to add some ideas on how to implement this feature
The volume buttons still register presses on the deck when connected. By detecting a volume change (or maybe even the media button key press) Deckpad could quit without requiring the installed pacman tools. What do you think?
PS: Especially, because quitting by clicking the touchscreen does not seem to work for me as well