This is a small script-based daemon for Linux systems using the Advanced Linux Sound Architecture (ALSA) to allow USB HID 'Consumer Control' volume events to adjust the ALSA mixer volume.
As far as I know, this should 'just work' for the default ALSA playback device without the need for this daemon. However, it seems some ALSA configurations break this. In my case I was using the ALSA SoftVol plugin to enable a volume control for an Adafruit MAX98357 I2S Class-D Mono Amp PCM device which has no volume control itself.
The daemon installs as a systemd service.
The script uses the default ALSA playback mixer control. This is one returned from the following command:
amixer -D defaultBy default, with no other command line arguments the daemon will select the first
USB HID input device found under /dev/input.
This can be overridden by specifying an alternative device when starting the daemon.
e.g. from the root of this repo:
src/alsa_vol_from_usb_hid.sh /dev/input/event1However most of the time you will want the daemon to install and start automatically instead of starting it manually like this. See the 'Installation' section below.
To install with automatic USB HID device selection
(the first USB HID input device found under /dev/input):
sudo make installTo install specifying a particular USB HID device (e.g. /dev/input/event1):
sudo make install USBHID_DEVICE=/dev/input/event1To uninstall:
sudo make uninstall