Set up USB on Linux
See how to recognize USB devices on Linux
USB stands for Universal Serial Bus. This technology created a
new method of connecting peripherals to the computer.
Installing a peripheral was seen as a daunting task, worthy only of technicians or people with more experience.
This required more from the user, as they had to open the computer to install an additional card, configure jumpers, IRQs, memory and I/O addresses.
With the implementation of the Plug and Play (PnP) standard for automatic detection of peripherals and devices by the BIOS, this task is made it easier.
The purpose of the PnP standard was to make the user able to install a new peripheral and use it immediately without much difficulty.
In 1995, a group of companies created a consortium to develop a hardware specification and promote the rapid adoption of this new technology and the development of new compatible and high-quality devices.
The USB (Universal Serial Bus) was born, a bus with a single type of port/connector combination, used to easily connect various categories of devices to the computer, such as scanners, cameras, keyboards, speakers, printers, etc.
The USB 1.0 and 1.1 bus allows up to 127 devices at a speed of up to 12 Mbps.
USB 2.0, on the other hand, allows transfer rates of up to 480 Mbps. Version 3.0 introduced in 2010 supports a theoretical maximum rate of 4.8 Gbps, but on average it works at 3.2 Gbps.
This last standard requires a different connector from the standard 1.x and 2.0 and necessarily a kernel with a version higher than 2.6.31.
The peripherals that will be discussed as Examples are the Creative Labs keyboard, mouse, printers, and WebCam3 USB.
The first step is to determine which xHCI (Host Controller Interface) your motherboard has and loads the module corresponding to the chip.
The command to determine which chip is used on your motherboard is:
# lspci -vt
- [00] -+-00.0 VIA Technologies, Inc. VT82C693A/694x [Apollo Pro133x]
+-01.0- [01] —00.0 ATI Technologies Inc Rage XL AGP 2X
+-07.0 VIA Technologies, Inc. VT82C686 [Apollo Super South]
+-07.1 VIA Technologies, Inc. VT82C586/B/686A/B PIPC Bus Master IDE
+-07.2 VIA Technologies, Inc.
USB
+-07.3 VIA Technologies, Inc.
USB
+-07.4 VIA Technologies, Inc. VT82C686 [Apollo Super ACPI]
+-07.5 VIA Technologies, Inc. VT82C686 AC97 Audio Controller
+-0b.0 Adaptec AIC-7892A u160/m
-0d.0 Intel Corp. 82557/8/9 [Ethernet Pro 100]
If your motherboard has an INTEL or VIA Chipset, it will be necessary to upload the usb-uhci module.
If you have a Chipset from OpTi, SiS, ALi, Compaq, Apple it will be necessary to upload the usb-ohci module.
The commands are:
# modprobe usb-uhci
Or
# modprobe usb-ohci
These modules will provide support for USB devices.
Now let’s go to the peripherals:
Configuring the Keyboard on Linux
To properly configure your USB keyboard, we need to charge two additional modules:
# modprobe usb-uhci
AND
$ modprobe keydev
Configuring the Mouse on Linux
The procedure for installing a USB Mouse device is similar to keyboard activation:
# modprobe usb-uhci
AND
# modprobe mousedev
Set up USB Printer on Linux
In the case of the printer, it will be necessary to load the module after correct from your Chipset, the following module:
# modprobe printer
Setting up the USB Camera (webcam) on Linux
The Creative Labs USB WebCam is based on the OV511 chip. We must after the Chipset module, load the appropriate module for the camera:
# modprobe ov511
Set up other USB devices on Linux
Linux supports several USB devices through the modules of the Kernel. You can check the supported Chipsets in the directory /lib/modules/kernel-version/kernel/drivers/usb.
Device Configuration Tools
Some distributions have tools interesting for the automatic configuration of USB devices, such as usbmgr and the hotplug.
usbmgr is a tool used to load and unload Kernel modules for USB devices when they are connected or disconnected from the microphone and automatically execute their configuration scripts.
usbmgr has the file /etc/usbmgr.conf that contains a wide list of devices and manufacturers that are automatically recognized and configured. You don’t need to change this file.
The hotplug tool was introduced starting with Kernel 2.4 to automatically recognize and configure USB, PCI Cardbus (PCMCIA), IEEE 1394 (Firewire) devices and docking stations for laptops.
The hotplug comes into play with the function of detect new devices. It is he responsible for loading the modules appropriate, adjust permissions and perform various tasks whenever a new device is connected.
Starting with Kernel 2.6 the hotplug became the standard component for detecting USB, PCMCIA, and Firewire hardware. It does part of the system services and can be loaded with the command:
# /etc/init.d/hotplug start
The hotplug configuration files are concentrated inside the /etc/hotplug folder.
The hotplug works with device identification codes, loading modules or executing scripts with various functions.
In most distributions, the file /etc/hotplug/usb.distmap contains the preconfigured rules of the various
USB devices.
You can place additional rules using the /etc/hotplug/usb.usermap file allowing the execution of scripts
personalized when certain devices are connected, such as playing a sound, open a certain program, or even perform automatic backup.