How To Share USB Devices Over IP Using A Raspberry Pi

  Рет қаралды 17,720

Tech Tutorials - David McKone

Tech Tutorials - David McKone

Күн бұрын

Пікірлер: 60
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 2 жыл бұрын
Raspberry Pi: Switch to root account su - Install software apt install usbip modprobe usbip_host echo 'usbip_host' >> /etc/modules List USB devices and note down the product/vendor usbip list -l Create start script nano /usr/sbin/usbip_start.sh #!/bin/bash usb1='0781:5567' usb2='0658:0200' /usr/sbin/usbip bind --$(/usr/sbin/usbip list -p -l | grep '#usbid='$usb1'#' | cut '-d#' -f1) /usr/sbin/usbip bind --$(/usr/sbin/usbip list -p -l | grep '#usbid='$usb2'#' | cut '-d#' -f1) Make this executable chmod +x /usr/sbin/usbip_start.sh Create stop script nano /usr/sbin/usbip_stop.sh #!/bin/bash usb1='0781:5567' usb2='0658:0200' /usr/sbin/usbip unbind --$(/usr/sbin/usbip list -p -l | grep '#usbid='$usb1'#' | cut '-d#' -f1) /usr/sbin/usbip unbind --$(/usr/sbin/usbip list -p -l | grep '#usbid='$usb2'#' | cut '-d#' -f1) killall usbipd Make this executable chmod +x /usr/sbin/usbip_stop.sh Create service nano /lib/systemd/system/usbipd.service [Unit] Description=usbip host daemon After=network.target [Service] Type=forking ExecStart=/usr/sbin/usbipd -D ExecStartPost=/bin/bash -c '/usr/sbin/usbip_start.sh' ExecStop=/bin/bash -c '/usr/sbin/usbip_stop.sh' [Install] WantedBy=multi-user.target systemctl --system daemon-reload systemctl enable usbipd.service systemctl start usbipd.service Check what USB devices are found usbip list -p -l --- Linux Client Switch to root account su - Check USB device is attached lsusb Install software and create a service apt install usbip hwdata usbutils -y modprobe vhci-hcd echo 'vhci-hcd' >> /etc/modules Create start script nano /usr/sbin/usbip_start.sh #!/bin/bash server1='192.168.200.7' usb1='0781:5567' usb2='0658:0200' /usr/sbin/usbip attach -r $server1 -b $(/usr/sbin/usbip list -r $server1 | grep $usb1 | cut -d: -f1) /usr/sbin/usbip attach -r $server1 -b $(/usr/sbin/usbip list -r $server1 | grep $usb2 | cut -d: -f1) Make this executable chmod +x /usr/sbin/usbip_start.sh Create stop script nano /usr/sbin/usbip_stop.sh #!/bin/bash /usr/sbin/usbip detach --port=$(/usr/sbin/usbip port | grep '' | sed -E 's/^Port ([0-9][0-9]).*/\1/') /usr/sbin/usbip detach --port=$(/usr/sbin/usbip port | grep '' | sed -E 's/^Port ([0-9][0-9]).*/\1/') Make this executable chmod +x /usr/sbin/usbip_stop.sh Create service nano /lib/systemd/system/usbip.service [Unit] Description=usbip client After=network.target [Service] Type=oneshot RemainAfterExit=yes ExecStartPost=/bin/bash -c '/usr/sbin/usbip_start.sh' ExecStop=/bin/bash -c '/usr/sbin/usbip_stop.sh' [Install] WantedBy=multi-user.target systemctl --system daemon-reload systemctl enable usbip.service systemctl start usbip.service Check USB device is attached usbip port lsusb
@peterkleingunnewiek5068
@peterkleingunnewiek5068 Жыл бұрын
thanks David for de Great tutorial. How can I add the USB client to supervised homeassistant? So I can add zwavesticks, memory sticks, RFX com usb devices to my virtual homeassistant machine
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone Жыл бұрын
@@peterkleingunnewiek5068 The supervised install uses Debian so you can add the client software similar to what was done in the video. After you attach a USB device it should then be useable
@peterkleingunnewiek5068
@peterkleingunnewiek5068 Жыл бұрын
@@TechTutorialsDavidMcKone Thanks for you Help, when type "apt install usbip hwdata usbutils " for installing client I get in Homeassistant web terminal "zsh: command not found: apt" or do I have to login into de supervisor docker container and must I then install portainer to do this or is the a more simple way to do that? I am using a vmware ova with supervisor-core and host installed. The Hacs installation did work from within this terminal.
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone Жыл бұрын
@@peterkleingunnewiek5068 You need to be logged into the Debian operating system Once you add the USB devices there, Home Assistant should be able to detect them like any other USB device
@gnulinux-mj
@gnulinux-mj Жыл бұрын
BigTHX for Information. Very good guidance !!!👌
@davidbarker-tf2vo
@davidbarker-tf2vo Жыл бұрын
I needed a long USB cable for my project and I found it here. Arduino Mega Raspberry Pi Ubuntu. Thank you David.
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone Жыл бұрын
Thanks for the suggestion
@davidbarker-tf2vo
@davidbarker-tf2vo Жыл бұрын
Thanks!
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone Жыл бұрын
Many thanks, much appreciated
@beadon1
@beadon1 Жыл бұрын
Very useful for connecting USB devices on one machine from another. However, this solution is a little finnicky when the USB devices suddenly disconnect. (someone unplugs from the other side). Or, if the USB device operates in 2 different modes -- as often occurs with embedded systems which is seen by the linux system as a new USB device entirely. Devices like TI , or Nordic chipsets flip between "normal" (debug) and "device firmware update" mode.
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone Жыл бұрын
Yeah, I find it works great for single use over distance, but as you say an interruption breaks things and requires manual intervention The code for this was written a long long time ago but it still works and it does the job I've been finding it very useful for a VM as it allows me to migrate it between nodes during patching without any downtime
@beadon1
@beadon1 Жыл бұрын
@@TechTutorialsDavidMcKone - If USBIP supported sending an entire "hub" to a remote machine, then unplug/replug and devices switching behaviors while still connected should be a seamless experience. Do you know of a way to export 1 whole hub (and all peripherals then would be shared automatically )
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone Жыл бұрын
@@beadon1Nothing I've really looked into. I just wanted to separate USB devices from Proxmox VE and so USB over IP setup has been working fine
@vikasgeu
@vikasgeu 3 ай бұрын
can you please tell me how to connect the devices in ARM based server and WSL as a client.
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 3 ай бұрын
Unfortunately I don't use Windows or WSL so I don't know I suggest searching Google as I tried myself but I don't know if what I found would be relevant E.g. I came across this github.com/vadimgrn/usbip-win2
@absak
@absak Жыл бұрын
hey, i am running this in a proxmox LXC container but i cannot get it to make these command work : modprobe vhci-hcd echo 'vhci-hcd' >> /etc/modules i'm guessing these need to be runned at the host shell right ? because when i try to run them in the container it says : modprobe: FATAL: Module vhci-hcd not found in directory /lib/modules/5.15.102-1-pve and when i try to start the service none the less it says Job for usbip.service failed because the control process exited with error code. and the error code is Mar 26 19:43:39 octoprint-debian systemd[1]: Starting usbip client... Mar 26 19:43:39 octoprint-debian bash[15069]: usbip: error: import device Mar 26 19:43:39 octoprint-debian bash[15074]: usbip: error: import device Mar 26 19:43:39 octoprint-debian systemd[1]: usbip.service: Control process exited, code=exited, status=1/FAILURE Mar 26 19:43:39 octoprint-debian systemd[1]: usbip.service: Failed with result 'exit-code'. Mar 26 19:43:39 octoprint-debian systemd[1]: Failed to start usbip client.
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone Жыл бұрын
Containers and VMs for that matter are limited in what they can do in all sorts of ways If you want to share hardware for instance you have to add it at the host level and then make it available to a container
@absak
@absak Жыл бұрын
@@TechTutorialsDavidMcKoneoh I see, I've been trying to get it to work all day, I'll have a try with that approach when I'll have time, otherwise I'll just use a lan USB extender, but I'd like to get it to work myself... And thanks for the quick update !
@streamx2
@streamx2 2 жыл бұрын
I want to share a usb containing some pictures, where would i access those pictures from on the clinet machine ( ubuntu)?
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 2 жыл бұрын
As long as the USB flash drive shows up on the client you should be able to mount it You can check if it's detected by Linux by running the following command from a terminal session lsusb
@nxtphone4696
@nxtphone4696 Жыл бұрын
thank you for the tutorial. i installed usbip but wasn't able to load the modules. getting "modprobe:FATAL Module usbip_host not found in directory /lib/modules/6.1.19-v8+. however the modules are located in /lib/modules/6.1.19-v8+/kernel/drivers/usb/usbip/ compressed as *.ko.xz
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone Жыл бұрын
Are you logged in as root or are you using sudo to execute commands? And is the Ubuntu OS up to date Because it worked fine for me on the latest version while logged in as root
@nxtphone4696
@nxtphone4696 Жыл бұрын
@@TechTutorialsDavidMcKone thanks for your suggestions. my raspberry just needed a reboot for some reason but ok. setting up the host and binding my usb-sata docking station worked well just with sudo. not sure the windows client connected succesfully to the adapter but i think it did. unfortunately no HDD drives showed up though.
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone Жыл бұрын
@@nxtphone4696 Good to know things worked I haven't tried hard drives, more flash drives as well as USB Z-Wave and Zigbee controllers for Home Assistant
@Antonis24
@Antonis24 29 күн бұрын
FYI if you are sharing an Android phone over IP/USB in Linux, enabling USB debugging on the phone will make the client unable to see the connected USB device.
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 29 күн бұрын
I've never tried that, thanks for sharing
@elwinbeekman8531
@elwinbeekman8531 Жыл бұрын
i have 2 usb's with same vendor id, do you have a fix for it ? thanks for the video!
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone Жыл бұрын
I'm assuming you have two copies of the same device? So the vendor id AND product id are the same Not something I've run into as each device on the Pi is different But it would require some way of changing the product id I did a search on Google myself and didn't find anything particularly useful
@elwinbeekman8531
@elwinbeekman8531 Жыл бұрын
@@TechTutorialsDavidMcKone Hi, thanks for you respone. nah 1 for the evohome ramses, the other is for DSMR (Dutch energy p1 monitor) but same vendor and id. but I did find a workaround. hope it will work.
@beadon1
@beadon1 Жыл бұрын
@@elwinbeekman8531 many time it's possible to flash a new serial number to a USB device like this. However, your mileage may vary ..
@davidk.3450
@davidk.3450 11 ай бұрын
What would be the minimum hardware (server) that one could imagine to transport exactly 1x USB into the network? Because I only need computing power on the client. In an ideal World even with POE ;)
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 11 ай бұрын
Not sure what else there is other than a Raspberry Pi or similar as you need something to run Linux But you can get a POE HAT for a Pi if it helps
@davidk.3450
@davidk.3450 8 ай бұрын
@@TechTutorialsDavidMcKone For Sure I allready have such. But my PI3 (Pi1+2 do not have PoE Headders) is ideling with 3-5% CPU load for this task. On the other hand the FAN for cooling PoE is runng most of the time. (Btw. PoE for Pi5 is a technical desaster as known). So the intention was to hear about something that I had not on my screen. ;)
@fabriziodutto7508
@fabriziodutto7508 2 ай бұрын
Great video, with this method it is possible also to share an USB pendrive using a male to male USB cable? Or it is valid only for PC to PC? I mean, I would like to provide firmware update to remote devices that relies on the firmware to be inside an USB pendrive. I know there are wifi SD cards that can be used for this purpose with an USB adapter, but I want a solution based on a raspberry PI as a project and to ensure further security. Is it possible by using your solution and a male to male USB cable? Thanks
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 2 ай бұрын
Hmm, I've used it for access to files on a USB drive and didn't have issue I just plugged the USB drive into the Pi, then shared it over the LAN and the client treated it as if it were plugged directly in The only thing is the endpoint device needs to run the USBIP client software E.g. traditionally you update a BIOS by pulling a file from an attached USB drive The BIOS has no access to networking, let alone USBIP, so it can't connect to the Pi So I guess it depends on the device you want to update
@bahadirm
@bahadirm 2 жыл бұрын
How do I share USB Devices between Windows systems over IP? Currently I'm using RDP+RemoteFX, but the USB device will obviously be disconnected if I disconnect from the RDP session.
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 2 жыл бұрын
Other than Windows projects that were abandoned a long time ago and so probably unsafe, I only came across commercial options for Windows clients like Flexihub Another option I suppose might be Windows Subsystem for Linux But that's why the video only covers Linux
@eadweard.
@eadweard. Жыл бұрын
There's dorssel/usbipd-win
@melissa6793
@melissa6793 2 жыл бұрын
it would be very helpful to put the commands you copy and paste in the description. I tried it but keep getting tcp connect errors. usbip: error: tcp connect Both devices, the Pi and the VM are are on the same subnet
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 2 жыл бұрын
Check the pinned comment as that contains the details The description doesn't accept some characters
@E3SniperspreeE3
@E3SniperspreeE3 2 жыл бұрын
I tried to send a usb3.0 capture card over ip. And I could not get it to work. No card worked. Do you think it could be a driver issue? All other usb devices worked.
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 2 жыл бұрын
Unfortunately I don't have one to test myself but it could be a driver problem
@E3SniperspreeE3
@E3SniperspreeE3 2 жыл бұрын
@@TechTutorialsDavidMcKone Would you consider adding It to the list of video ideas? I have tried an elgato, but that is very windows dependent. The one I recommend is the Evga XLR lite. It has linux support. Impressive specs for $50 with passthrough. This will work wonderfully for sending video over the network to a streaming pc/server. Ndi is too much cpu for older machines.
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 2 жыл бұрын
Does it work if you plug it directly into the computer rather than connecting over the network?
@E3SniperspreeE3
@E3SniperspreeE3 2 жыл бұрын
@@TechTutorialsDavidMcKone yes. And with an over a 30ft usb extender (active). The ability for other computers to pick up the signal is lost with the direct plug in approach.
@lakshyagupta7089
@lakshyagupta7089 Ай бұрын
Is this works for macOS also??
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone Ай бұрын
It's Linux based I'm not aware of a client for macOS
@lakshyagupta7089
@lakshyagupta7089 Ай бұрын
@@TechTutorialsDavidMcKone thanks for replying David
@cdxer
@cdxer 9 ай бұрын
this video needs an update as "apt install usbip" won't work anymore. the package is not found
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 9 ай бұрын
What OS are you using as it still works for Debian 12?
@EdwinFairchild
@EdwinFairchild 4 ай бұрын
@@TechTutorialsDavidMcKone yeah im on ubuntu latest and doesnt work , neither does ubuntu 22 , however it seems to already be on the machine from the start
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 4 ай бұрын
​@@EdwinFairchild It looks like the package has changed, at least for Ubuntu; linux-tools-generic It's still the same for Debian 12, so presumably Canonical made a change Unfortunately I don't use Ubuntu anymore so I'm not sure if the package will require different commands on Ubuntu
@EdwinFairchild
@EdwinFairchild 4 ай бұрын
@@TechTutorialsDavidMcKone thanks I got it all working, it amazes me how easy and powerful this is. I am making a Hub of stm32 dev boards to all be remotely programmed and debugged on my desktop
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone 4 ай бұрын
@@EdwinFairchild Good to know it's working It is very useful, but I hadn't considered stm32
@xgrapher
@xgrapher Жыл бұрын
how to share over the internet, i can't find a single video, all are for local networks
@TechTutorialsDavidMcKone
@TechTutorialsDavidMcKone Жыл бұрын
It's usually not a good idea to expose things directly to the Internet If you need to access something over the Internet, the better security practice is to setup a VPN tunnel and access any devices through that Another concern though might be the extra delay due to the distance apart
@xgrapher
@xgrapher Жыл бұрын
@@TechTutorialsDavidMcKone I want to expose, don't worry about it, do you know how to do it, not by VPN or tunnel, then I can simply use TeamViewer. I want USB access over the internet period
How To Share USB Devices Over Network with Raspberry Pi
10:01
Novaspirit Tech
Рет қаралды 104 М.
人是不能做到吗?#火影忍者 #家人  #佐助
00:20
火影忍者一家
Рет қаралды 20 МЛН
USB over IP
8:48
Tall Paul Tech
Рет қаралды 42 М.
Control ANY COMPUTER with these Pi KVMs!
17:46
Jeff Geerling
Рет қаралды 848 М.
How Linux Networking Work ?!
6:17
Mohido
Рет қаралды 4,9 М.
You're running Pi-Hole wrong! Setting up your own Recursive DNS Server!
18:02
How to Block Ads Using a Pi-Hole With A Raspberry Pi
10:10
Micro Center
Рет қаралды 15 М.
КАК НАЧАТЬ ПОНИМАТЬ LINUX (2024)
21:10
PLAFON - Канал о линуксе
Рет қаралды 244 М.
It’s Been a Good Run, Phone Providers (Part 2)
15:51
Data Slayer
Рет қаралды 2 МЛН
Digi AnywhereUSB/14 Reliably Attach USB to any VM - 716
24:40
My PlayHouse (Morten Hjorth)
Рет қаралды 31 М.
You want a real Name Server at home? // DNS
32:31
Christian Lempa
Рет қаралды 287 М.