diff --git a/assets/notes/notes.md b/assets/notes/notes.md index ef5335f..eb4141a 100644 --- a/assets/notes/notes.md +++ b/assets/notes/notes.md @@ -43,4 +43,58 @@ In summary, the most practical approach is to use USB/IP to make the USB device ### Troubble Shooting -**usbip: error: could not connect to 192.168.1.8:3240: System error** adjust firewall? `vhci_hcd` on client machine? \ No newline at end of file +**usbip: error: could not connect to 192.168.1.8:3240: System error** adjust firewall? `vhci_hcd` on client machine? + +So for the daemon - /etc/systemd/system/usbipd.service +``` +[Unit] +Description=usbip host daemon +After=network-online.target +Wants=network-online.target + +[Service] +Type=simple +Restart=always +ExecStartPre=/usr/sbin/modprobe usbip-core +ExecStartPre=/usr/sbin/modprobe usbip-host +ExecStart=/usr/sbin/usbipd +ExecStopPost=/usr/sbin/rmmod usbip-host +ExecStopPost=/usr/sbin/rmmod usbip-core + +[Install] +WantedBy=multi-user.target +``` + +And the template for the binds - /etc/systemd/system/usbip-bind@.service + +``` +[Unit] +Description=Bind USB device to usbipd +After=network-online.target usbipd.service +Wants=network-online.target usbipd.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/usr/sbin/usbip bind --busid %i +ExecStop=/usr/sbin/usbip unbind --busid %i + +[Install] +WantedBy=multi-user.target +Enable and start the daemon with: + +systemctl enable usbipd +systemctl start usbuipd +Then add binds with: + +systemctl enable usbip-bind@1-1.2.3 +systemctl start usbip-bind@1-1.2.3 +``` +Replace 1-1.2.3 with the bind id of the USB device you want to share. You can use as many of these as devices you want to share and you can then bind and unbind each one individually and have then bind at machine startup (or not). + +Find the bind ids with: + +`usbip list -l` +Note that usbip binds seem to expire if not attached by a remote machine within around 10 mins - not very helpful! + +I haven't yet decided how I'm going to tackle the client attach, possibly not with systemd. It would be really helpful if usbip had a bit more intelligence... \ No newline at end of file