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