Skip to content

Instantly share code, notes, and snippets.

@tobycm
Created September 1, 2024 03:01
Show Gist options
  • Save tobycm/a704090c418145e7e3e12070927870c8 to your computer and use it in GitHub Desktop.
Save tobycm/a704090c418145e7e3e12070927870c8 to your computer and use it in GitHub Desktop.

You should update your apt repos:

sudo apt update
sudo apt upgrade -y
sudo apt autoremove -y

Prerequisites:

sudo apt install linux-tools-$(uname -r) hwdata -y
sudo apt install linux-tools-generic -y

Enable the modules:

On both machines:

sudo modprobe usbip_core

On the client:

sudo modprobe vhci_hcd

On the one you want to share the devices:

sudo modprobe usbip_host

To confirm the modules have loaded:

sudo lsmod | grep usbip

To auto-enable the modules on boot:

echo "usbip_core
usbip_host" | sudo tee /etc/modules

Start daemon on server:

sudo usbipd

List exportable usb devices:

sudo usbip list -l
 - busid 1-3 (13d3:56ff)
   IMC Networks : unknown product (13d3:56ff)

 - busid 3-3 (27c6:5503)
   Shenzhen Goodix Technology Co.,Ltd. : unknown product (27c6:5503)

 - busid 3-4 (0cf3:e300)
   Qualcomm Atheros Communications : QCA61x4 Bluetooth 4.0 (0cf3:e300)

You should note the busid you want to connect down.

Bind it for sharing

sudo usbip bind -b <id>

Replace <id> with the busid you noted down on the last step. For example, 1-3

On client:

sudo usbip attach -r <ip> -b <id>

Replace <ip> with the usb server ip and <id> with the noted busid

Done! Try the data transfer speed. (Spoiler alert: 3mb/s with huge latency and insane low IOPS)

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