Наши партнеры








Книги по Linux (с отзывами читателей)

Библиотека сайта rus-linux.net

Chapter 2. How to get USB devices working under Linux

Basic USB Configuration

You need a late version kernel. Kernel versions 2.2.7 and later contain the USB code. You should, in an ideal world, be running the current 2.3.x kernel, ideally with any pre-patches for the next kernel. The current 2.2.x kernels do contain some USB code, but it is badly out of date, and will not match up with this document. It is possible to use the 2.3.x USB code with a 2.2.x kernel - see later in this document for details. USB code is in fairly early development, so the changes between each version (and the bugs) tend to change fairly fast. Support on the mailing list for anything except the lastest version is scant at best.

The mailing list is . To subscribe, send a mail message to with content of subscribe linux-usb. If you want to stop getting mailing list content, send a mail message to with content of unsubscribe linux-usb.

You need to configure USB into your kernel. Use of make menuconfig is recommended. Under USB Support, you need to select Support for USB. You also need to select either UHCI (Intel PIIX4, VIA, ...) support, UHCI Alternate Driver (JE) support or OHCI-HCD (Compaq, iMacs, OPTi, SiS, ALi, ...) support. Which one you select is dependent on what kind of motherboard or adapter you have. Intel and Via motherboards, and Via-based adapters are UHCI, and you can use either of the two UHCI drivers - there seems to be little user visible difference between them. Ali and SiS chipsets, Compaq and NEC motherboards, iMacs and any adapter using Opti chips (just about all of them) are OHCI, and you should use OHCI-HCD. If you do not know what kind of controller to choose, check your motherboard documentation. You can also look at /proc/pci for a hint - if the USB entry is of the form 0xHHHH, where HHHH are hex digits (e.g. something like I/O at 0xe400), then it is UHCI. If it is of the form 32 bit memory at 0xHH000000, where HH are hex digits (e.g. something like 32 bit memory at 0xee000000), then it is OHCI. Failing that, just try both.

Always build in the Preliminary USB device filesystem. Leaving this out will make resolving problems almost impossible, and is essential if you need to check that your kernel is configured correctly, and your USB devices are being recognised correctly.

You also need to select whichever devices you want to use, for example USB Human Interface Device (HID) support (with the appropriate subordinate options) for a USB keyboard, mouse, joystick, tablet or gamepad, USB Scanner support for certain scanners, USB Audio support for USB speakers, USB Modem (CDC ACM) support for a POTS or ISDN modem, USB Printer support for a USB printer, USB Serial Converter support (with the appropriate subordinate options) for some serial port type devices, USB CPiA Camera support for cameras based on the Vision CPiA chipset, USB IBM (Xirlink) C-it Camera support for camera based on the IBM camera chipset, USB OV511 Camera support for cameras based on OmniVision's OV511 chipset, USB Kodak DC-2xx Camera support for downloading images from Kodak's DC-200 series cameras, USB Mass Storage support for mass storage devices, USS720 parport driver for certain parallel port adapters, DABUSB driver for an experimental Digital Audio Broadcast receiver and PLUSB Prolific USB-Network driver for certain USB to USB type connections. You should be able to use modules, kernel only, or split modules and kernel code.

USB hubs are automatically supported. Some devices may stop and start working between kernel versions. Remember that you are using experimental code. Devices not listed in this document are not working at the time of writing, although developers are always welcome to contribute to the current codebase.

If you want to use a stable kernel (2.2.x), you can get a patch which adds the latest USB code to certain stable kernels. This patch, often referred to as a backport patch, can be obtained from http://www.suse.cz/development/usb-backport/. You apply the patch to the applicable stable kernel, and recompile. Note that the USS720 driver does not work in the backport, since the parallel port code on which it depends is substantially different in earlier kernels. USB storage is also significantly different between 2.2 and 2.3 series kernels.

Rebuild the kernel and the modules (if you configured to build as modules), and install the new kernel and the new modules. Reboot the system. If you need instruction on how to do this, refer to the Linux Kernel HOWTO.

If you are using modules, you need to load the following modules:

  • usbcore.o
  • usb-uhci.o, uhci.o or usb-ohci.o
and any driver modules, such as scanner.o or printer.o.

Inspect the kernel logs. If there isn't anything that could be USB related, likely causes are use of the wrong driver (UHCI when you needed OHCI or OHCI when you needed UHCI), not physically installing the hardware, a BIOS configuration that disables USB or stuffing up the configuration or installation of the kernel.