LPI Linux Certification/Configure USB Devices
Configure USB Devices
- Candidates should be able to activate USB support, use and configure different USB devices.
- Key knowledge area(s):
- Identify and load the correct USB driver module.
- Demonstrate knowledge of the USB layer architecture and the modules used in the different layers.
- The following is a partial list of the used files, terms and utilities:
Auto detection of new USB Devices
The program that gets executed when a new hardware is connected is hotplug.
hotplug name Common names are: pci: PCI devices. usb: USB devices.
The /etc/hotplug directory contains the script that must be executed each time a device gets inserted or removed.
* /etc/hotplug/pci.agent: To install the appropriate PCI driver. * /etc/hotplug/usb.agent: To install the appropriate USB driver.
The hotplug program is also started at boot time to initialize all the connected devices. /etc/init.d/hotplug
List USB Devices
To verify your devices have been detected, use lsusb.
$ lsusb -v Bus 001 Device 004: ID 04a9:3045 Canon Inc. PowerShot S100 Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.00 bDeviceClass 255 Vendor Specific Class bDeviceSubClass 255 Vendor Specific Subclass bDeviceProtocol 255 Vendor Specific Protocol bMaxPacketSize0 32 idVendor 0x04a9 Canon Inc. idProduct 0x3045 PowerShot S100 ...
To display a graphical view of the connected USB devices, use usbview
Every detected USB device will be mounted in the /proc/bus/usb filesystem and can be accessed with the appropriate application.
Each USB device will be viewed through a filename like /proc/bus/usb/001/005 .
To check if the appropriate driver has been loaded for a USB devices, use usbmodules.
usbmodules –device /proc/bus/usb/001/001
usbmodules –device /proc/bus/usb/001/005 –mapfile /etc/hotplug/usb.handman
The default modules to be loaded are /lib/modules/<kernel-version>/modules.usbmap.
The mapping is stored in the file /lib/modules/<kernel-version>/modules.usbmap.
All the drivers are stored in the directory /lib/modules/<kernel-version>/kernel/drivers/usb/.
Many applications exist for many different devices. It is sometimes time consuming to make them work. An application that can be used for a digital camera is gphoto2.
- --debug: See what is the problem when talking to the camera.
- --print-usb-usermap: Store the output in /etc/hotplug/usb.usermap in order for the application to support your camera.
- -P: Download pictures.
$ gphoto2 --summary Detected a 'Canon PowerShot S100'. Camera summary : Camera identification: Model : Canon PowerShot S100 Owner: Power status: on battery (power OK) Flash disk information: Drive D: 31'885'312 bytes total 27'668'480 bytes available
- Check if you can detect a digital camera.
- View the camera device information.
- Take a picture and download it into a system with gphoto2.
- Configure your own device (HD, camera, mouse, keyboard,...)