Resetting the USB Subsystem The Universal Serial Bus (USB) is a major improvement for all computer systems to allow a universal connection type for numerous device types. The Bus system is a little more complicated than most can imagine. Sometimes, it is possible that the USB devices fail and require to be restarted. Usually, this is a simple procedure of restarting the system, but this can be a major hassle at times. There is a better way. Before we get to restarting the Universal Serial Bus, we need a little more understanding about it. The main points about USB which makes it universally accepted are: Connector type – a universal connector which is unlike other types. Before, the serial, parallel, video, etc. were all different connector types. Expandable – ability to support 127 devices on a single bus. Hot swappable – supports attach/removal of device while system is on. Performance – four speeds exist depending on USB type Low Speed – 1.5 Mb/sec for USB 1.0 Full Speed – 12 Mb/sec for USB 1.1 High Speed – 480 Mb/sec for USB 2.0 Super Speed – 5 Gb/sec for USB 3.0 Plug and Play – supported Operating Systems can detect device type and configure the device as needed. Power – supplied by bus, if needed. Power Saving – ability to suspend/resume devices when not in use. Simplicity – easy for users to manage hardware. As noted, there are four basic USB standards. Each standard has a specific Interface type as follows: 1.x – Open Host Controller Interface (OHCI) 1.x – Universal Host Controller Interface (UHCI) 2.0 – Enhanced Host Controller Interface (EHCI) 3.0 – eXtensible Host Controller Interface (xHCI) To determine your USB type in Linux, go to a Terminal and use the 'lsusb -t' command. The following shows three different systems. FIGURE 1 FIGURE 2 FIGURE 3 Looking at Figure 1, you can see there are four USB buses. These are labeled Bus 1 to Bus 4. All of these main devices are listed as “root_hubs” on Port 1. Root hubs are always Port 1 and devices attached are listed on the following ports, starting at 2, as they are attached. The driver specifies the Linux driver and designates the USB Standard (OHCI, UHCI, EHCI or xHCI). The number following the “/” designates how many ports are located on the device. Be aware that the number of ports may not be external ports. For example, Bus 1 in Figure 1 shows it has six ports. Bus 1 is definitely USB 2.0 since it is listed with the driver EHCI and lists the bus speed as 480M. Buses 2 to 4 are all USB 1.1 at a speed of 12M. NOTE: Be aware that a port can be connected to a USB 1.x and 2.0 Root Hub. If the USB 2.0 Root Hub fails, then the port to which it is connected can still function as a USB 1.x port. We can explore this ability later. Figure 2 shows a system with seven USB Buses. Three of the buses are USB 2.0 and four are USB 1.1. Some internal devices, which may be part of the ports, can include: Audio Video Network Chipsets Card readers Optical devices Internally mounted Mass Storage Device Bluetooth Some systems use the bus on the motherboard and some motherboards literally have a USB port on it. An internal USB port can be used to add external ports or add an internal device. USB mass storage devices can be mounted internally and attached to the port. Figure 3 shows a system with three USB hubs. Bus 1 and 2 are USB 2.0 while Bus 3 is a USB 3.0 root hub. Remember that the Root Hubs are listed as Device 1. Here, you can see there is a Device 2 on Bus 1 which is listed as “Intel” and is an Intel Webcam. Bus 2 has two devices connected to it as Device 2 and Device 3. Device 2 is listed as “Syntek” which is a mouse. Device 3 is a Multi Flash reader. You may be looking at Figure 3 and thinking about the ID. Each USB device has a built-in Device ID which is in two parts separated by a colon ). The first part is the manufacturer (Vendor ID) and the second part is the device (Product ID). For example, 8087 is the manufacturer ID for Intel. NOTE: Vendors may have more than one ID. A list of Vendor IDs can be found on the Internet or at https://usb-ids.gowdy.us/read/UD/. If you have multiple external USB ports, you can place a device in a port and run 'lsusb' at a prompt in a terminal. From the output, you can determine which port belongs to which bus. By doing this, you can tell which port is which USB Standard and speed. To see the USB devices in a tree view, you can use the “lsusb -t” command as shown in Figure 4 which is the output from the system in Figure 3. FIGURE 4 So, let's look back at Figure 2. Here, we can see there are seven Root Hubs listed as Bus 1 through 7. To be able to disable the Bus, we need to have a number for it which is made up as follows: Domain:Bus:Slot.Function 0000:00:00.0 We have to find the addresses for each Root Hub to turn it off and back on. To get the addresses, we use the following command: lspci | grep USB NOTE: The command is case-sensitive, especially the 'USB' portion. The 'grep' portion of the command is looking for lines with 'USB' in it. The system from Figure 2 will produce an output as shown in Figure 5. FIGURE 5 Figure 5 shows the seven Root Hubs with the address. It is only missing the Domain portion which is: 0000. So, now we have the following addresses with a USB Type: 00:12.0 OHCI – USB 1.1 00:12.2 EHCI – USB 2.0 00:13.0 OHCI – USB 1.1 00:13:2 EHCI – USB 2.0 00:14.5 OHCI – USB 1.1 00:16.0 OHCI – USB 1.1 00:16.2 EHCI – USB 2.0 There is a minor problem yet. We do not know which address is for which Bus. If you managed some testing with the 'lsusb' command and moved a device from port to port, you should have an idea which ports are for which bus. If a port quits working and you wish to turn off that specific Root Hub, then you need to know which port is which. If a Hub fails, you can use 'lsusb -t' to see if it is still 'on'. For example, if your USB mouse stops functioning and you know it is Bus 5, run 'lsusb -t' to determine if Bus 5 is still listed. If Bus 5 does not appear in the output, then Bus 5 has failed. To enable/disable a Root Hub, you need to know the address. Open a Terminal and log in as root. Once in as root, you can use the following command to match up the Busevice to an address: lsusb -v -s bus:device | grep iSerial For example, if I wanted the address for the Root Hub on Bus 1, I would enter the following command: lsusb -v -s 1:1 | grep iSerial Figure 6 shows the results that the Root Hub, always Device 1, on Bus 1 is at the address 0000:00:12.2. FIGURE 6 The same option would need to be run for all Root Hubs on all buses. My system gives the following: 00:12.0 – Bus 4 00:12.2 – Bus 1 00:13.0 – Bus 5 00:13.2 – Bus 2 00:14.5 – Bus 6 00:16.0 – Bus 7 00:16.2 – Bus 3 Let us assume my mouse quit working, which is connected to Bus 5. I run the 'lsusb' command see that Bus 5 is missing as shown in Figure 7. FIGURE 7 I will need to perform a command to cause Bus 5 to be reactivated. I have already determined that Bus 5's address is 0000:00:13.2, and from the 'lsusb -t' command, the driver is 'ohci_hcd'. The command is as follows: echo -n "0000:00:13.0" | tee /sys/bus/pci/drivers/ohci_hcd/bind The address is the address of the device. The 'ohci_hcd' is from the 'lsusb -t' command. There are two terms to use at the end of the statement: bind – enable the Root Hub unbind – disable the Root Hub The same Root Hub could be disabled with the following command: echo -n "0000:00:13.0" | tee /sys/bus/pci/drivers/ohci_hcd/unbind NOTE: The commands can be carried out in a terminal as the root user. Be careful when disabling a specific Bus. If you disable a keyboard or mouse by accident, move the device to a different USB Port. To enable my Bus 1 Root Hub, I would use the following command: echo -n "0000:00:12.2" | tee /sys/bus/pci/drivers/ehci-pci/unbind NOTE: Watch that the USB 1.1 devices are 'ohci_hcd' and the USB 2.0 devices are 'ehci-pci'.