Raspberry Pi Setup (USB/IP Server)

 

 just copy and paste in SSH terminal

1.1 Install USB/IP Tools
bash

sudo apt update
sudo apt install usbip

1.2 Load Kernel Modules
bash

sudo modprobe usbip-core
sudo modprobe usbip-host
sudo modprobe vhci-hcd

Make modules load at boot:

bash

echo -e "usbip-core\nusbip-host\nvhci-hcd" | sudo tee /etc/modules-load.d/usbip.conf

1.3 Create USB/IP Daemon Service (Fix for Missing usbipd.service)

Create a systemd service file:

bash

sudo nano /etc/systemd/system/usbipd.service

Paste this configuration:

ini

[Unit]
Description=USB/IP Daemon
After=network.target

[Service]
Type=simple
ExecStart=/usr/sbin/usbipd -D
Restart=always

[Install]
WantedBy=multi-user.target

Reload systemd and start the service:

bash

sudo systemctl daemon-reload
sudo systemctl enable usbipd.service
sudo systemctl start usbipd.service

1.4 Create Auto-Bind udev Rule
bash

sudo nano /etc/udev/rules.d/99-usbip-auto-bind.rules

Add:

bash

ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", RUN+="/usr/local/bin/usbip-auto-bind.sh %k"

1.5 Create Auto-Bind Script
bash

sudo nano /usr/local/bin/usbip-auto-bind.sh

Paste:

bash

#!/bin/bash
BUSID="$1"
# Check if already bound
if ! usbip list -p -l | grep -q "busid=$BUSID"; then
    /usr/sbin/usbip bind -b "$BUSID"
fi

Make executable:

bash

sudo chmod +x /usr/local/bin/usbip-auto-bind.sh

Reload udev rules:

bash

sudo udevadm control --reload

1.6 Bind Existing Devices at Boot

Create a new systemd service:

bash

sudo nano /etc/systemd/system/usbip-bind-all.service

Paste:

ini

[Unit]
Description=Bind all USB devices at boot
After=usbipd.service

[Service]
Type=oneshot
ExecStart=/bin/bash -c "/usr/sbin/usbip list -p -l | cut -d'#' -f1 | cut -d'=' -f2 | xargs -n1 /usr/sbin/usbip bind -b"

[Install]
WantedBy=multi-user.target

Enable the service:

bash

sudo systemctl enable usbip-bind-all.service


download client from this link:
https://github.com/vadimgrn/usbip-win2?tab=readme-ov-file

his revised guide ensures full plug-and-play functionality with auto-binding on both ends.

Comments