Raspberry Pi Setup (USB/IP Server)
just copy and paste in SSH terminal
1.1 Install USB/IP Tools
sudo apt update sudo apt install usbip
1.2 Load Kernel Modules
sudo modprobe usbip-core sudo modprobe usbip-host sudo modprobe vhci-hcd
Make modules load at boot:
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:
sudo nano /etc/systemd/system/usbipd.service
Paste this configuration:
[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:
sudo systemctl daemon-reload sudo systemctl enable usbipd.service sudo systemctl start usbipd.service
1.4 Create Auto-Bind udev Rule
sudo nano /etc/udev/rules.d/99-usbip-auto-bind.rules
Add:
ACTION=="add", SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", RUN+="/usr/local/bin/usbip-auto-bind.sh %k"
1.5 Create Auto-Bind Script
sudo nano /usr/local/bin/usbip-auto-bind.sh
Paste:
#!/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:
sudo chmod +x /usr/local/bin/usbip-auto-bind.sh
Reload udev rules:
sudo udevadm control --reload
1.6 Bind Existing Devices at Boot
Create a new systemd service:
sudo nano /etc/systemd/system/usbip-bind-all.service
Paste:
[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:
sudo systemctl enable usbip-bind-all.service
download client from this link:
https://github.com/vadimgrn/usbip-win2?tab=readme-ov-file
Comments
Post a Comment