mirror of
https://github.com/systemd/systemd.git
synced 2025-03-19 22:50:17 +03:00
[PATCH] add some helper scripts for dvb and input devices.
This commit is contained in:
parent
13299c29e7
commit
29afcc5f11
3
extras/dvb.sh
Normal file
3
extras/dvb.sh
Normal file
@ -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
|
30
extras/inputdev.sh
Normal file
30
extras/inputdev.sh
Normal file
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user