You are not logged in.
Hi guys,
I have an external USB Audio DAC that comes with a remote for controlling media playback. Arch Linux doesn't seem to recognize the media playback commands from the remote (the DAC itself is working fine otherwise).
I ran dbus-monitor to watch for even changes, but when I press the keys nothing seems to change.
When I connected the DAC to my windows laptop, I was able to control media playback in most apps with the remote play/pause buttons. Same for android tv - when plugged in my android tv box I am able to control playback.
Any suggestions on how I can make arch recognize these commands?
Thanks.
Last edited by onedayillmakeit (2024-01-09 10:11:49)
Offline
Just pure button presses/key events will not show up on dbus just on their own. Check evtest whether you have an input device for the DAC that sends the common key events e.g. XF86AudioRaiseVolume and the like.
Generally speaking to have this work "globally" you need an MPRIS server implementation that listens to those keys and then passes them on to registered mpris clients, is that the case? Which environment are you running? Which client do you intend to see get controlled?
Offline
Generally speaking to have this work "globally" you need an MPRIS server implementation that listens to those keys and then passes them on to registered mpris clients, is that the case? Which environment are you running? Which client do you intend to see get controlled?
Yes, exactly. I want to be able to pass pause/play commands to spotifyd and shairport-sync. It's a small headless arch linux machine that I use for media playback.
The key presses did show up in evtest:
Event: time 1704735406.421459, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b6
Event: time 1704735406.421459, type 1 (EV_KEY), code 165 (KEY_PREVIOUSSONG), value 1
Event: time 1704735406.421459, -------------- SYN_REPORT ------------
Event: time 1704735406.437470, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b6
Event: time 1704735406.437470, type 1 (EV_KEY), code 165 (KEY_PREVIOUSSONG), value 0
Event: time 1704735406.437470, -------------- SYN_REPORT ------------
Event: time 1704735409.637475, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00cd
Event: time 1704735409.637475, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 1
Event: time 1704735409.637475, -------------- SYN_REPORT ------------
Event: time 1704735409.653461, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00cd
Event: time 1704735409.653461, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 0
Event: time 1704735409.653461, -------------- SYN_REPORT ------------
Event: time 1704735410.405473, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b5
Event: time 1704735410.405473, type 1 (EV_KEY), code 163 (KEY_NEXTSONG), value 1
Event: time 1704735410.405473, -------------- SYN_REPORT ------------
Event: time 1704735410.421451, type 4 (EV_MSC), code 4 (MSC_SCAN), value c00b5
Event: time 1704735410.421451, type 1 (EV_KEY), code 163 (KEY_NEXTSONG), value 0
Event: time 1704735410.421451, -------------- SYN_REPORT ------------you need an MPRIS server implementation that listens to those keys and then passes them on to registered mpris clients
Could you please elaborate.. What options are there to achieve this?
Thanks a lot!
Last edited by onedayillmakeit (2024-01-08 17:52:05)
Offline
https://wiki.archlinux.org/title/MPRIS
has the relevant information, you basically need to create keybindings that do something with the keys you're pressing.
Offline
Finally made it work using triggerhappy and playerctl. The config file is simple:
KEY_PLAYPAUSE 1 dbus-run-session -- playerctl play-pause
KEY_PREVIOUSSONG 1 dbus-run-session -- playerctl previous
KEY_NEXTSONG 1 dbus-run-session -- playerctl nextOffline
Nice, I didn't know about triggerhappy myself. Please mark as [SOLVED] by editing the title in your first post.
Offline
Done! Thank you!
Offline