List of Slides 1 – Set Up USB devices [2] . . . . . . . . . . . . . . . . . . . . . . 3 1.1 – (1.1) 101 Hardware & Architecture [11] . . . . . . . . . . . . 3 1.2 – Objective . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4 1.3 – Key files, terms, and utilities . . . . . . . . . . . . . . . . . . 5 1.4 – Resources of interest . . . . . . . . . . . . . . . . . . . . . . 6 2 – The Universal Serial Bus . . . . . . . . . . . . . . . . . . . . . . 7 3 – USB Topology . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 3.1 – 4.1 – ................................. 8 ................................. 9 4 – USB Device Driver Layers . . . . . . . . . . . . . . . . . . . . . 9 5 – USB Controllers . . . . . . . . . . . . . . . . . . . . . . . . . . 10 1 5.1 – 5.2 – 6.1 – . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 6 – USB Modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 6.2 – Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . 13 6.3 – Starting up the USB sub-system . . . . . . . . . . . . . . . . 14 6.4 – Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 7 – USB Interrogation Utilities . . . . . . . . . . . . . . . . . . . . . 16 7.1 – LSUSB - A console view of USB devices . . . . . . . . . . . 16 7.2 – USBVIEW - An X view of USB devices . . . . . . . . . . . . 19 8 – Hotplugging USB Devices . . . . . . . . . . . . . . . . . . . . . 21 8.1 – . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 2 8.2 – . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 3 – General Linux 2 – Set Up USB devices [2] (Linux Professional Institute Certification) a .˜. /V\ // \\ @._.@ by: geoffrey robertson geoffrey@zip.com.au $Id: gl2.101.5.slides.tex,v 1.3 2003/08/29 14:36:14 waratah Exp $ c 2002 Geoffrey Robertson. Permission is granted to make and distribute verbatim copies or modified versions of this document provided that this copyright notice and this permission notice are preserved on all copies under the terms of the GNU General Public License as published by the Free Software Foundation—either version 2 of the License or (at your option) any later version. a Copyright 4 ⇒• Set Up USB devices [2] . . . . . . . . . . . . . . . (1.1) 101 Hardware & Architecture [11] Objective Key files, terms, and utilities Resources of interest 3 • • • • • • The Universal Serial Bus . . . . . . . . . . . . . . . USB Topology . . . . . . . . . . . . . . . . . . . . USB Device Driver Layers . . . . . . . . . . . . . . USB Controllers . . . . . . . . . . . . . . . . . . . USB Modules . . . . . . . . . . . . . . . . . . . . . USB Interrogation Utilities . . . . . . . . . . . . . . 5 7 8 9 10 12 16 • Hotplugging USB Devices . . . . . . . . . . . . . . 21 6 Set Up USB devices [2] (1.1) 101 Hardware & Architecture [11] 2.101.1 Configure BIOS Fundamental Settings [3] 2.101.2 Setup SCSI devices [2] 2.101.3 Setup different PC expansion cards [2] 2.101.4 Configure communication devices [2] 2.101.5 Set Up USB devices [2] 7 Set Up USB devices [2] Objective Candidates should be able to activate USB support, use and configure different USB devices. This objective includes the correct selection of the USB chipset and the corresponding module. It also includes the knowledge of the basic architecture of the layer model of USB as well as the different modules used in the different layers. 8 Set Up USB devices [2] Key files, terms, and utilities lspci(8) usb-uhci.o usb-ohci.o /etc/usbmgr/ usbmodules /etc/hotplug 9 Set Up USB devices [2] Resources of interest The Linux-USB Project : http://www.linux-usb.org: The Linux USB Sub System : by Brad Hards, Sigma Bravo Pty Ltd 10 √ • • • • • • • Set Up USB devices [2] . . . . . . . . . . . . . . . The Universal Serial Bus . . . . . . . . . . . . . . . USB Topology . . . . . . . . . . . . . . . . . . . . USB Device Driver Layers . . . . . . . . . . . . . . USB Controllers . . . . . . . . . . . . . . . . . . . USB Modules . . . . . . . . . . . . . . . . . . . . . USB Interrogation Utilities . . . . . . . . . . . . . . Hotplugging USB Devices . . . . . . . . . . . . . . 3 7 8 9 10 12 16 21 ⇒• 11 The Universal Serial Bus • Two versions of USB Version 1 & Version 2 – released January 1996 – supports speeds up to 12MBit/s (8.5Mbit/s in practice) – supports up to 127 devices connected to the bus • Version 2: – announced 1999 – supports speeds up to 480Mbit/s • Devices can be self or bus powered 12 • A serial transmission scheme • Version 1 USB Topology The system unit contains the host controller and one virtual root hub with at least one (and normally two) USB interfaces. These interfaces can then be connected directly to a USB device or to another HUB. USB Host Controller Virtual Root Hub Device HUB Device Device 13 Donwstream Upstream Device HUB Device USB Device Driver Layers The Device drivers for the USB sub-system are split into two distinct layers: Hardware Layer usbcore & usb-uhci / usb-ohci API Layer - Application / Product specific Xsane Xcdroast Applications USB DRIVER (scanner.o) USB DRIVER USB DRIVER (usb−storage) Upper API USBCORE Lower API USB−OHCI OR USB−UHCI 14 USB Controllers There are two categories of USB controller usb-uhci For Intel, PIIX4, Via controllers usb-ohci For Compaq, iMacs, OPTi, SiS, ALi controllers The UHCI controllers use a 16 bit IO address: I/O at 0xHHHH eg: I/O at 0xe400 The OHCI controllers use a 32 bit memory address: memory at 0xHH000000 eg memory at 0xee000000 15 USB Controllers To determine your controller type, examine /proc/pci for a clue: [root@Node4] root]# cat /proc/pci PCI devices found: ......... Bus 0, device 7, function 2: USB Controller: VIA Technologies Inc. UHCI USB(rev 17). IRQ 10. Master Capable. Latency=32. I/O at 0xe400 [0xe41f]. ......... 16 USB Modules Assuming you have a modular kernel, the following modules will be required: usbcore The base usb kernel module plus one of the controller specific modules either usb-uhci For Intel, PIIX4, Via controllers usb-ohci For Compaq, iMacs, OPTi, SiS, ALi controllers 17 USB Modules Configuration An entry in /etc/modules.conf aliases the specific controller to usb-controller as follows: alias usb-controller usb-uhci 18 USB Modules Starting up the USB sub-system To have the usb sub-system startup automatically at boot time, all you need to do is ensure that the above alias line is present in /etc/modules.conf. To startup manually, do the following steps: • insmod usbcore • mount the usbdevfs filesystem (optional but highly recommended) • insmod usb-uhci (or usb-ohci) 19 USB Modules Example [root@Node4]# insmod usbcore Using /lib/modules/2.4.18-4/kernel/drivers/usb/usbcore.o [root@Node4] root]# insmod usb-uhci Using /lib/modules/2.4.18-4/kernel/drivers/usb/usb-uhci.o [root@Node4]# mount -t usbdevfs usbdevfs /proc/bus/usb Once this is done, you should see the following entries in /proc/bus/usb: [root@Node4] root]# ls /proc/bus/usb 001 devices drivers 20 USB Interrogation Utilities LSUSB - A console view of USB devices Lsusb is a text utility contained in the usbutils package. Use ’rpm -Uvh usbutils.xxx.rpm’ to install. [root@node4]# lsusb Bus 001 Device 001: ID 0000:0000 Virtual Hub Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.00 bDeviceClass 9 Hub iProduct 2 USB UHCI Root Hub .......... 21 LSUSB - A console view of USB devices Bus 001 Device 002: ID 03f0:0601 Hewlett-Packard ScanJet 6300c Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.00 bDeviceClass 0 Interface bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x03f0 Hewlett-Packard idProduct 0x0601 ScanJet 6300c bcdDevice 1.00 iManufacturer 1 iProduct 2 HP ScanJet 6300C iSerial 3 SG9941706SPE 22 LSUSB - A console view of USB devices Bus 001 Device 003: ID 1189:6000 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.00 bDeviceClass 0 Interface bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x1189 idProduct 0x6000 bcdDevice a.03 iManufacturer 0 iProduct 1 USB Optical Storage Device iSerial 0 23 USB Interrogation Utilities USBVIEW - An X view of USB devices • Usbview is a GUI utility contained in the usbview package. Use ’rpm -Uvh usbview.rpm’ to install. • Usbview parses /proc/bus/usb/devices for connected USB devices. Any device that has a problem will be printed in red. 24 25 Hotplugging USB Devices When a device is plugged into a USB port, it will automatically register itself with the USB subsystem. The upper API drivers will not however automatically ’insmod’ themselves unless the hotplug package has been installed. With the hotplug package installed, an entry in /proc/sys/kernel/hotplug will be created which will contain the name of an executable to be called whenever a new device is detected on the bus. $ ls /proc/sys/kernel/hotplug /sbin/hotplug 26 Hotplugging USB Devices For example, when a USB scanner is plugged in, hotplug will automatically load the module ’scanner.o’. The xsane application can then be run directly without any user intervention. • /sbin/hotplug is an executable which is called by the kernel (kernel space to user space interface) • /etc/hotplug is a directory containing configuration information for hotplug (which drivers to load when a device is plugged in) 27 The End √ √ √ √ √ √ √ √ • • • • • • • • Set Up USB devices [2] . . . . . . . . . . . . . . . The Universal Serial Bus . . . . . . . . . . . . . . . USB Topology . . . . . . . . . . . . . . . . . . . . USB Device Driver Layers . . . . . . . . . . . . . . USB Controllers . . . . . . . . . . . . . . . . . . . USB Modules . . . . . . . . . . . . . . . . . . . . . USB Interrogation Utilities . . . . . . . . . . . . . . Hotplugging USB Devices . . . . . . . . . . . . . . 3 7 8 9 10 12 16 21 28