LPI Linux Certification/Configure USB Devices

Configure USB Devices edit

Detailed Objective edit

Weight: 1

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 edit

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 edit

To verify your devices have been detected, use lsusb.

lsusb [options]


 $ 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

USB Drivers edit

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 [options]


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/.

USB Applications edit

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.

Common options:

--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

Power status: on battery (power OK) 

Flash disk information:
  Drive D:
   31'885'312 bytes total
   27'668'480 bytes available

Exercises edit


  1. Check if you can detect a digital camera.
  2. View the camera device information.
  3. Take a picture and download it into a system with gphoto2.
  4. Configure your own device (HD, camera, mouse, keyboard,...)