#!/bin/sh # Probe and setup USB if [ -e /proc/bus/pci/devices ]; then OHCI=no UHCI=no EHCI=no # Probe for OHCI first while read REPLY ; do if grep -q $REPLY /proc/bus/pci/devices ; then OHCI=yes fi done < /usr/lib/usb-discover/ohci-pci.lst while read REPLY ; do if grep -q $REPLY /proc/bus/pci/devices ; then UHCI=yes fi done < /usr/lib/usb-discover/uhci-pci.lst while read REPLY ; do if grep -q $REPLY /proc/bus/pci/devices ; then EHCI=yes fi done < /usr/lib/usb-discover/ehci-pci.lst # Also try PCI class detection using sysfs on 2.6. for classfile in /sys/bus/pci/devices/*/class; do [ -e "$classfile" ] || continue class="$(cat "$classfile")" || continue case $class in 0x0c0300) UHCI=yes ;; 0x0c0310) OHCI=yes ;; 0x0c0320) EHCI=yes ;; esac done kver=`uname -r | cut -d. -f1,2` # Kernel version (e.g. 2.4) if [ "$OHCI" = yes ] ; then if [ "$kver" = 2.6 ]; then modprobe ohci-hcd else modprobe usb-ohci fi fi if [ "$UHCI" = yes ] ; then if [ "$kver" = 2.6 ]; then modprobe uhci-hcd else modprobe usb-uhci fi fi if [ "$EHCI" = yes ] ; then # Same in 2.4 and 2.6 modprobe ehci-hcd fi if [ "$kver" = 2.6 ]; then modprobe usbkbd || true modprobe hid 2>/dev/null || true # ... which changed in 2.6.6 to: modprobe usbhid || true else modprobe usbkbd || true modprobe hid || true modprobe keybdev || true fi modprobe usbserial || true fi