W&T connects
Interfaces for TCP/IP, Ethernet, RS-232, RS-485, USB, 20mA, glass and plastic fiber optic cable, http, SNMP, OPC, Modbus TCP, I/O digital, I/O analog, ISA, PCI
Application for USB-Server

USB Redirector for Linux

Setup and configuration of a systemd-Services

This tutorial explains how to install the USB Redirector for Linux and incorporate a USB device.

Here we presume you are starting from a freshly installed Ubunto 20.04 LTS system. The procedure for setup and configuration can however be applied to other distributions. The only prerequisite is that the following minimum requirements for the USB Redirector are met:

  • Current Linux kernel (>=4.4.0)
  • Support for the VHCI kernel module
  • modprobe tool

Structure of the USB Redirector

Structure of the USB Redirector

The USB Redirector for Linux represents the link between the USB-Server and the kernel landscape.

Virtual USB devices are created on the Linux system using the open-source and common VHCI kernel module. The actual communication is then passed through the USB Redirector via TCP/IP to the USB-Server and the actual USB device.

The USB Redirector is divided into two separate modules.

The Redirector is operated in daemon mode as a background service. The daemon communicates with the kernel and must therefore be used with elevated rights.

As a counterpart to the background service the USB Redirector can be invoked in the application mode. This then instructs the background service to integrate or enable USB devices.

Thumbnail video tutorial

You activate the video function using the following button, whereby you use the provider Google and (at your own risk in terms of data protection ;) share data with it.

Enter YouTube

Preparation: Download USB Redirector

The latest version of the USB Redirector can always be downloaded at the address
https://www.wut.de/linux-usb-umlenkung
. The downloaded TAR archive can then be simply unzipped. On most desktops this is possible using the Windows Explorer in the context menu of the file.

If there is no desktop environment available on the destination system, the Redirector can also be downloaded and unzipped using the following command line:

								
wget -O redirector.tar.gz https://www.wut.de/linux-usb-umlenkung
tar -xzf ./redirector.tar.gz
							
						

After unzipping, check the newly created folder usb-redirector_v3.xx for the needed files.

Installation

The following step requires that a terminal in the folder with the installation files for the Redirector be opened.

Context menu for opening a terminal
In desktop environments the terminal can generally be opened from Explorer by right-clicking on -> Open terminal here directly in the correct path

Installation of the USB Redirector can be performed automatically using the provided script install.sh. During the installation the system requirements are automatically checked.

On systemd based systems the installation script can also add a corresponding service for automatically starting the background service.

Guided installation

The installation procedure can be started with higher permissions using the following command line:

								
sudo ./install.sh
								
							

Then follow the installation instructions. During installation some prompts appear with respect to naming and installation location. Unless there are reasons otherwise, here you can use the Enter key to apply the standard settings (shown in brackets).

Before the changes are actually made, you must again conform your entry with y.

Overview of settings
Overview of the settings before installation is performed

The files are automatically coped to the corresponding locations. The downloaded folder with the installation files can then be deleted.


Manual installation

The USB Redirector can also be installed without the installation script shown above. To do this, first select the correct version for your Linux system:

  • usb-redirector.i686 for 32-bit operating systems
  • usb-redirector.x86_64 for 64-bit operating systems

The file can then be copied to the desired location in the file system. To start the downloaded background service you can either manually or using an existing Init system start the respective file with root permissions and the daemon parameter:

								
sudo usb-redirector daemon
								
							

Integrating devices

Checking status of the Redirector

Using the following command you can first check whether the background service has been correctly started. If yes, there should be an empty table of the currently connected devices in the terminal.

							
usb-redirector status
							
						
List of connected devices
Outputting the status command

Listing devices

If the USB Redirector has been correctly initialized, you can use the list command to query the devices connected to the USB server

							
usb-redirector list 10.40.28.165
							
						

By specifying the corresponding port you can then use the plug command to connect locally:

							
usb-redirector plug 10.40.28.165 2
							
						
Display of USB devices usign Isusb
Successful integration can be checked using the Isusb command

Using devices

After integration the virtual USB device is created on the host just as would be the case for a locally connected USB device.

This makes it possible to use application software as normal. In the example shown above the image from the USB Webcam for example can be displayed in Ubunto using the provided "Cheese" program.

Camera image display
Displaying the connected USB camera in the Cheese application

Try this tutorial with hardware

Would you like to try this tutorial but don’t have the necessary hardware? We will be glad to provide you with a USB Server as a sample.

Any questions about the Linux environment?

Mr. Knabe will be glad to assist you.
Phone: +49 202/2680-110 (Mon.-Fri. 8 a.m. to 5 p.m.)
E-mail: p.knabe@wut.de