Testing USB/IP

Rebooted the pi, and then

osmc@mediaplayer:~$ sudo modprobe usbip_host
osmc@mediaplayer:~$ sudo usbipd -D
osmc@mediaplayer:~$ usbip list --local
 - busid 1-1.1 (0424:ec00)
   Standard Microsystems Corp. : SMSC9512/9514 Fast Ethernet Adapter (0424:ec00)

 - busid 1-1.4 (0e8d:1887)
   MediaTek Inc. : unknown product (0e8d:1887)

osmc@mediaplayer:~$ sudo usbip bind --busid=1-1.4
usbip: info: bind device on busid 1-1.4: complete

Then on the Vero 4k (client):

sudo usbip attach --remote=192.168.178.25 --busid=1-1.4

Which gave no onscreen output.

Then

osmc@osmc-vero:~$ lsusb
Bus 003 Device 004: ID 0e8d:1887 MediaTek Inc. 
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 002: ID 2252:1037  
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

We seem to be back in business! Great.

I put a DVD-disk in the DVD-player in the pi (server) and after a couple of seconds ran mount on the Vero (client). Amongst the output I see:

/dev/sr0 on /media/LEWIS_S3D3 type udf (ro,nosuid,nodev,relatime,uid=1000,gid=1000,mode=444,dmode=555,iocharset=utf8,uhelper=udisks)

So, it’s there, it’s mounted!
So, where to “find” it in OSMC, do you suggest?

The TV is currently “booked” :wink: so this is from memory, but it’s something like Videos > Files > Add videos > Filesystem

When doing

Video --> Files

the title of the DVD in the drive showed up! Hurray!

When I selected that, I was presented with AUDIO_TS and VIDEO_TS. I selected the VIDEO_TS and there saw a list of .IFO, and .VOB files. Selecting some of the .VOB files works!
So this proves that the principle is sound and working. Well done! Thank you! :slight_smile:

But: the subtitles (Dutch) didn’t appear when I played one of these .VOB files.
Then I did some random trial and error with the Vero Remote, and selected and tried various routes through the OSMC menu. I found this (to me surprising) possibility: in the main menu I selected Video. Then I was presented with the “Files, Play Lists, Video Add-ons” menu. Then, with “files” highlighted, I pressed the sub-menu (?) button on the remote, and was, on the left of the screen, presented with “play” and “add to favourites”. When I selected play, the DVD was played from the start, sub-titles and all.
:money_mouth_face:
When “Files” is highlighted and I then press OK on the remote, I am presented with the menu with the title of the DVD and the “add video’s” option. If I then press the sub-menu button on the remote the menu on the left of the screen then shows “play” and “add to favourites” and even “Open/Close”. (I daren’t try that one just now, because I am afraid it will upset the whole set-up we’ve achieved.)

So all in all: you’ve helped me getting this to work!

I will test this set-up for a bit (remove the DVD, pop a new one in, turn the Vero off, turn the pi off, try to find out how to switch to playing the DVD locally (on the pi) again and then switch back to playing it remotely again) the next couple of days to see if it works consistently.
I’ll report the results here.

1 Like

I promised to report the results of my tests.
Here you go, testcase 0.
Tested 3 times and all three times stable.

USBIP Server: Pi, wired network, static ip, freshly booted, DVD-player connected to USB-port, no DVD in player, TV-remote
USBIP Client: Vero4k, wifi, no static ip, OSMC-remote.

SSH as user OSMC to both machines.

First: On server:

osmc@mediaplayer:~$ sudo modprobe usbip_host
osmc@mediaplayer:~$ sudo usbipd -D
osmc@mediaplayer:~$ sudo usbip bind --busid=1-1.4
usbip: info: bind device on busid 1-1.4: complete

Then: On client

osmc@osmc-vero:~$ sudo modprobe vhci_hcd
osmc@osmc-vero:~$ usbip list --remote=192.168.178.25
Exportable USB devices
======================
 - 192.168.178.25
      1-1.4: MediaTek Inc. : unknown product (0e8d:1887)
           : /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4
           : (Defined at Interface level) (00/00/00)

osmc@osmc-vero:~$ sudo usbip attach --remote=192.168.178.25 --busid=1-1.4

Insert DVD in DVD-player on host.

On client the main OSMC-menu disappears; new menu is:

Browse Video
Browse Music
Browse Pictures
Browse Files

I press the square back-up arrow on the OSMC remote to get to the main OSMC-menu.
I select Video --> Files.
The title of the DVD is one of the entries there.
I use the remote to highlight the title.
I press the 3-dots and 3 lines button on the remote.
The left menu shows on screen.
I select play.
DVD starts playing, intro, main menu, I can start the main movie. Sub titles are show.

I press the eject button on the DVD player.
Playing stops (duh).
On the client the main menu is shown.
And I put a different DVD in the player.
On the client the menu:

Browse Video
Browse Music
Browse Pictures
Browse Files

is shown again.

I navigate to the main menu, select Video, select Files, hightlight title of the DVD, press the 3-dots-three-lines button on the remote, and select play. The new DVD starts playing.

I now want to play the DVD locally (on the server).

On the client :

sudo usbip detach --port=0

the client shows the the message

unsafe removal of device

On the host the menu

Browse Video
Browse Music
Browse Pictures
Browse Files

appears.

I select Cancel.
I select Video --> Files.

The DVD title is not listed.

On the host:

osmc@mediaplayer:~$ sudo usbip unbind --busid=1-1.4
usbip: info: unbind device on busid 1-1.4: complete

The DVD-player spins up.
The menu

Browse Video
Browse Music
Browse Pictures
Browse Files

appears.

I select cancel; the Files menu is shown; the title of the DVD is listed.
I highlight the title of the DVD.
I press a button which on my TV-remote says return.
Left of the screen the menu appears.
I select play.
The DVD is played locally on the server.

Testcase 1, follow up on testcase 0.

Stopped the DVD, and shut the Vero/client down.

Later started the Vero again and:

osmc@osmc-vero:~$ sudo modprobe vhci_hcd
osmc@osmc-vero:~$ usbip list --remote=192.168.178.25
Exportable USB devices
======================
 - 192.168.178.25
      1-1.4: MediaTek Inc. : unknown product (0e8d:1887)
           : /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4
           : (Defined at Interface level) (00/00/00)

osmc@osmc-vero:~$ sudo usbip attach --remote=192.168.178.25 --busid=1-1.4

On client the main OSMC-menu disappears; new menu is:

Browse Video
Browse Music
Browse Pictures
Browse Files

I press the square back-up arrow on the OSMC remote to get to the main OSMC-menu.
I select Video → Files.
The title of the DVD is one of the entries there.
I use the remote to highlight the title.
I press the 3-dots and 3 lines button on the remote.
The left menu shows on screen.
I select play.

Then stopped play again, and did

sudo usbip detach --port=0

I am presented with Video’s:Files, Add Video’s screen.

Then I redid

sudo usbip attach --remote=192.168.178.25 --busid=1-1.4

The title of the DVD appears.
I press the 3-dots3-lines button.
The left menu appears.
I select play.

Nothing happens.:unamused:

If I do top on the Vero, the CPU appears to run on >100%:

789 osmc      20   0  617752  77508  27736 R 105.3  4.2   7:25.10 kodi.bin   
    7 root      20   0       0      0      0 S   0.3  0.0   0:00.35 rcu_sched

Vero stops responding to the remote.

I have to reboot:

sudo reboot

After the reboot I redo:

osmc@osmc-vero:~$ sudo modprobe vhci_hcd
osmc@osmc-vero:~$ usbip list --remote=192.168.178.25
Exportable USB devices
======================
 - 192.168.178.25
      1-1.4: MediaTek Inc. : unknown product (0e8d:1887)
           : /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4
           : (Defined at Interface level) (00/00/00)

osmc@osmc-vero:~$ sudo usbip attach --remote=192.168.178.25 --busid=1-1.4

Unfortunately, this throw an error:

usbip: error: recv op_common
usbip: error: query

On a different client (running Raspberry Pi Thin Client project) I run

smc@osmc-vero:~$ sudo modprobe vhci_hcd
osmc@osmc-vero:~$ usbip list --remote=192.168.178.25
Exportable USB devices
======================
 - 192.168.178.25
      1-1.4: MediaTek Inc. : unknown product (0e8d:1887)
           : /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4
           : (Defined at Interface level) (00/00/00)

osmc@osmc-vero:~$ sudo usbip attach --remote=192.168.178.25 --busid=1-1.4

Same result:

usbip: error: recv op_common
usbip: error: query

I reboot the server

sudo reboot

On the server:

osmc@mediaplayer:~$ sudo modprobe usbip_host
osmc@mediaplayer:~$ sudo usbipd -D
osmc@mediaplayer:~$ sudo usbip bind --busid=1-1.4
usbip: info: bind device on busid 1-1.4: complete

On the Vero, client:

osmc@osmc-vero:~$ sudo modprobe vhci_hcd
osmc@osmc-vero:~$ usbip list --remote=192.168.178.25
Exportable USB devices
======================
 - 192.168.178.25
      1-1.4: MediaTek Inc. : unknown product (0e8d:1887)
           : /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.4
           : (Defined at Interface level) (00/00/00)

osmc@osmc-vero:~$ sudo usbip attach --remote=192.168.178.25 --busid=1-1.4

Gives:

usbip: error: import device
usbip: error: query

@dillthedog, do you perhaps see a pattern here? :confused:

Thanks for being the guinea pig. :wink:

My guess is that the code probably isn’t as robust as it could be - and you need to be a bit careful how you use it.

Perhaps on shutting down the Vero4K you might need to unbind the device from the host as well. It might also be necessary to stop the usbipd process on the host if it’s not being used.

If all fails, I’m fairly sure a reboot on both devices will do the trick.

Would further testing help?
And is this the right place to report the results?
I take it, it’s not OCMS’s code that’s not as robust as one would like. So, it’s perhaps not helpful to report these things here?

I’d be willing to spend some time on this issue, because in my setup it would be a handy solution for my use case, but I don’t want to bother you guys with useless information.

If you want to use it, you’ll have no option but to be a tester.

After a while using it, you’ll find out what works best, what doesn’t and what can be a bit “temperamental”. Please feel free to share your findings here as a reference for others who might also want to use USB/IP. (It would probably be best to create a new thread for this.)

I’ve found this resource [1].

It suggests removing the usbip-packages and using Linux-tools-generic in stead. The information seems to be recent.

I’d be willing to try this, but would like to know your thoughts on this, @dillthedog: will this package work on OSMC, or is there a reason to stick to the usbip-packages packages for an OSMC system?

[1] How to Setup and Use USB/IP | USB Sharing Project - RidgeRun Developer Connection

That post seems to be a repeat of what you linked to in post #19. My answer in post #20 still applies.

FYI, the post you linked to just seems to be a copy ‘n’ paste from elsewhere - and doesn’t specify which OS or version it applies to. There is no package called linux-tools-generic in Debian, though there is one in Ubuntu. However Ubuntu – Error shows that linux-tools-generic only contains two files:

/usr/share/doc/linux-tools-generic/changelog.gz
/usr/share/doc/linux-tools-generic/copyright

and looking further, the correct name on Ubuntu should be linux-tools-common Ubuntu – Error (which also doesn’t exist on Debian).

My conclusion: stick with the Debian version.

Very helpful, @dillthedog, thanks for your analysis.
The applicability of packages for distro X but not distro Y, is a bit confusing to me.

I’ll keep using the Debian version of usbip.

Indeed. Debian, which OSMC uses, is the operating system on which Ubuntu is based. That is to say, Ubuntu is a derivative of Debian, so there will be differences - and there’s no guarantee that a package from Ubuntu will work on Debian, or vice versa. Just to make things more interesting, there are many derivatives of Ubuntu, such as Linux Mint, which also has a version based on Debian (ie it skips Ubuntu). And there’s at least one derivative of Linux Mint: FerenOS that I know about.

Clear now? :wink:

As the Bard said when he compared OS’s in his epic "The taming of the OS's":

“Clear as morning roses newly washed with dew; clear as the summer’s sun; clear as yonder Venus in her glimmering sphere.”

He never really recovered from that exhausting effort, I don’t think. :slight_smile:

Following up on above test.

I attached a new USB-device to the host-pi: a powered USB-HDD.

I then ran the script to share the devices from the host:

osmc@mediaplayer:~$ sudo modprobe usbip_host
osmc@mediaplayer:~$ sudo usbipd -D
osmc@mediaplayer:~$ usbip list --local
 - busid 1-1.1 (0424:ec00)
   Standard Microsystems Corp. : SMSC9512/9514 Fast Ethernet Adapter (0424:ec00)

 - busid 1-1.2 (174c:55aa)
   ASMedia Technology Inc. : ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge (174c:55aa)

 - busid 1-1.4 (0e8d:1887)
   MediaTek Inc. : unknown product (0e8d:1887)

osmc@mediaplayer:~$ sudo usbip bind --busid=1-1.2
usbip: info: bind device on busid 1-1.2: complete

The USB-Drive shows up as:

- busid 1-1.2 (174c:55aa)
           ASMedia Technology Inc. : ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/s bridge (174c:55aa)

Then on a different pi (so not the Vero4K as above), I ran the client-script:

o smc@osmcboven:~$ sudo modprobe vhci_hcd
osmc@osmcboven:~$ usbip list --remote=192.168.178.25
-bash: usbip: opdracht niet gevonden
osmc@osmcboven:~$ sudo apt install usbip
<<snip… installed usbip…>>
osmc@osmcboven:~$ usbip list --remote=192.168.178.25
Exportable USB devices
======================
- 192.168.178.25
1-1.2: ASMedia Technology Inc. : ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/
: /sys/devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2
: (Defined at Interface level) (00/00/00)

osmc@osmcboven:~$ sudo usbip attach --remote=192.168.178.25 --busid=1-1.2
osmc@osmcboven:~$ sudo usbip port
Imported USB devices
====================
Port 00: <Port in Use> at High Speed(480Mbps)
       ASMedia Technology Inc. : ASM1051E SATA 6Gb/s bridge, ASM1053E SATA 6Gb/s bridge, ASM1153 SATA 3Gb/
       2-1 -> usbip://192.168.178.25:3240/1-1.2
           -> remote bus/dev 001/005

The USB-Drive shows up on the client-pi, in the Files-menu. I browse the USB-HDD from there and play the files that are stored there.

So far, on the host, I had not “bound” the DVD-player on busid 1-1.4. When, nonetheless, I tried sudo usbip attach --remote=192.168.178.25 --busid=1-1.4 on the client, I got:

usbip: error: recv op_common
usbip: error: query

Then on the host I did:

osmc@mediaplayer:~$ sudo usbip bind --busid=1-1.4
usbip: info: bind device on busid 1-1.4: complete

And on the client re-did

sudo usbip attach --remote=192.168.178.25 --busid=1-1.4

The DVD-drive, connected to the host, started spinning up; on the client-pi the title of the DVD showed up in the files menu. Pressing the 3-dots-3-lines button showed the “play” option. Selected that, and, after some 20 seconds of the animated OSMC-logo, the DVD started playing.

:sunny: