fbpx USB on Linux: Mount USB Drive and Identify Devices | Certificação Linux

Configure USB on Linux

📅 03/06/2019 ⏱ 5 min ✍️ Uira Ribeiro
Linuxcommandshow-to
Configure USB on Linux
Exam Pass App — mais de 7.000 questões LPI, offline, em 5 idiomas, disponível no Android e na App Store
Available on
Google Play
Available on
App Store

See how to recognize USB devices in Linux

USB stands for Universal Serial Bus. This technology created a new method for 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, because they had to open the computer to install an expansion 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 became easier.

The goal of the PnP standard was to enable the user to install a new peripheral and use it immediately, without much difficulty.

A group of companies created a consortium in 1995 to develop a hardware specification and promote rapid adoption of this new technology and the development of new compatible, high-quality devices.

Thus was born USB (Universal Serial Bus), 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.

USB bus 1.0 and 1.1 supports up to 127 devices at a speed of up to 12 Mbps.

USB 2.0 allows transfer rates up to 480 Mbps. The 3.0 version introduced in 2010 supports a maximum theoretical rate of 4.8 Gbps, but on average it operates at 3.2 Gbps.

This latest standard requires a different connector than the 1.x and 2.0 standards and necessarily a kernel with version higher than 2.6.31.

The peripherals that will be covered as examples are the keyboard, mouse, printers and the Creative Labs USB WebCam3.

The first step is to determine which xHCI (Host Controller Interface) your motherboard has and load the corresponding module for 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, you will need to load the usb-uhci module.

If it has an OPTi, SiS, ALi, Compaq, Apple chipset, you will need to load 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 move on to the peripherals:

Configure the Keyboard in Linux

To correctly configure your USB keyboard, we need to load two additional modules:

# modprobe hid

And

$ modprobe keydev

Configure the Mouse in Linux

The procedure to install a USB Mouse device is similar to activating the keyboard:

# modprobe hid

And

# modprobe mousedev

Configure USB Printer in Linux

In the case of the printer, you will need to load, after the correct module for your chipset, the following module:

# modprobe printer

Configure USB Camera (webcam) in Linux

The Creative Labs USB WebCam is based on the OV511 chip. We should load, after the chipset module, the appropriate module for the camera:

# modprobe ov511

Configure other USB devices in Linux

Linux has support for various USB devices through Kernel modules. You can check the supported Chipsets in the /lib/modules/kernel-version/drivers/usb directory.

Tools for USB Device Configuration

Some distributions have interesting tools for automatic USB device configuration, such as usbmgr and hotplug.

The usbmgr is a tool used to load and unload Kernel modules for USB devices when they are connected or disconnected from the computer and automatically execute their configuration scripts.

The usbmgr has the file /etc/usbmgr.conf which contains an extensive list of devices and manufacturers that are automatically recognized and configured. You don't need to modify this file.

The hotplug tool was introduced starting with Kernel 2.4 to automatically recognize and configure USB, PCI Cardbus (PCMCIA), IEEE 1394 (Firewire) and docking stations for laptops.

The hotplug comes into play with the function of detecting new devices. It is responsible for loading the appropriate modules, adjusting permissions and executing various tasks whenever a new device is connected.

Starting with Kernel 2.6, hotplug became the standard component for USB, PCMCIA and Firewire hardware detection. It is part of system services and can be loaded with the command:

# /etc/init.d/hotplug start

The hotplug configuration files are concentrated within the /etc/hotplug folder.

The hotplug works with device identification codes, loading modules or executing scripts with various functions.

In most distributions the /etc/hotplug/usb.distmap file contains the pre-configured rules for various USB devices.

You can place additional rules using the /etc/hotplug/usb.usermap file, enabling the execution of custom scripts when certain devices are connected, such as playing a sound, opening a specific program or even making an automatic backup.

Learn much more about Linux in our online course. You can enroll here with a 7-day free trial. If you already have an account, you can access it here.

Like it? Share :-)

Uira Ribeiro

Prof. Uirá Ribeiro

Chair do Board do Linux Professional Institute

After years of watching professionals waste hours on simple tasks because they didn't know the right Linux tools, I decided to teach.
Today I'm the author of most of LPI's official Learning Materials and mentor to over 14,000 certified students.

See my full story →

That was just one piece. The course teaches the whole path — from your first command to exam day.

Certificação Linux — a plataforma líder em certificações Linux no Brasil
WhatsApp