24.3 Configuring USB

When you are installing new USB devices or troubleshooting existing USB devices, you may need to determine detailed configuration information about your USB interfaces, drivers, hubs, and ports, including the following:

USB HCI

It's frequently necessary to know which USB HCI your system uses. For example, the system requirements for a USB peripheral may state that it is incompatible with certain USB HCIs. Also, if you have occasion to troubleshoot a USB problem, knowing which USB HCI your system uses may allow you to pinpoint the problem more quickly because various USB HCIs have known limitations and incompatibilities.

USB driver information

Although Windows generally installs a suitable USB driver, there are times when upgrading (or downgrading) the default driver is required to allow USB devices to function properly.

USB power information

A USB port provides 500 milliamps of current, which is shared by all devices connected to that port. Connecting several unpowered devices to a port can exceed the maximum allowable current, which may cause problems ranging from sporadic operation to complete failure of all connected devices. Windows allows you to view the total power consumption for each USB port as well as the power consumed by each device connected to that port.

The following sections detail the steps necessary to view and change USB configuration.

24.3.1 Identifying the USB HCI Under Windows 9X

To determine which USB HCI your system uses under Windows 9X, right-click My Computer, choose Properties, and click the Device Manager tab to display the Device Manager, shown in Figure 24-4. Double-click the Universal Serial Bus controllers item to expand it.

Figure 24-4. Windows 9X Device Manager showing this system uses an Intel 82801AA
figs/pcn3_2404.gif

24.3.2 Viewing USB HCI Properties Under Windows 9X

From the Device Manager, double-clicking the Host Controller Interface item displays the Properties dialog for the HCI, shown in Figure 24-5. This dialog includes detailed HCI information that may be useful in troubleshooting USB problems and resolving conflicts.

Figure 24-5. The Windows 9X HCI Properties dialog displaying detailed HCI information
figs/pcn3_2405.gif

The HCI Properties dialog includes the following pages:

General page

The General page displays summary information about the HCI type, manufacturer, and version. It also includes the Device status pane, which indicates when the HCI is working properly and may indicate the cause when the HCI is not working properly. You can also use the General page to disable the device in one or more hardware profiles.

Advanced page

The Advanced page includes the Disable USB error detection checkbox, which sounds like a dangerous thing to do. In fact, disabling USB error detection is sometimes necessary if USB is to run properly. If you are not experiencing USB conflicts or problems, leave USB error detection enabled. Otherwise, try disabling it. This page also includes the Bandwidth Usage button. Clicking that button displays the percentage of the available bandwidth consumed by each device connected to the port. This can be useful information when you troubleshoot USB problems because some USB devices, particularly early models, are "bandwidth hogs" that claim bandwidth regardless of whether they are using it and thereby prevent other devices connected to the same port from functioning correctly, if at all.

Driver page

The Driver page displays the HCI driver provider and version in use by the HCI. Click the Driver File Details button to display the paths and filenames of the USB driver files. Click the Update Driver button to invoke the Update Device Driver Wizard, which allows you to replace the current driver with a different version. Although the default driver generally works properly, depending on the HCI your system uses and the particular devices you have connected, you may need to replace the driver with a later (or earlier) version for full functionality.

Resources page

The Resources page displays the IRQ and I/O port being used by the HCI. By default, the Use automatic settings checkbox is marked, which is the proper setting for routine operation. But, depending on the HCI your system uses and the particular devices you have connected, you may need to clear that checkbox and assign settings manually. For example, Windows 9X typically assigns a shared interrupt to the HCI. Although this usually works properly, some HCIs and some hardware configurations do not work properly using a shared interrupt. If that occurs, use the Device Manager to locate an unused interrupt, clear the Use automatic settings checkbox, and assign the unused interrupt to the HCI.

24.3.3 Viewing USB Root Hub Properties Under Windows 9X

From the Device Manager, double-clicking the USB Root Hub item displays the Properties dialog for the root hub, shown in Figure 24-6. This dialog includes detailed root hub information that may be useful in troubleshooting USB problems and resolving conflicts.

Figure 24-6. The Windows 9X Root Hub Properties dialog displaying detailed root hub information
figs/pcn3_2406.gif

The USB Root Hub Properties dialog includes the following pages:

General page

The General page displays summary information about the root hub type, manufacturer, and version. It also includes the Device status pane, which indicates when the root hub is working properly and may indicate the cause when the root hub is not working properly. You can also use the General page to disable the device in one or more hardware profiles.

Power page

The Power page includes only the Power properties button. Clicking this button displays the Power dialog, shown in Figure 24-7. The Hub Information pane of this dialog lists the hub type and the maximum total power available per port. The Devices on this Hub pane lists the name and description of each device connected to the hub and the power it requires. Connecting multiple unpowered USB devices to a hub is one of the most common causes of USB problems. If you experience USB problems, use this dialog to verify that the total power consumption of all connected devices does not exceed the maximum the port can deliver. Note that powered USB devices (those that connect to AC power directly) show very low power consumption, often only 0 mA to 5 mA. That is because this dialog shows only the power being drawn from the root hub, and not the power being supplied to the device by a wall outlet.

Figure 24-7. The Windows 9X Power dialog showing all devices connected to the hub and the amount of hub power required by each
figs/pcn3_2407.gif
Driver page

The Driver page displays the root hub driver provider and version in use by the root hub. Click the Driver File Details button to display the paths and filenames of the USB driver files. Click the Update Driver button to invoke the Update Device Driver Wizard, which allows you to replace the current driver with an updated version. Unlike the HCI driver, you will seldom have occasion to replace the root hub driver file.

24.3.4 Verifying USB Interrupt Sharing Under Windows 9X

Windows ordinarily assigns a shared interrupt to the USB HCI, which sometimes works properly. Often, however, USB works improperly unless the HCI has a dedicated interrupt. To verify USB interrupt sharing status under Windows 9X, from the main Device Manager dialog, click the Properties button to display the Computer Properties dialog shown in Figure 24-8.

Figure 24-8. Windows 9X Device Manager showing this system shares an interrupt between the USB HCI and an Ethernet adapter
figs/pcn3_2408.gif

In this instance, the Device Manager shows that USB HCI is sharing interrupt 09. You can safely disregard the ACPI IRQ Holder for PCI IRQ Steering entry; IRQ Steering entries are simply placeholders, and are unlikely to cause conflicts (at least on motherboards that have ACPI properly implemented, which essentially includes only recent motherboards that use recent Intel chipsets). Similarly, the SCI IRQ used by ACPI bus is a system-level entry, which is unlikely to cause a problem. The Intel 8255x-based PCI Ethernet Adapter (10/100) entry, however, represents a real piece of hardware that is using real interrupts and therefore has the potential to cause a conflict. In this case, it does not. If it did, we would go to the Resources page of USB HCI Properties and manually assign a dedicated IRQ to it.

24.3.5 Identifying the USB HCI Under Windows 2000/XP

To determine which USB HCI your system uses under Windows 2000 or Windows XP, right-click My Computer, choose Properties, display the Hardware page, and then click the Device Manager button to display the Device Manager. Double-click the Universal Serial Bus controllers item to expand it, as shown in Figure 24-9.

Figure 24-9. Windows XP Device Manager showing that this system uses two Intel 82801BA/BAM UHCIs
figs/pcn3_2409.gif

In this case, as is common on recent systems, the motherboard includes two distinct HCIs. These operate completely independently, and each HCI has a separate root hub associated with it. This doubles the number of root hub ports available, some of which may appear at the front of the case and some of which connect directly to the traditional location on the rear ATX I/O panel. Note that the secondary root hub ports often appear as a set of header pins on the motherboard, which may be extended to the front or the rear of the case, as necessary.

24.3.6 Viewing USB HCI Properties Under Windows 2000/XP

From the Device Manager, double-clicking the Host Controller Interface item displays the Properties dialog for the HCI, shown in Figure 24-10. This dialog includes detailed HCI information that may be useful in troubleshooting USB problems and resolving conflicts.

Figure 24-10. The Windows XP HCI Properties dialog displaying detailed HCI information
figs/pcn3_2410.gif

The HCI Properties dialog includes the following pages:

General page

The General page displays summary information about the HCI name, type, manufacturer, and location on the bus. It also includes the Device status pane, which indicates when the HCI is working properly and may indicate the cause when the HCI is not working properly. The Device usage drop-down list allows you to enable or disable the device. The Troubleshoot button (Troubleshooter in Windows 2000) invokes an automated dialog that attempts to resolve USB connectivity problems, although we must say that we seldom find the suggestions it offers very useful in solving an actual USB problem.

Advanced page

The Advanced page includes the Don't tell me about USB errors checkbox (Disable USB error detection in Windows 2000). Although error-detection sounds like a good thing, there are times when it must be disabled for USB to operate properly. During routine USB operation, leave USB error detection enabled unless you experience problems or conflicts. If that happens, try disabling error detection by marking this checkbox. This page also includes the Bandwidth-consuming device pane, which displays the percentage of the available bandwidth consumed by each device connected to the port. This can be useful information when you troubleshoot USB problems because some USB devices, particularly early models, are "bandwidth hogs" that claim bandwidth regardless of whether they are using it and thereby prevent other devices connected to the same port from functioning correctly, if at all.

Driver page

The Driver page displays the HCI driver provider, date, and version in use by the HCI, as well as the name of the entity that digitally signed the driver. Click the Driver Details button to display the paths and filenames of the USB driver files. Click the Update Driver button to invoke the Hardware Update Wizard (Upgrade Device Driver Wizard in Windows 2000), which allows you to replace the current driver with a different version. Although the default driver generally works properly, depending on the HCI your system uses and the particular devices you have connected, you may need to replace the driver with a later (or earlier) version for full functionality. Windows XP includes a fourth button, Roll Back Driver, which allows you to easily revert to the previous driver version if the updated driver does not function properly.

Resources page

The Resources page displays the IRQ and I/O port being used by the HCI. By default, the Use automatic settings checkbox is marked, which is the proper setting for routine operation. But, depending on the HCI your system uses and the particular devices you have connected, you may need to clear that checkbox and assign settings manually, if that option is available.

24.3.7 Viewing USB Root Hub Properties Under Windows 2000/XP

From the Device Manager, double-clicking the USB Root Hub item displays the USB Root Hub Properties dialog, shown in Figure 24-11. This dialog includes detailed root hub information that may be useful in troubleshooting USB problems and resolving conflicts.

Figure 24-11. The Windows XP Root Hub Properties dialog displaying detailed root hub information
figs/pcn3_2411.gif

The USB Root Hub Properties dialog includes the following pages:

General page

The General page displays summary information about the root hub type, manufacturer, and location. It also includes the Device status pane, which indicates when the root hub is working properly and may indicate the cause when the root hub is not working properly. The Device usage drop-down list allows you to enable or disable the device. The Troubleshoot button (Troubleshooter in Windows 2000) invokes an automated dialog that attempts to resolve USB connectivity problems. The Windows 2000 version is rudimentary, but may be helpful in resolving simple problems. The Windows XP version is more polished, but is little more substantive than the Windows 2000 version.

Power page

The Power page Hub Information pane lists the hub type and maximum total power available per port. The Attached Devices pane (Devices on this hub in Windows 2000) lists the name and description of each device connected to the hub and the power it requires. If you have USB problems, use this dialog to verify that the total power consumption of all connected devices does not exceed the maximum the port can deliver.

Driver page

The Driver page displays the root hub driver provider, date, and version in use by the root hub, as well as the name of the entity that digitally signed the driver. Click the Driver Details button to display the paths and filenames of the USB driver files. Click the Update Driver button to invoke the Hardware Update Wizard (Upgrade Device Driver Wizard in Windows 2000), which allows you to replace the current driver with a different version. Windows XP includes a fourth button, Roll Back Driver, which allows you to easily revert to the previous driver version if the updated driver does not function properly. Unlike the HCI driver, you will seldom need to replace the root hub driver file.

Power Management page

This page, not present in Windows 2000, contains only two checkboxes:

Allow the computer to turn off this device to save power

Marking this checkbox, which is enabled by default, allows ACPI to power down the root hub port after a period of inactivity. We recommend disabling this option on desktop systems because USB peripherals frequently do not recover properly when coming out of standby mode. Problems range from connected peripherals no longer being recognized to two instances of the same peripheral appearing in the Device Manager to the peripheral appearing to be recognized properly but simply not working.

Allow this device to bring the computer out of standby

If you have one or more USB devices attached to the root hub that are capable of waking the system from standby, enabling this checkbox allows them to do so. For example, you might use a USB modem to receive incoming faxes. You may want your system available to receive faxes 24 hours a day but prefer that it not run constantly. If so, use the Screen Saver tab in Display Properties (or Control Panel Power Options) to enable power management, shutting down power to the monitor and hard drive after a specified interval of inactivity, and enable this checkbox. When an inbound fax call arrives, your USB modem will wake the system and allow it to receive the fax. Note, however, that PCs do not awake instantaneously, and the time delay between the wake-up event and when the system actually becomes available may cause problems.

24.3.8 Verifying USB Interrupt Sharing Under Windows 2000/XP

To verify USB interrupt sharing status under Windows 2000 or Windows XP, from the Device Manager, choose View Resources by Type, and expand the Interrupt request (IRQ) item, as shown in Figure 24-12.

Figure 24-12. Windows XP Device Manager showing that this system dedicates PCI interrupts 19 and 23 to the two USB HCIs
figs/pcn3_2412.gif

On recent motherboards, Windows 2000 and Windows XP typically assign a dedicated PCI interrupt above 15 to each device. On older motherboards, Windows 2000 and Windows XP typically assign a shared PCI interrupt to the HCI, as shown in Figure 24-13. Despite all assurances by hardware manufacturers and Microsoft that USB operates properly with a shared interrupt, that is frequently not true. If Windows has assigned a shared interrupt to USB, use the Device Manager to locate an unused interrupt, clear the Use Automatic Settings checkbox, and assign the unused interrupt to the HCI.

Figure 24-13. Windows 2000 Device Manager showing that this system shares one interrupt among the USB HCI and four other devices
figs/pcn3_2413.gif

On the system shown in Figure 24-13, Windows 2000 has assigned one shared PCI interrupt among the USB HCI, the SCSI host adapter, the video card, the network adapter, and the sound adapter. Surprisingly enough, all of these functions work properly. If a conflict did occur, we would use the Resources page of USB HCI Properties to manually assign a dedicated IRQ to it.

24.3.8.1 Configuring USB under Linux

The first draft of this section originally began, "USB under Linux is not ready for prime time." We eventually came to realize that USB under Linux "just works," and the reason for that change of heart is instructive.

In preparing to write this section, we installed current releases of Red Hat and Mandrake Linux on three representative test-bed systems?a Pentium III on an i815 motherboard, a Pentium 4 on an i845PE motherboard, and an Athlon on an nForce2 motherboard. We then connected diverse USB peripherals, from mice and keyboards to printers and scanners to external optical drives. Some of them weren't even recognized. Some of them worked, more or less. Some of them worked sometimes and not other times. Others didn't work at all. None of them worked reliably.

We had just about written off Linux as having poor USB support. Fortunately, we have a "back channel" mailing list of experienced Linux users to whom we turn when we have questions about Linux hardware issues. We told them about our problems with USB under Linux, and received many responses, all of which basically said, "USB works fine for me under Linux." Hmmm.

After much hair-pulling, we finally determined that the problem was ... a bad cable. Trying to make testing more convenient, we did something stupid. As often happens, cutting corners to save time actually ended up costing us time. We swapped systems and peripherals around during the failed initial testing, but we always used the same cables. One of the cables came with an HP scanner. It looked like a good cable, but it turned out to be a snake in the grass. If it had failed completely, we would have isolated the problem quickly. But it "almost worked," and that cost us days of frustration. If we'd followed our own troubleshooting advice we'd have solved the problem quickly. The moral is, if you're having USB problems, try using a known-good cable.

Although 2.2.18 and later kernels had partial USB support, the 2.4 Linux kernel was the first with full, robust USB support. USB 2.0 support arrived with the 2.4.19 Linux kernel. If you are running an earlier kernel and intend to use USB, we recommend upgrading to the most recent stable 2.4.X kernel or later.

In general, recent Linux releases require no USB configuration. If you run a recent Linux release on modern hardware, USB generally just works. The usual caveats apply, however. Recent Intel HCIs are much less likely to have compatibility problems than are older HCIs and those from some other manufacturers. VIA HCIs in particular seem to have as many USB problems under Linux as they do under Windows. Accordingly, it is important to determine the HCI your motherboard uses.

The KDE Control Center provides an easy way to identify the HCI. To use it for this purpose, start KDE Control Center, expand the Information branch in the left pane, double-click the PCI item, and scroll down in the right pane to locate the USB HCI items. Figure 24-14 shows dual 82801BA/BAM HCIs on an Intel ICH2 motherboard. The ICH2 HCIs are well-behaved in general, and function well under Linux. The HCI listing also provides other useful information, including the I/O port addresses and interrupts assigned to each HCI.

Figure 24-14. KDE Control Center displaying HCI type, I/O ports, and interrupts
figs/pcn3_2414.gif

From the command line, you can display HCI information using the command /sbin/lspci -v|grep HCI, the output from which is shown in the following example:

00:1f.2 USB Controller: Intel Corp. 82801BA/BAM USB (Hub #1) (rev 05) (prog-if 00 [UHCI])
00:1f.4 USB Controller: Intel Corp. 82801BA/BAM USB (Hub #2) (rev 05) (prog-if 00 [UHCI])
02:00.0 FireWire (IEEE-1394): Lucent Microelectronics FW323 (rev 04) (prog-if 10 [OHCI])

You can also use KDE Control Center to determine interrupt-sharing status by double-clicking the Interrupts item. Figure 24-15 shows that the first usb-uhci has exclusive use of Interrupt 10, but that the second usb-uhci shares Interrupt 11 with ohci1394 (a FireWire interface) and eth0 (an Ethernet interface). Although shared interrupts may cause USB conflicts under Windows, we have never encountered any problems with a USB shared interrupt under Linux.

Figure 24-15. KDE Control Center displaying interrupt assignments
figs/pcn3_2415.gif

KDE Control Center can also list USB devices. To display a list of connected USB devices, double-click the USB Devices item. To view the details for a device, double-click that device. For example, Figure 24-16 shows the details for a UMAX Astra 3400U scanner. (We still haven't figured out what the "Unknown" device is, but it shows up regularly and doesn't seem to cause any problems.)

Figure 24-16. KDE Control Center displaying details for connected USB devices
figs/pcn3_2416.gif

If you don't have KDE installed or if you simply prefer the command line, use the command cat /proc/bus/usb/devices to display more USB configuration information than you'll know what to do with. The following example shows the USB configuration for the same system used for the previous GUI example:

T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc= 11/900 us ( 1%), #Int=  1, #Iso=  0
D:  Ver= 1.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 0.00
S:  Product=USB UHCI Root Hub
S:  SerialNumber=ef80
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=255ms
T:  Bus=02 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#=  2 Spd=12  MxCh= 4
D:  Ver= 1.10 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=8086 ProdID=1122 Rev= 0.00
C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=255ms
T:  Bus=02 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=  3 Spd=12  MxCh= 0
D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=1606 ProdID=0060 Rev= 1.00
S:  Manufacturer=UMAX
S:  Product=USB SCANNER
C:* #Ifs= 1 Cfg#= 1 Atr=00 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=ff Driver=(none)
E:  Ad=81(I) Atr=03(Int.) MxPS=   1 Ivl=16ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=03(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
T:  Bus=02 Lev=02 Prnt=02 Port=01 Cnt=02 Dev#=  4 Spd=12  MxCh= 0
D:  Ver= 1.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=04b8 ProdID=0005 Rev= 1.00
S:  Manufacturer=EPSON
S:  Product=USB Printer
S:  SerialNumber=W30169912131319590
C:* #Ifs= 1 Cfg#= 1 Atr=c0 MxPwr=  2mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=07(print) Sub=01 Prot=02 Driver=usblp
E:  Ad=01(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=12  MxCh= 2
B:  Alloc=  0/900 us ( 0%), #Int=  0, #Iso=  0
D:  Ver= 1.00 Cls=09(hub  ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
P:  Vendor=0000 ProdID=0000 Rev= 0.00
S:  Product=USB UHCI Root Hub
S:  SerialNumber=ef40
C:* #Ifs= 1 Cfg#= 1 Atr=40 MxPwr=  0mA
I:  If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
E:  Ad=81(I) Atr=03(Int.) MxPS=   8 Ivl=255ms

The default USB configuration is suitable for most purposes. However, if you need to tweak the USB configuration, you can rebuild the kernel with different USB support options. The KDE Linux Kernel Configurator, shown in Figure 24-17, provides an easy way to do that.

In the first draft of this section, we didn't give detailed instructions, on the theory that someone who couldn't figure out how to reconfigure, recompile, and install a kernel shouldn't be doing it in the first place. Our editor thought we should give a bit more detail, so we expanded the section. But do be careful.

Figure 24-17. The Linux Kernel Configurator
figs/pcn3_2417.gif

Reconfiguring USB support options in the kernel is not for the faint of heart. Before you attempt it, make sure to read and understand the detailed technical documentation available on the Linux USB Project web site (http://www.linux-usb.org/).

To run the KDE Linux Kernel Configurator, log on as root, start KDE Control Center, expand the System item in the left menu pane, and choose Linux Kernel Configurator. Make any necessary changes, save those changes, compile and install the new kernel, and reboot the system. If you don't know how to compile and install a kernel, see the Linux Kernel HOWTO (http://www.tldp.org/HOWTO/Kernel-HOWTO.html).

Always save the new kernel under a different name. That way, if the new kernel won't boot, you can simply boot to the old kernel. If there's a problem with the new kernel and you saved it under the same name as the old kernel, your system may be unbootable.

Before you build a new kernel, check to see if kernel modules already exist for the alternate drivers. If they do, you may simply need to configure the kernel modules already present in the current kernel. For more information about configuring kernel modules, see the Linux Kernel HOWTO.