Skip to content

Instantly share code, notes, and snippets.

@arifbalik
Last active September 4, 2023 13:14
Show Gist options
  • Save arifbalik/6f5ef8ee3dbc410491fe2d766337c40f to your computer and use it in GitHub Desktop.
Save arifbalik/6f5ef8ee3dbc410491fe2d766337c40f to your computer and use it in GitHub Desktop.
USB/IP Host Bringup

USB/IP Setup Guide

USB/IP allows you to share USB devices over IP networks, enabling remote access to devices as if they were connected locally. This guide outlines the setup process for both the server and client sides of USB/IP.

Server Setup

Install Linux Tools

To begin, you need to install the necessary Linux tools on your server. Use the following command:

sudo apt-get install linux-tools-generic

Load Kernel Module

Load the USB/IP host kernel module using the following command:

sudo modprobe usbip_host

Add Module Exec to PATH

You should add the module exec path to your system's PATH variable. This step helps your system locate the necessary binaries. Run the following command:

export PATH="/usr/lib/linux-tools/$(uname -r):$PATH"

Please note that the '5.4.0-159-generic' part in the path may be specific to your installation. Adjust it accordingly.

Start USBIP Daemon

Initiate the USB/IP daemon to facilitate device sharing:

sudo usbipd &

Depending on your installation, the path to the daemon may vary.

Bind the USB Device

Bind the USB device you want to share using the following command:

sudo usbip bind -b <device-bus-id>

Replace <device-bus-id> with the actual bus ID of the USB device.

Client Setup

Download Latest Release

Begin by downloading the latest release of the USB/IP Windows client from the repository available at:

https://github.com/vadimgrn/usbip-win2

Enable Windows Test Signing Mode

To allow the installation of unsigned drivers (required for USB/IP), enable Windows Test Signing Mode. Execute the following command in an elevated Command Prompt:

bcdedit.exe /set testsigning on

Reboot your system to apply the changes.

Attach to Remote Device

Attach to the remote USB device using the USB/IP client. Execute the following command:

usbip attach -r <usbip-server-ip> -b <device-bus-id>

Replace <usbip-server-ip> with the IP address of the USB/IP server and <device-bus-id> with the actual bus ID of the USB device.

By following these steps, you can set up USB/IP for sharing USB devices over IP networks. This enables remote access to USB devices as if they were directly connected to your local machine.

@arifbalik
Copy link
Author

arifbalik commented Sep 4, 2023

BUGFIX: usbip: error: failed to open /usr/share/hwdata//usb.ids

On ubuntu usbip throws an error and can't recognize devices because it can not find the description file usb.ids. We can create a link to solve the issue.

mkdir  /usr/share/hwdata//usb.ids
ln -sv  /var/lib/usbutils/usb.ids /usr/share/hwdata//usb.ids

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment