Differences between version 4 and previous revision of UdevSounds.
Other diffs: Previous Major Revision, Previous Author
Newer page: | version 4 | Last edited on Saturday, 27 August 2011 9:24:21 | by CyberLeo | Revert |
Older page: | version 3 | Last edited on Saturday, 27 August 2011 9:08:56 | by CyberLeo | Revert |
@@ -6,9 +6,9 @@
/etc/udev/sounds/hw.sh:
<verbatim>
#!/bin/bash
-#logger -t "hw.sh" "$(whoami) Honoring
${ACTION} for ${SUBSYSTEM}...
"
+#logger -t "hw.sh" "$(whoami) Sounding '
${ACTION}'
for '
${SUBSYSTEM}'
"
add="/etc/udev/sounds/hw_insert.wav"
rem="/etc/udev/sounds/hw_remove.wav"
[ "${SUBSYSTEM}" == "usb" ] || exit 0
version 4
/etc/udev.rules/00-bling.rules:
RUN+="/etc/udev/sounds/hw.sh"
/etc/udev/sounds/hw.sh:
#!/bin/bash #logger -t "hw.sh" "$(whoami) Sounding '${ACTION}' for '${SUBSYSTEM}'" add="/etc/udev/sounds/hw_insert.wav" rem="/etc/udev/sounds/hw_remove.wav" [ "${SUBSYSTEM}" == "usb" ] || exit 0 case "${ACTION}" in add) snd="${add}" ;; remove) snd="${rem}" ;; *) ;; esac [ "${snd}" ] && /usr/bin/aplay -q "${snd}" &
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...