USB/IP

From ArmadeusWiki
Jump to: navigation, search

Introduction

Excerpt from USB/IP website: "USB/IP Project aims to develop a general USB device sharing system over IP network. To share USB devices between computers with their full functionality, USB/IP encapsulates "USB I/O messages" into TCP/IP payloads and transmits them between computers."

This page will give you all the informations to configure USB/IP to drive your APF/OPOS module from your Host USB devices.

Installation

  • On your Host:
$ sudo apt-get install usbip
  • On your APF/OPOS, everything should already be present in your rootfs if your use a post November 2017 BSP.

Usage

  • On your Host, load USB/IP driver and launch usbipd daemon:
$ sudo modprobe usbip-host
$ sudo usbipd -D
  • then check which physical devices are attached to your Host and find which one you will share:
$ sudo usbip list -l
 - busid 3-1 (04d8:00df)
   Microchip Technology, Inc. : unknown product (04d8:00df)

 - busid 3-2 (093a:2510)
   Pixart Imaging, Inc. : Optical Mouse (093a:2510)

 - busid 3-3 (1c7a:0603)
   LighTuning Technology Inc. : unknown product (1c7a:0603)

 - busid 3-4 (8087:07dc)
   Intel Corp. : unknown product (8087:07dc)
  • here I will share my USB mouse (3-2):
$ sudo usbip bind --busid 3-2
usbip: info: bind device on busid 3-2: complete
  • On your APF/OPOS load the USB/IP virtual USB Host driver and ask the Host which devices are sharable (192.168.0.100 is the IP address of my Host PC on my local network):
# modprobe vhci-hcd
# usbip list --remote 192.168.0.100
usbip: error: failed to open /usr/share/hwdata//usb.ids
Exportable USB devices
======================
 - 192.168.0.100
        3-2: unknown vendor : unknown product (093a:2510)
           : /sys/devices/pci0000:00/0000:00:14.0/usb3/3-2
           : (Defined at Interface level) (00/00/00)

# usbip attach --remote 192.168.0.100 --busid 3-2
[ 1300.752357] vhci_hcd vhci_hcd: pdev(0) rhport(0) sockfd(3)
[ 1300.757920] vhci_hcd vhci_hcd: devid(196613) speed(1) speed_str(low-speed)
# [ 1301.026487] usb 2-1: new low-speed USB device number 2 using vhci_hcd
[ 1301.306469] usb 2-1: new low-speed USB device number 3 using vhci_hcd
[ 1301.586464] usb 2-1: new low-speed USB device number 4 using vhci_hcd
[ 1301.593011] usb 2-1: SetAddress Request (4) to port 0
[ 1301.670357] input: PIXART USB OPTICAL MOUSE as /devices/platform/vhci_hcd/usb2/2-1/2-1:1.0/0003:093A:2510.0001/input/input1
[ 1301.687570] hid-generic 0003:093A:2510.0001: input: USB HID v1.11 Mouse [PIXART USB OPTICAL MOUSE] on usb-vhci_hcd-1/input0
  • test it ! ;-)

Links