#!/bin/sh
-SATA_RCSID='$Revision: 12372 $ $Date:: 2011-10-15 09:38:16 +0200 #$'
-
# geninitrd mod: usbkbd
-# setup geninitrd module
-# @access public
-setup_mod_usbkbd() {
-}
-
find_modules_usbkbd() {
- debug "Finding USB keyboard modules"
+ verbose "Finding USB keyboard modules"
- if [ "$(ls -1 /sys/class/input/input* 2> /dev/null)" = "/sys/class/input/input*" ]; then
+ if [ "$(echo /sys/class/input/input*)" = "/sys/class/input/input*" ]; then
return
fi
- local modules
+ local modules i module bInterfaceClass bInterfaceProtocol
+
+ for i in /sys/bus/usb/devices/*-*:*; do
+ # standard usb keyboards
+ if [ -f $i/bInterfaceClass -a -f $i/bInterfaceProtocol ]; then
+ bInterfaceClass=$(cat $i/bInterfaceClass)
+ bInterfaceProtocol=$(cat $i/bInterfaceProtocol)
+ if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then
+ module=$(readlink $i/driver/module)
+ module=$(basename $module)
+
+ if [ -n "$module" ]; then
+ verbose "Found USB Keyboard driver: $module"
+ modules="$modules $module"
+ fi
+ fi
+ fi
+ done
for i in /sys/class/input/input*; do
- [ ! -f $i/device/bInterfaceClass -o ! -f $i/device/bInterfaceProtocol ] && continue
- bInterfaceClass=$(cat $i/device/bInterfaceClass)
- bInterfaceProtocol=$(cat $i/device/bInterfaceProtocol)
- if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then
+ # standard usb keyboards
+ if [ -f $i/device/bInterfaceClass -a -f $i/device/bInterfaceProtocol ]; then
+ bInterfaceClass=$(cat $i/device/bInterfaceClass)
+ bInterfaceProtocol=$(cat $i/device/bInterfaceProtocol)
+ if [ "$bInterfaceClass" = "03" -a "$bInterfaceProtocol" = "01" ]; then
+ module=$(readlink $i/device/driver/module)
+ module=$(basename $module)
+
+ if [ -n "$module" ]; then
+ verbose "Found USB Keyboard: $(cat $i/name)"
+ modules="$modules $module"
+ fi
+ fi
+ fi
+
+ # logitech unifying receiver (unfortunately I know no way to detect keyboard only)
+ if grep -qi "Logitech Unifying Device" $i/name; then
module=$(readlink $i/device/driver/module)
module=$(basename $module)
- modules="$modules $module"
+ if [ -n "$module" ]; then
+ verbose "Found USB Logitech Unifying Device: $(cat $i/name)"
+ modules="$modules $module"
+ fi
fi
done
if [ -n "$modules" ]; then
# usb controllers
for m in $(find_modules_by_class "0c03"); do
- find_module $m
+ find_module "$m"
done
for m in $modules; do
- find_module $m
+ find_module "-$m"
done
fi
}