]>
Commit | Line | Data |
---|---|---|
942c9c06 | 1 | #!/bin/sh |
62a8e03c | 2 | USBKBD_RCSID='$Revision$ $Date:: $' |
942c9c06 AM |
3 | |
4 | # geninitrd mod: usbkbd | |
5 | ||
942c9c06 | 6 | find_modules_usbkbd() { |
02ba8ab7 | 7 | verbose "Finding USB keyboard modules" |
942c9c06 | 8 | |
e9404001 | 9 | if [ "$(echo /sys/class/input/input*)" = "/sys/class/input/input*" ]; then |
942c9c06 AM |
10 | return |
11 | fi | |
12 | ||
77374634 | 13 | local modules i module bInterfaceClass bInterfaceProtocol |
942c9c06 AM |
14 | |
15 | for i in /sys/class/input/input*; do | |
e6c3626f AM |
16 | # standard usb keyboards |
17 | if [ -f $i/device/bInterfaceClass -a -f $i/device/bInterfaceProtocol ]; then | |
18 | bInterfaceClass=$(cat $i/device/bInterfaceClass) | |
19 | bInterfaceProtocol=$(cat $i/device/bInterfaceProtocol) | |
20 | if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then | |
21 | module=$(readlink $i/device/driver/module) | |
22 | module=$(basename $module) | |
02ba8ab7 | 23 | |
e6c3626f | 24 | if [ -n "$module" ]; then |
02ba8ab7 | 25 | verbose "Found USB Keyboard: $(cat $i/name)" |
e6c3626f AM |
26 | modules="$modules $module" |
27 | fi | |
28 | fi | |
29 | fi | |
30 | ||
31 | # logitech unifying receiver (unfortunately I know no way to detect keyboard only) | |
41608516 | 32 | if grep -qi "Logitech Unifying Device" $i/name; then |
942c9c06 AM |
33 | module=$(readlink $i/device/driver/module) |
34 | module=$(basename $module) | |
35 | ||
aa13d63e | 36 | if [ -n "$module" ]; then |
02ba8ab7 | 37 | verbose "Found USB Logitech Unifying Device: $(cat $i/name)" |
aa13d63e AM |
38 | modules="$modules $module" |
39 | fi | |
942c9c06 AM |
40 | fi |
41 | done | |
42 | ||
43 | if [ -n "$modules" ]; then | |
44 | # usb controllers | |
45 | for m in $(find_modules_by_class "0c03"); do | |
46 | find_module $m | |
47 | done | |
48 | ||
49 | for m in $modules; do | |
50 | find_module $m | |
51 | done | |
52 | fi | |
53 | } |