]>
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 | 12 | |
4de5a333 ER |
13 | for i in /sys/bus/usb/devices/*-*:*; do |
14 | # standard usb keyboards | |
15 | if [ -f $i/bInterfaceClass -a -f $i/bInterfaceProtocol ]; then | |
16 | bInterfaceClass=$(cat $i/bInterfaceClass) | |
17 | bInterfaceProtocol=$(cat $i/bInterfaceProtocol) | |
18 | if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then | |
19 | module=$(readlink $i/driver/module) | |
20 | module=$(basename $module) | |
662fd5a3 | 21 | |
4de5a333 ER |
22 | if [ -n "$module" ]; then |
23 | verbose "Found USB Keyboard driver: $module" | |
24 | modules="$modules $module" | |
25 | fi | |
26 | fi | |
27 | fi | |
28 | done | |
662fd5a3 | 29 | |
942c9c06 | 30 | for i in /sys/class/input/input*; do |
e6c3626f AM |
31 | # standard usb keyboards |
32 | if [ -f $i/device/bInterfaceClass -a -f $i/device/bInterfaceProtocol ]; then | |
33 | bInterfaceClass=$(cat $i/device/bInterfaceClass) | |
34 | bInterfaceProtocol=$(cat $i/device/bInterfaceProtocol) | |
35 | if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then | |
36 | module=$(readlink $i/device/driver/module) | |
37 | module=$(basename $module) | |
02ba8ab7 | 38 | |
e6c3626f | 39 | if [ -n "$module" ]; then |
02ba8ab7 | 40 | verbose "Found USB Keyboard: $(cat $i/name)" |
e6c3626f AM |
41 | modules="$modules $module" |
42 | fi | |
43 | fi | |
44 | fi | |
45 | ||
46 | # logitech unifying receiver (unfortunately I know no way to detect keyboard only) | |
41608516 | 47 | if grep -qi "Logitech Unifying Device" $i/name; then |
942c9c06 AM |
48 | module=$(readlink $i/device/driver/module) |
49 | module=$(basename $module) | |
50 | ||
aa13d63e | 51 | if [ -n "$module" ]; then |
02ba8ab7 | 52 | verbose "Found USB Logitech Unifying Device: $(cat $i/name)" |
aa13d63e AM |
53 | modules="$modules $module" |
54 | fi | |
942c9c06 AM |
55 | fi |
56 | done | |
57 | ||
58 | if [ -n "$modules" ]; then | |
59 | # usb controllers | |
60 | for m in $(find_modules_by_class "0c03"); do | |
0213ab4d | 61 | find_module "$m" |
942c9c06 AM |
62 | done |
63 | ||
64 | for m in $modules; do | |
0213ab4d | 65 | find_module "-$m" |
942c9c06 AM |
66 | done |
67 | fi | |
68 | } |