/etc/udev.rules/00-bling.rules:
RUN+="/etc/udev/sounds/hw.sh"
/etc/udev/sounds/hw.sh:
#!/bin/bash #logger -t "hw.sh" "$(whoami) Honoring ${ACTION} for ${SUBSYSTEM}..." if [ "${SUBSYSTEM}" != "usb" ] then exit 0 fi if [ "${ACTION}" = "add" ] then /usr/bin/aplay /etc/udev/sounds/hw_insert.wav & exit 0 elif [ "${ACTION}" = "remove" ] then /usr/bin/aplay /etc/udev/sounds/hw_remove.wav & exit 0 fi
Note that aplay likely won't work if you have a sound manager like esd squatting on the sound devices, so set it to give them up after a while.
Also, sound managers like esd won't work because they disallow connections from sources that don't match credentials
Salt and pepper to taste...