Forum > General

I am developing a SW-AMP audio player project. Help with Dbus, GDbus, mpris!

(1/3) > >>

Hello guys and girls! I have an unsolvable problem.  :'( All I need for my Linux audio player is to receive events from the audio keys. But as for me, I cannot solve this with the help of Lazarus. I talked to chatgpt for a long time, but all his suggestions were limited to connecting libraries that Lazarus does not see. >:D I found mpris2.pas written for ovoplayer. But it depends on almost all the player's code. Is it possible to receive events from the audio keys relatively without much effort in my player on Lazarus without unlocking them from use by the operating system? Thank you in advance for your kind help with my question. O:-)

What is an "audio key" in this context? If you mean something on a keyboard, does evtest show them (might need sudo)? If evtest doesn't show them, then you probably can't do it without some kernel-level hacking.


These are the keys used by media players to control the player's functions and which exist on laptop keyboards or on extended keyboards that are sometimes called media keyboards. If you do not unlock them from system shortcuts, then you can access them only through DBus.

...exist on the keyboard. Fine. Have you tried what I suggested?


sudo evtest
No device specified, trying to scan all of /dev/input/event*
Available devices:
/dev/input/event0:   Lid Switch
/dev/input/event1:   Power Button
/dev/input/event2:   Sleep Button
/dev/input/event3:   AT Translated Set 2 keyboard
/dev/input/event4:    USB OPTICAL MOUSE
/dev/input/event5:   SEM USB Keyboard
/dev/input/event6:   SEM USB Keyboard Consumer Control
/dev/input/event7:   SEM USB Keyboard System Control
/dev/input/event8:   SynPS/2 Synaptics TouchPad
/dev/input/event9:   Video Bus
/dev/input/event10:   Video Bus
/dev/input/event11:   Asus WMI hotkeys
/dev/input/event12:   ASUS USB2.0 Webcam: ASUS USB2.0
/dev/input/event13:   HDA NVidia HDMI/DP,pcm=3
/dev/input/event14:   HDA NVidia HDMI/DP,pcm=7
/dev/input/event15:   HDA NVidia HDMI/DP,pcm=8
/dev/input/event16:   HDA NVidia HDMI/DP,pcm=9
/dev/input/event17:   HDA Intel PCH Mic
/dev/input/event18:   HDA Intel PCH Headphone
Select the device event number [0-18]: 11
Input driver version is 1.0.1
Input device ID: bus 0x19 vendor 0x0 product 0x0 version 0x0
Input device name: "Asus WMI hotkeys"
Supported events:
  Event type 0 (EV_SYN)
  Event type 1 (EV_KEY)
    Event code 113 (KEY_MUTE)
    Event code 114 (KEY_VOLUMEDOWN)
    Event code 115 (KEY_VOLUMEUP)
    Event code 140 (KEY_CALC)
    Event code 148 (KEY_PROG1)
    Event code 149 (KEY_PROG2)
    Event code 150 (KEY_WWW)
    Event code 152 (KEY_SCREENLOCK)
    Event code 163 (KEY_NEXTSONG)
    Event code 164 (KEY_PLAYPAUSE)
    Event code 165 (KEY_PREVIOUSSONG)
    Event code 166 (KEY_STOPCD)
    Event code 169 (KEY_PHONE)
    Event code 183 (KEY_F13)
    Event code 185 (KEY_F15)
    Event code 191 (KEY_F21)
    Event code 212 (KEY_CAMERA)
    Event code 215 (KEY_EMAIL)
    Event code 224 (KEY_BRIGHTNESSDOWN)
    Event code 225 (KEY_BRIGHTNESSUP)
    Event code 226 (KEY_MEDIA)
    Event code 227 (KEY_SWITCHVIDEOMODE)
    Event code 229 (KEY_KBDILLUMDOWN)
    Event code 230 (KEY_KBDILLUMUP)
    Event code 237 (KEY_BLUETOOTH)
    Event code 238 (KEY_WLAN)
    Event code 240 (KEY_UNKNOWN)
    Event code 247 (KEY_RFKILL)
    Event code 248 (KEY_MICMUTE)
    Event code 531 (KEY_TOUCHPAD_ON)
    Event code 560 (KEY_ALS_TOGGLE)
  Event type 4 (EV_MSC)
    Event code 4 (MSC_SCAN)
Key repeat handling:
  Repeat type 20 (EV_REP)
    Repeat code 0 (REP_DELAY)
      Value    250
    Repeat code 1 (REP_PERIOD)
      Value     33
Testing ... (interrupt to exit)
Event: time 1679154389.169526, type 4 (EV_MSC), code 4 (MSC_SCAN), value 45
Event: time 1679154389.169526, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 1
Event: time 1679154389.169526, -------------- SYN_REPORT ------------
Event: time 1679154389.169547, type 1 (EV_KEY), code 164 (KEY_PLAYPAUSE), value 0
Event: time 1679154389.169547, -------------- SYN_REPORT ------------
Event: time 1679154393.353030, type 4 (EV_MSC), code 4 (MSC_SCAN), value 30
Event: time 1679154393.353030, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 1
Event: time 1679154393.353030, -------------- SYN_REPORT ------------
Event: time 1679154393.353059, type 1 (EV_KEY), code 115 (KEY_VOLUMEUP), value 0
Event: time 1679154393.353059, -------------- SYN_REPORT ------------
^[[23~^[[24~^[[19~^[[20~Event: time 1679154416.937570, type 4 (EV_MSC), code 4 (MSC_SCAN), value 40
Event: time 1679154416.937570, type 1 (EV_KEY), code 165 (KEY_PREVIOUSSONG), value 1
Event: time 1679154416.937570, -------------- SYN_REPORT ------------
Event: time 1679154416.937618, type 1 (EV_KEY), code 165 (KEY_PREVIOUSSONG), value 0
Event: time 1679154416.937618, -------------- SYN_REPORT ------------


[0] Message Index

[#] Next page

Go to full version