UDEV Rules for Dell AC511 USB Soundbar

A monitor sound bar seems good enough for streaming background music and suchlike, with the benefit of eliminating the external USB audio converter and reducing the cable tangle:

Dell AC511 USB Soundbar - Dell Image 318-2885r3

Dell AC511 USB Soundbar – Dell Image 318-2885r3

That’s a Dell AC511 USB SoundBar (their choice of capitalization); I mooched the image from their description, because I cannot take a good picture of a dead-black device.

Depending on the description you read, it’s good for maybe 1.5 W, which is about all you can get directly from a USB port: 5 V at well under 500 mA. The audio output required no configuration at all: unplug the Behringer USB converter, plug this in, reboot that sucker, and It Just Worked. Sounds pretty good for as little power as it produces, too; organ music will never reach gut-pounding levels.

The far end of the bar sports a headphone output jack and a line-in jack, so apparently it can handle audio input, despite that not appearing in the online doc. Bonus!

The knob on this end spins endlessly while spitting out USB volume control events that, presumably, work seamlessly with an ordinary Windows setup. It’ll take a bit more effort with a headless Raspberry Pi.

So, we begin …

Following the usual recipe gives these results:

cat /proc/bus/input/devices
I: Bus=0003 Vendor=413c Product=a503 Version=0100
N: Name="Dell Dell AC511 USB SoundBar"
P: Phys=usb-3f980000.usb-1.5/input3
S: Sysfs=/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.5/1-1.5:1.3/0003:413C:A503.0002/input/input1
U: Uniq=
H: Handlers=kbd event1
B: EV=13
B: KEY=e0000 0 0 0
B: MSC=10

In this case, the Name field seems reasonably unique, and, seeing as how the collection of devices required to do this thing keeps growing, I renamed the old /etc/udev/rules.d/KeyPad.rules to Streamer.rules and dropped the new rule in there to keep everything together:

ATTRS{name}=="HID 13ba:0001", SYMLINK+="input/keypad"
ATTRS{idVendor}=="062a", ATTRS{idProduct}=="4101", ENV{ID_INPUT_KEYBOARD}=="1", SYMLINK+="input/keypad"

ATTRS{name}=="Dell Dell AC511 USB SoundBar", SYMLINK+="input/volume"

Load the new rule, trigger udev, and it pops up at the right spot:

sudo udevadm control --reload
sudo udevadm trigger
ll /dev/input
total 0
drwxr-xr-x 2 root root      80 Feb 23 16:35 by-id
drwxr-xr-x 2 root root      80 Feb 23 16:35 by-path
crw-rw---- 1 root input 13, 64 Feb 23 19:30 event0
crw-rw---- 1 root input 13, 65 Feb 23 19:30 event1
lrwxrwxrwx 1 root root       6 Feb 23 19:30 keypad -> event0
crw-rw---- 1 root input 13, 63 Feb 23 19:30 mice
lrwxrwxrwx 1 root root       6 Feb 23 19:30 volume -> event1

Now, to make those KEY_VOLUMEUP and KEY_VOLUMEDOWN events change the volume…