aboutsummaryrefslogtreecommitdiffstats
path: root/nltrigger
blob: bc80488f7c7064255cb1707e2af6f5dce5636e55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/busybox ash

if [ $# -eq 0 ];
then
	printf "usage: %s subsystem [action]\n" "$(basename $0)" >&2
	exit 1
fi

action="add"
if [ $# -eq 2 ];
then
	action="$2"
fi

if [ "$1" != "all" ];
then
	if [ -d /sys/class/$1 ];
	then
		for i in /sys/class/$1/*/uevent;
		do
			echo $action > $i
		done
		exit 0
	fi

	if [ -d /sys/bus/$1 ];
	then
		for i in /sys/bus/$1/devices/*/uevent;
		do
			echo $action > $i
		done
		exit 0
	fi

	if [ -d /sys/devices/$1 ];
	then
		for i in /sys/devices/$1/*/uevent \
			/sys/devices/$1/*/*/uevent;
		do
			echo $action > $i
		done
		exit 0
	fi

	printf "Could not find subsystem '%s'.\n" $i >&2
	exit 1
fi

exit 0

for i in /sys/class/*/*/uevent /sys/bus/*/devices/*/uevent \
	/sys/devices/*/*/uevent /sys/devices/*/*/*/uevent;
do
	echo $action > $i
done

exit 0