diff options
Diffstat (limited to 'net-wireless/irda-utils/files/irda-usb.sh')
-rw-r--r-- | net-wireless/irda-utils/files/irda-usb.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/net-wireless/irda-utils/files/irda-usb.sh b/net-wireless/irda-utils/files/irda-usb.sh new file mode 100644 index 000000000000..fdbc4cf46737 --- /dev/null +++ b/net-wireless/irda-utils/files/irda-usb.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +# Find out where sysfs is mounted. Exit if not available +SYSFS=$(/bin/sed -n "s:^[^ ]* \([^ ]\+\) sysfs .*:\1:p" /proc/mounts) +if [[ -z "${SYSFS}" ]]; then + echo "sysfs is required" + exit 1 +fi + +case "${ACTION}" in + add) + MODALIAS="${SYSFS}${DEVPATH}/device/modalias" + if [[ -f "${MODALIAS}" ]]; then + case $(<"${MODALIAS}") in + usb:*) + # attach USB-IrDA interface + /usr/sbin/irattach ${INTERFACE} -s + ;; + esac + fi + ;; + remove) + # unconditionally kill irattach instance + /usr/bin/pkill -f "^/usr/sbin/irattach ${INTERFACE} ?" + ;; +esac |