Triggerhappy is a lightweight hotkey daemon that
[openwrt.org/packages.git] / utils / triggerhappy / files / triggerhappy.hotplug
blob:a/utils/triggerhappy/files/triggerhappy.hotplug -> blob:b/utils/triggerhappy/files/triggerhappy.hotplug
--- a/utils/triggerhappy/files/triggerhappy.hotplug
+++ b/utils/triggerhappy/files/triggerhappy.hotplug
@@ -1,1 +1,16 @@
+#!/bin/sh
+THD_SOCKET=/tmp/triggerhappy.socket
+[ -S "$THD_SOCKET" ] || exit
 
+case "$ACTION" in
+	add)
+		DEVICE="/dev/$DEVNAME"
+		[ -c "$DEVICE" ] || exit
+		# offer device to triggerhappy daemon
+		/usr/sbin/th-cmd --socket "$THD_SOCKET" --add "$DEVICE"
+	;;
+        remove)
+		# nothing to do
+	;;
+esac
+

comments