]> err.no Git - systemd/commitdiff
[PATCH] add some helper scripts for dvb and input devices.
authorgreg@kroah.com <greg@kroah.com>
Sat, 16 Oct 2004 02:18:58 +0000 (19:18 -0700)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 05:02:45 +0000 (22:02 -0700)
extras/dvb.sh [new file with mode: 0644]
extras/inputdev.sh [new file with mode: 0644]

diff --git a/extras/dvb.sh b/extras/dvb.sh
new file mode 100644 (file)
index 0000000..b14a6d0
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh -e
+echo $1 | sed -e 's#^dvb\([0-9]\)\.\([^0-9]*\)\([0-9]\)#dvb/adapter\1/\2\3#'
+exit 0
diff --git a/extras/inputdev.sh b/extras/inputdev.sh
new file mode 100644 (file)
index 0000000..82e4fdc
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh -e
+#
+# Scans /proc/bus/input/devices for the given device.
+#
+# (c) 2004 Darren Salt <linux@youmustbejoking.demon.co.uk>
+# GPL v2 or later applies.
+
+[ "$1" ] || exit 0
+
+# input device name, less leading "input/"
+DEVICE=${1#input/}
+
+# "|"-separated list.
+# The first found in the given device's "N:" line will be output.
+DEFAULT_KEYWORDS='dvb|saa7134'
+KEYWORDS=${2:-$DEFAULT_KEYWORDS}
+
+exec sed -nre '
+  /^I:/ {
+    : gather
+    N
+    /\nH:/! b gather
+    /'"$DEVICE"'/ {
+      s/^.*\nN:[^\n]*("|\b)('"$KEYWORDS"')("|\b)[^\n]*\n.*$/inputdev/
+      T
+      p
+    }
+  }
+' < /proc/bus/input/devices
+