📄 install.sgml
字号:
<chapter> <Title>How to get USB devices working under Linux</><Sect1><Title>Basic USB Configuration</><Para>You need a late version kernel. Kernel versions 2.2.7 and latercontain the USB code. You should, in an ideal world, be running thecurrent 2.4.0-test kernel, ideally with any pre-patches for the nextkernel. The current 2.2.x kernels do contain some USB code, but itis less well supported, and development is patchy.USB code is in fairly earlydevelopment, so the changes between each version (and the bugs) tendto change fairly fast. Support on the mailing list for anything exceptthe lastest version is scant at best.</><Para>The user assistance mailing list is <Email>linux-usb-users@lists.sourceforge.net</Email>. To subscribe or unsubscribe, go to <ulink url="http://lists.sourceforge.net/mailman/listinfo/linux-usb-devel">http://lists.sourceforge.net/mailman/listinfo/linux-usb-devel</ulink></><Para>You need to configure USB into your kernel. Use of <UserInput> makemenuconfig </UserInput> is recommended. Under <UserInput> USBsupport</UserInput>, you need to select <UserInput>Support forUSB</UserInput>. You also need to select either <UserInput>UHCI (IntelPIIX4, VIA, ...) support</UserInput>, <UserInput>UHCI AlternateDriver (JE) support</UserInput> or<UserInput>OHCI-HCD (Compaq, iMacs, OPTi, SiS, ALi, ...) support</UserInput>. Which one you select is dependent on whatkind of motherboard or adapter you have. Intel and Via motherboards,and Via-based adapters are UHCI, and you can use either of the twoUHCI drivers - there seems to be little user visible differencebetween them. Ali and SiS chipsets, Compaq and NECmotherboards, iMacs and any adapter using Opti chips (just about allof them) are OHCI, and you should use OHCI-HCD. If you do not knowwhat kind of controller to choose, check your motherboarddocumentation. You can also look at <FileName>/proc/pci</FileName>for a hint - if the USB entry is of the form 0xHHHH, where HHHH arehex digits (e.g. something like <UserInput>I/O at 0xe400</UserInput>),then it is UHCI. If it is of the form <UserInput>32 bit memory at0xHH000000</UserInput>, where HH are hex digits (e.g. something like<UserInput>32 bit memory at 0xee000000</UserInput>), then it is OHCI.Failing that, just try both.</><Para>Always build in the Preliminary USB device filesystem. Leaving this outwill make resolving problems almost impossible, and is essential ifyou need to check that your kernel is configured correctly, andyour USB devices are being recognised correctly.</para><Para>You also need to select whichever devices you want to use, for example<UserInput>USB Human Interface Device (HID) support</UserInput> for a USB keyboard, mouse,joystick, tablet or gamepad, <UserInput>USB Scanner support</UserInput> forcertain scanners, <UserInput>USB Audio support</UserInput> for USBspeakers, <UserInput>USB Modem (CDC ACM) support</UserInput> fora POTS or ISDN modem, <UserInput>USB Printer support</UserInput>for a USB printer, <UserInput>USB Serial Converter support</UserInput>(with the appropriate subordinate options) for some serial port type devices,<UserInput>USB CPiA Camera support</UserInput> for cameras based on theVision CPiA chipset, <UserInput>USB IBM (Xirlink) C-it Camera support</UserInput> for camera based on the IBM camera chipset,<UserInput>USB OV511 Camera support</UserInput> for camerasbased on OmniVision's OV511 chipset, <UserInput>USB Kodak DC-2xx Camerasupport</UserInput> for downloading images from Kodak's DC-200 seriescameras, <UserInput>USB Mass Storage support</UserInput> formass storage devices,<UserInput>USS720 parport driver</UserInput> for certain parallel portadapters, <UserInput>DABUSB driver</UserInput> for an experimentalDigital Audio Broadcast receiver and <UserInput>PLUSB Prolific USB-Networkdriver</UserInput> for certain USB to USB type connections.You should be able to use modules, kernel only, or split modules andkernel code.</><Para>USB hubs are automatically supported. Some devices may stop and startworking between kernel versions. Remember that you are usingexperimental code. Devices not listed in this document are not workingat the time of writing, although developers are always welcome tocontribute to the current codebase. </><Para>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 needinstruction on how to do this, refer to the<ulink url="http://www.linuxdoc.org/HOWTO/Kernel-HOWTO.html">Linux Kernel HOWTO</ulink>.</><Para>If you are using modules, you need to load the following modules:<ItemizedList><ListItem><Para><filename>usbcore.o</filename></></ListItem><ListItem><Para><filename>usb-uhci.o</filename>, <filename>uhci.o</filename>or <filename>usb-ohci.o</filename></></ListItem></ItemizedList>and any driver modules, such as<filename>scanner.o</filename> or <filename>printer.o</filename>.</><Para>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 neededOHCI or OHCI when you needed UHCI), not physically installingthe hardware, a BIOS configuration that disables USB or stuffing upthe configuration or installation of the kernel.</></Sect1><Sect1><Title>USB Device Filesystem</title><para>The USB device filesystem is a dynamically generated filesystem, similar tothe <FileName>/proc</FileName> filesystem. This filesystem can be mountedjust about anywhere, however it is customarily mounted on<FileName>/proc/bus/usb</FileName>,which is an entry node created by the USB code, intended to be used as amount point for this system. Mounting in other locations may breakuser space utilities, but should not affect the kernel support.</para><para>You need to select "Preliminary USB Device Filesystem" to make this work.You also need to enable general <FileName>/proc</Filename> support, andto have it mounted (normally automatic).</><para>To mount the filesystem, you need to be root. Use the mountcommand: <UserInput>mount -t usbdevfs none /proc/bus/usb</UserInput>.Note that the <UserInput>none</UserInput> keyword is arbitrary - youcan use anything, and some people prefer to use <UserInput>usbdevfs</UserInput>, as it makes the mount output look better.</para><para>If you do not want to have to mount the filesystem each time you rebootthe system, you can add the following to <FileName>/etc/fstab</FileName>after the <FileName>/proc</FileName> entry:<screen>none /proc/bus/usb usbdevfs defaults 0 0</screen>This has the same effect as the mount command.</para><para>After you have mounted the filesystem, the contents of<FileName>/proc/bus/usb</FileName> should look something like:<screen>dr-xr-xr-x 1 root root 0 Jan 26 10:40 001-r--r--r-- 1 root root 0 Jan 26 10:40 devices-r--r--r-- 1 root root 0 Jan 26 10:40 drivers</screen>.You may have more than one numbered directory entry if your machinehas more than one universal serial bus controller.</para><para>Full interpretation of the <FileName>devices</FileName> and<FileName>drivers</FileName> files is provided later in this guide, in theuser's section. The numbered entries are machine readable, but are notusually of any use to a user.</para></Sect1><Sect1><Title>USB Human Interface Device (HID) Configuration</Title><Sect2><Title>General HID Configuration</Title><Para>There are two options for using a USB mouse or a USB keyboard - thestandalone Boot Protocol (HIDBP) way and the full featured HID driverway. The Boot Protocol way is generally inferior, and this documentdescribes the full featured way. The Boot Protocol way may beappropriate for embedded systems and other systems with resourceconstraints and no real need for the full keyboard and mousecapabilities.</Para><Para>It is important to remember that the HID driver handles those devices(or actually those interfaces on each device) that claim to complywith the <ulinkurl="http://www.usb.org/developers/data/devclass/hid1_1.pdf">Human InterfaceDevice (HID) specification</ulink>. However the HID specificationdoesn't say anything about what the HID driver should do withinformation received from a HID device, or where the information thatis sent to a device comes from, since this is obviously dependent onwhat the device is supposed to be doing, and what the operating systemis. Linux (at the operating system kernel level) supports fourinterfaces to a HID device - keyboard, mouse, joystick and a genericinterface, known as the event interface. These are implemented by theInput device level.</para></Sect2><Sect2><Title>HID Mouse Configuration</Title><Para>In the kernel configuration stage, you need to turn on<UserInput>USB Human Interface Device (HID) support</UserInput> in the<UserInput>USB support</UserInput> and<UserInput>Mouse Support</UserInput> in the <UserInput>Input coresupport</UserInput>. You don't need to worry about the screenresolution entries for a normal mouse - these are for mouse-likedevices such as a graphics tablet. Do <emphasis>not</emphasis> turn on<UserInput>USB HIDBP Mouse support</UserInput>. Perform the normalkernel rebuild and installation steps. If you are installing asmodules, you need to load the <FileName>input.o</FileName>,<FileName>hid.o</FileName> and <FileName>mousedev.o</FileName> modules.</para><Para>Plug in a USB mouse and check that your mouse has been correctly sensedby the kernel. If you don't have a kernel message, look for thechanges to <filename>/proc/bus/usb/devices</filename>.</para><Para>Since USB supports multiple identical devices, you can have multiplemice plugged in. You can get each mouse seperately, or you can getthem all mixed together. You almost always want the mixed version, andthat is what will be used in this example.You need to set up a device node entry for the mixed mice. It iscustomary to create the entries for this device in the<FileName>/dev/input/</FileName> directory. Use the following commands:<screen>mkdir /dev/inputmknod /dev/input/mice c 13 63</screen></><Para>If you <UserInput>cat /dev/input/mice</UserInput> you should seesome bizarre looking characters as you move the mouse or click anyof the buttons.</para><Para>If you want to use the mouse under X, you have various options. Which oneyou select is dependent on what version of XFree86 you are using andwhether you are using only USB for yourmouse (or mice), or whether you want to use a USB mouse and someother kind of pointer device.</para><para><ItemizedList><ListItem><Para> You need to edit the <Filename>XF86Config</Filename> file (usually <Filename>/usr/X11R6/lib/X11/XF86Config</Filename> or <FileName>/etc/X11/XF86Config</FileName>).</para></listitem><listitem><para>If you are using XFree86 version 4.0 or later,add a <SystemItem>InputDevice</SystemItem> section that lookslike the following:<screen>Section "InputDevice" Identifier "USB Mice" Driver "mouse" Option "Protocol" "IMPS/2" Option "Device" "/dev/input/mice"EndSection</screen>or, if you want to use a wheel mouse, something like:<screen>Section "InputDevice" Identifier "USB Mice" Driver "mouse" Option "Protocol" "IMPS/2" Option "Device" "/dev/input/mice" Option "ZAxisMapping" "4 5" Option "Buttons" "5"EndSection</screen>may be more useful. Consult the XFree86 documentation for a detailedexplaination and more examples.</para><para>You also need to add an entry to each applicable<SystemItem>ServerLayout</SystemItem> Section. These are normally at theend of the configuration file. If you only have a USB mouse (or USB mice),then replace the line with the <SystemItem>"CorePointer"</Systemitem> entrywith the following line:<screen> InputDevice "USB Mice" "CorePointer"</screen>If you want to use both a USB mouse (or USB mice) and some other kind of pointerdevice, then add (do not replace) the following line to the applicable<SystemItem>ServerLayout</SystemItem> sections:<screen> InputDevice "USB Mice" "SendCoreEvents"</screen></para></listitem><listitem><para>If you are using only a USB mouse (or USB mice) with XFree86 3.3,edit the <SystemItem>Pointer</SystemItem> section so that itlooks like the following:<screen>Section "Pointer" Protocol "IMPS/2" Device "/dev/input/mice"EndSection</screen></para></listitem><listitem><para>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -