Python scripts for automatically mounting every USB device from a raspberry as soon as it is connected
- usbip client installed under windows. Following the instructions from here
- usbip server installed on the raspberry. I used the Raspbery PI OS Lite:
sudo apt install usbipsudo mkdir /usr/share/hwdata/sudo ln -sf /var/lib/usbutils/usb.ids /usr/share/hwdata/sudo nano /etc/modules- Add
usbip-hostto the end of that file
- Add
- Copy the
server/autousbip.pyfile to/homeand runsudo chmod +x /home/autousbip.py. - Copy the
server/autousbip.serviceto/lib/systemd/system. and runsudo chmod 644 /lib/systemd/system/autousbip.service. If you put the python script at a different location edit the .service file and adjust the location accordingly. - Run
sudo systemctl daemon-reload && sudo systemctl enable autousbip.servicethen reboot the raspberry by runningsudo reboot
-
Navigate to the
clientdirectory and runpip install -r requirements.txt -
Copy the
client.pyand thesystray-logo.pngfile to a permanent location on your PC for exampleD:\tools\auto-usbip -
It is probably convenient to create a
launch.batfile or similar with all the IP addresses predefined so that running the program is more convenient. For example:CALL python client.py 10.0.0.37 -
Just launch the python program whichever way you prefer. Just note that it does require admin privileges to run