Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 5 of 5
  1. #1
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    833

    [How To] Control LMS with any input device

    I recently bought an USB DAC with hardware volume buttons. Unfortunately, it turned out that these buttons do not actually physically adjust the volume, but instead register as a keyboard and send media key keyboard events. After a bit of research, I found a fairly simple way to get the buttons working with LMS.
    This approach should work with any device supported by the Linux input subsystem (keyboards and mice (including wireless / bluetooth) , etc.). As it uses the LMS API, any LMS action can be triggered.

    First, download and install inputexec. The page has documentation on how to install, get your device working and find out which input events are sent by it.

    To run inputexec as a daemon / system service, you'll also need this if you run systemd (not tested by me). For OpenRC, an init script is available on request.

    Next, create inputexec-actions.ini
    Example:
    Code:
    keypress.KEY_VOLUMEDOWN = /bin/bash /usr/local/bin/sb-command.sh "mixer volume -5"
    keypress.KEY_VOLUMEUP =  /bin/bash /usr/local/bin/sb-command.sh "mixer volume +5"
    And finally the script to control LMS:
    /usr/local/bin/sb-command.sh
    Code:
    #/bin/bash
    # adjust player ID (00:00...) and LMS server (lmsserver)
    echo "00%3A00%3A00%3A00%3A00%3A00 $1" |  /bin/busybox nc lmsserver 9090
    How to automatically start inputexec as a daemon when the system boots depends on the Linux distribution. For Gentoo:
    Code:
    rc-update add inputexec default
    After starting the service, LMS should respond to the input device events. If not, check the logs (inputexec, system, LMS).
    Last edited by Roland0; 2019-04-18 at 04:10. Reason: corrected inputexec-actions.ini

  2. #2
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    20,231

    [How To] Control LMS with any input device

    Interesting concept! Thanks for sharing.

    > keypress.KEY_VOLUMEDOWN = /bin/bash /usr/local/bin/sb-command.sh "mixer volume +5"


    Should be "-5"?

    > keypress.KEY_VOLUMEUP = /bin/bash /usr/local/bin/se-volume.sh "mixer volume +5"


    sb-command.sh or se-volume.sh?


    --

    Michael

  3. #3
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    833
    Quote Originally Posted by mherger View Post

    > keypress.KEY_VOLUMEDOWN = /bin/bash /usr/local/bin/sb-command.sh "mixer volume +5"


    Should be "-5"?

    > keypress.KEY_VOLUMEUP = /bin/bash /usr/local/bin/se-volume.sh "mixer volume +5"


    sb-command.sh or se-volume.sh?
    Copy/paste mixup (first version of the script was for volume only) - thanks for pointing that out. Should be fixed now.

  4. #4
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    3,652
    Quote Originally Posted by Roland0 View Post
    I recently bought an USB DAC with hardware volume buttons.
    Out of interest what is the make / model of said USB DAC and do you know if it is supported by piCorePlayer?
    VB2.4 storage QNAP TS419p (NFS)
    Living Room - Joggler & SB3 -> Onkyo TS606 -> Celestion F20s
    Office - Pi3+Sreen -> Sony TAFE320 -> Celestion F10s / Pi2+DAC & SB3 -> Onkyo CRN755 -> Wharfedale Modus Cubes
    Dining Room -> SB Boom
    Kitchen -> UE Radio (upgraded to SB Radio)
    Bedroom (Bedside) - Pi2+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) - SB Touch ->Sherwood AVR ->Mordaunt Short M10s
    Everything controlled by iPeng

  5. #5
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    833
    Quote Originally Posted by d6jg View Post
    Out of interest what is the make / model of said USB DAC and do you know if it is supported by piCorePlayer?
    It's a HIRESFI USB DAC 9023 Mark II.
    Linux generally does not need specific drivers for USB DACs, so I'd assume it is.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •