USB over IP, extend the network, Wifi – to use Arduino over Raspberry Pi as gateway

USB over IP – First contact point:

Actions on the server side – Raspberry Pi

USB over IP is to be available on the Raspberry Pi from kernel Linux 3.17 without further installation.

Check what kernel I have:

17:45:46|pi@raspberrypi:~|$ uname -r
4.1.13+

Kernel version is higher :-)
Test:

17:49:05|pi@raspberrypi:~|$ usbip
-bash: usbip: Command not found.

That’s not much good. :-(

Continue with the tips from the forum: https://www.raspberrypi.org/forums/viewtopic.php?p=121691

install usbip

17:49:25|pi@raspberrypi:~|$ sudo apt-get install usbip

loading the Kernel module

17:54:16|pi@raspberrypi:~|$ sudo modprobe usbip-host

Starting the usbip daemon

08:52:50|pi@raspberrypi:~|$ sudo usbipd -D

listing USB devices (without Arduino)

18:01:48|pi@raspberrypi:~|$ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp.

and listing USB devices (with Arduino plugged in)

18:02:30|pi@raspberrypi:~|$ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

In my case is the ID of the USB device: 1a86:7523
The same again with the program usbip

18:05:21|pi@raspberrypi:~|$ sudo usbip list -l
Local USB devices
=================
 - busid 1-1 (0424:9512)
         1-1:1.0 -> hub
 
 - busid 1-1.1 (0424:ec00)
         1-1.1:1.0 -> smsc95xx
 
 - busid 1-1.2 (1a86:7523)
         1-1.2:1.0 -> ch341

Binding of the USB device

09:22:48|pi@raspberrypi:~/deb_pakete|$ sudo usbip bind -b 1-1.2
bind device on busid 1-1.2: complete

Actions on the client side – in my case a laptop with Ubuntu

download and install of the matching usbip version

10:04:25|henry@t410:~/deb_pakete|$ wget http://ftp.de.debian.org/debian/pool/main/l/linux-tools/usbip_1.1.1+3.2.17-1_amd64.deb
--2016-02-13 10:05:51--  http://ftp.de.debian.org/debian/pool/main/l/linux-tools/usbip_1.1.1+3.2.17-1_amd64.deb
Auflösen des Hostnamen »ftp.de.debian.org (ftp.de.debian.org)«... 141.76.2.4
Verbindungsaufbau zu ftp.de.debian.org (ftp.de.debian.org)|141.76.2.4|:80... verbunden.
HTTP-Anforderung gesendet, warte auf Antwort... 200 OK
Länge: 52602 (51K) [application/x-debian-package]
In »»usbip_1.1.1+3.2.17-1_amd64.deb«« speichern.
 
100%[=====================================>] 52.602      --.-K/s   in 0,08s   
 
2016-02-13 10:05:51 (628 KB/s) - »»usbip_1.1.1+3.2.17-1_amd64.deb«« gespeichert [52602/52602]
 
10:05:51|henry@t410:~/deb_pakete|$ sudo dpkg -i usbip_1.1.1+3.2.17-1_amd64.deb Vormals nicht ausgewähltes Paket usbip wird gewählt.
(Lese Datenbank ... 588070 Dateien und Verzeichnisse sind derzeit installiert.)
Vorbereitung zum Entpacken von usbip_1.1.1+3.2.17-1_amd64.deb ...
Entpacken von usbip (1.1.1+3.2.17-1) ...
usbip (1.1.1+3.2.17-1) wird eingerichtet ...
Trigger für man-db (2.6.7.1-1ubuntu1) werden verarbeitet ...

loading Kernel module

10:06:22|henry@t410:~/deb_pakete|$ sudo modprobe vhci-hcd
10:08:30|henry@t410:~/deb_pakete|$ lsmod | grep vhci
vhci_hcd               33435  0 
usbip_core             27617  1 vhci_hcd

Listing the USB devices that are provided on the PI

10:11:10|henry@t410:~/deb_pakete|$ sudo usbip list -r 192.xxx.xxx.xxx
Exportable USB devices
======================
 - 192.xxx.xxx.xxx
      1-1.2: QinHeng Electronics : HL-340 USB-Serial adapter (1a86:7523)
           : /sys/devices/platform/bcm2708_usb/usb1/1-1/1-1.2
           : Vendor Specific Class / unknown subclass / unknown protocol (ff/00/00)
           :  0 - Vendor Specific Class / unknown subclass / unknown protocol (ff/01/02)

adding the USB Device

10:24:20|henry@t410:~/deb_pakete|$ sudo usbip attach -h 192.xxx.xxx.xxx -b 1-1.2
10:24:45|henry@t410:~/deb_pakete|$ lsusb
Bus 003 Device 002: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter

Check with the Arduino IDE

USB over IP Arduiono Remote programmiert über IP

Actions on the server side – Raspberry Pi

After using on the server side – releasing the USB device

09:22:54|pi@raspberrypi:~/deb_pakete|$ sudo usbip unbind -b 1-1.2
unbind device on busid 1-1.2: complete
USB over IP, extend the network, Wifi – to use Arduino over Raspberry Pi as gateway was last modified: March 2nd, 2017 by Henry Koch

Leave a Reply

Your email address will not be published.