Steam Link

Steam Link

USBIP support on Steam Link
Hello,

after the SDK has been released and now that I've got some free time to spare I played around with the Linux Kernel's USB over IP support and the Windows client. After fiddling out the right combination: It's working.

So far I'm able to redirect USB mass storage stuff, like usb drives, a mouse, a keyboard and an xbox 360 controller. And it's all working. I haven't tested the Steam Controller as forward for it is already builtin.

Now the problem:

The driver on the windows end is not signed. I can sign it and deliver the certificate with it that one would need to install manually in the cert store of Windows to make it all happen. The other option is to turn driver signing off which puts Windows into a so called test mode. And it needs to be done on every single reboot.

Another problem is that the USBIP team is not working on the Windows driver anymore and that the Windows end is dead. As soon as the kernel on the Link reaches a certain version it won't work anymore and I'm not able to patch the driver to make it work.

A different discussion is if you want to use this from the Steam Link to a Linux box. That will work like "forever".

In case someone is interested in this, I'm happy to write a howto.

KR

G.
< >
Showing 1-15 of 38 comments
Screemer May 9, 2017 @ 4:43pm 
i would love to get usbip working on windows. that way we would get a free and working alternative to virtualhere. i really don't get why there is no feedback at all. there a so many people out there who want to get their microphon, headsets, hotas, elite, paddles and other stuff working with steam link and nobody even looked into usbip but us? can't believe that they are willing to pay good money for a not really good client for a open source protocol implementation like virtualhere.

have u done some reading about why the windows client driver isn't developed any longer? the linux part went upstream a long time ago and the windows client driver simply stopped developing in 2011. have u found any reason for this. i read somewhere that the team wasn't able to find someone to sponsor a driversigniture for the team.

maybe it would be possible as a community afford to find somebody to sign the usbip driver for windows 7 and newer. if we couldn't find a sponsor maybe we could start a fundraiser to get the money for a certificate. Even if we wouldn't extant the certificate it should be still working but we wouldn't be able to sign any new versions. But i don't expect that MS is scraping the win10 drivermodel anytime soon.

what do u think about that?

€dit: found the source that said that usbip didn't find a sponsor: http://stackoverflow.com/questions/18837277/using-remote-hosts-usb-port-as-local-usb-linux-and-win

Last edited by Screemer; May 9, 2017 @ 4:44pm
Xjph May 10, 2017 @ 3:44am 
I had no idea a free alternative to VirtualHere even existed. I'd definitely be interested.
Screemer May 10, 2017 @ 7:44am 
virtualhere seems to be a windows driver client for usbip. wouldn't suprise me if they forked the driver of the original project.

i just figuered that the vitualhere client is free for download. Has anybody tried to get usbip working on the steamlink and use the virtualhere client?

or does virtualhere use it's own protocol/encryption?
Last edited by Screemer; May 10, 2017 @ 7:45am
fox8bird May 12, 2017 @ 4:16pm 
you only need to disable the windows driver signing when installing the unsigned driver. It will stay installed once it re-enables the requirement at next boot.
Screemer May 14, 2017 @ 6:51am 
i am going to test that. Grimeton said he'll be compiling usbip for the steam link as soon as he finds time. maybe someone else is interested in this as well. all you need is the steam link sdk and the usbip code that is already in the staging tree of steam links linux port.

https://github.com/ValveSoftware/steamlink-sdk/tree/master/kernel/drivers/staging/usbip
https://github.com/ValveSoftware/steamlink-sdk

sadly i am not very experienced in software development and couldn't debug any of the code if anything goes wrong.

if we could get it working it would be a free alternative to virtualhere.
Desert Hobo Jun 9, 2017 @ 7:51am 
@Grimeton: I'd like to have a how-to. I've been playing with this option sparsely in the last few days (with a new-borned baby, not that easy ;) ), I've got the driver running under Linux for the client. I've also installed the free VirtualHere client. Both are not giving me any thing usable... for now. I'll continue exploring later, but if you could tell me how you did it, that would be quicker.

Now, about the Windows driver's signature, last time it was signed was by the ReactOS team. This could still be a viable option, to explore at a later time.
Screemer Jun 22, 2017 @ 3:19am 
grimton replied once over steamchat but sadly it didn't got back to me ever since. maybe someone else is willing to help.
Last edited by Screemer; Jun 22, 2017 @ 3:19am
BuntStiftLecker Aug 18, 2017 @ 4:25am 
Originally posted by Screemer:
grimton replied once over steamchat but sadly it didn't got back to me ever since. maybe someone else is willing to help.

I will take care of this. Sorry about the delay. I was moving and also have to work right now. Give me some time please.
bommi Aug 18, 2017 @ 10:26am 
Please write that howto :-)
I am using the steam link with my linux desktop.
Screemer Aug 18, 2017 @ 7:53pm 
Originally posted by Grimeton:
Originally posted by Screemer:
grimton replied once over steamchat but sadly it didn't got back to me ever since. maybe someone else is willing to help.

I will take care of this. Sorry about the delay. I was moving and also have to work right now. Give me some time please.
thank you a lot!
BuntStiftLecker Sep 12, 2017 @ 10:55am 
Hi,

ok so here the long awaited how-to...

Before we start a WARNING:

IF YOU BRICK YOUR DEVICE IT IS YOUR AND ONLY YOUR PROBLEM. I WILL NOT TAKE ANY RESPONSIBILITY WHATSOEVER. DO NOT COME WHINING.

DO NOT attempt to change the kernel itself. It is signed and if the kernel is not signed or the signature does not match the box won't boot and it is bricked. So, do not touch the kernel.

Also: You're going to use a lot of software in the process that is written by thousands of people. Make sure you accept and agree to the software’s' licenses BEFORE using it.

This is the first half of the how-to. I will explain how to build the daemon once I recovered that part from the depths of my brain.

First of all, you need a machine running Linux. I setup a virtual machine in Hyper-V using Ubuntu 17.04 Server. I picked server because I don't need the whole UI stuff. If you want a fancy UI pick the Desktop version. Other Linux distributions will work as well as long as they offer the ability to cross compile stuff. I don't describe the basic VM setup here, there are enough how-to and docs on how to install Ubuntu.

BTW: Ubuntu is African for "I cannot install Debian". ;)

So, let's go:

Everything we do, we'll do as ROOT.

Before you end up in the sudo madness (I always wondered who started to misuse such a good command), become root once:

> sudo -i

and then stay root. It is extremely important that you do everything in the same shell, as the environment is set up to point to the SDK's tools and stuff.

Go on: After the system, has been installed, update the packages to the latest versions:

> apt-get update && apt-get dist-upgrade

Then you have to clone the git steamlink-sdk repo:

Go to /usr/src :
> cd /usr/src

and run:
> git clone https://github.com/ValveSoftware/steamlink-sdk.git

This will take a while as it's rather big. It can't hurt to have a look at the repo while it is cloning: https://github.com/ValveSoftware/steamlink-sdk It contains basic information, the license and other stuff. Just have a look...

Then install the "kernel-package" meta package. It pulls in the basic libraries, developement packages and so on that are usually needed to build a debian based kernel-package which is a good start for us.

> apt-get install kernel-package libncurses-dev

Once that's done, you have to setup the environment of the sdk.

Go to /usr/src/steamlink-sdk/
> cd /usr/src/steamlink-sdk/

and source the environment:

> source setenv.sh

Now export a bunch of default kernel parameters:

> export ARCH=arm; export LOCALVERSION="-mrvl"

Go to /usr/src/steamlink-sdk/kernel/ :

> cd /usr/src/steamlink-sdk/kernel/

and configure the kernel for the Steamlink device:

> make bg2cd_penguin_mlc_defconfig

After the congfiguration is done, the hard part begins. Run:

> make menuconfig

When the configuration menu shows up you're able to navigate through the options with the cursor keys. Enter selects and opens a sub menu. Space let's you switch between [ ] off, [ * ] in kernel and [m] build as module.

Go to "Device Drivers" and press enter.
Once in there, go to "Staging drivers". As this is a rather old kernel, the drivers are still part of the staging directory.
Enable the "Staging drivers" sub menu by pressing space. Note that [ ] changes to [ * ].
Now press enter and change into the sub menu.
In there select the following options by pressing space until you have the "M" in front of the option:

--- Staging drivers
<M> USB/IP support
<M> VHCI hcd
<M> Host driver
[ ] Debug messages for USB/IP

Note that the the option is marked with "M" so that it is built as a module.

Now select "Exit" at the bottom until you're asked if you want to save the new configuration. Say "YES". (You can select "Exit" by using the cursor keys left and right.)

After the configuration has been saved and you're back in the shell run:

> make clean && make && make modules

This is going to take a while as the build tree is cleaned, the kernel and the modules are built. We actually don't need the kernel, but as the modules are linked against it, it's not the worst idea to have it in place.

While the kernel is building, prepare your USB drive to get ssh access to the Steam Link. It's explained in the GIT-Repo's README and says:

======= SNIP ======= 8< =================
SSH Access

You may need to enable ssh access to the Steam Link for advanced debugging. You can do this by putting a file called enable_ssh.txt on a USB drive under \steamlink\config\system, inserting it into the Steam Link and power cycle the device.

The root password is steamlink123 and should be changed using the passwd command the first time you log in.

SSH access will remain enabled until a factory reset.
===========>8=========== SNAP ===========

When the kernel and the modules are built, copy the modules over to the Steam Link device. Make sure that there is no error message in the last 10-20 lines. If that's the case then something went wrong.

The modules are located in /usr/src/steamlink-sdk/kernel/drivers/staging/usbip/ and have the extension *.ko

Before we continue here: You can use the VMs ssh utils to connect to the steam link, but it might be a good idea to use a different windows to connect to the Link. There are several tools that do the trick. I use cygwin on my Windows machine. Other options would be Putty or TeraTerm SSH. Pick your poison.

Logon to the Steam Link via ssh and go to /mnt/config/ and create the subdirectory "modules".

> ssh ip_of_steam_link -l root
> cd /mnt/config
> mkdir modules

I picked /mnt/config because not all locations of the filesystem are writeable. If you think they should be somewhere else, go ahead and pick your path.

Back on the VM change to the usbip module's path from above and copy stuff over to the Steam Link:

> cd /usr/src/steamlink-sdk/kernel/drivers/staging/usbip/
> scp *.ko root@ip_of_your_steamlink_here:/mnt/config/modules/

Then, on the Link again, change to /mnt/config/modules and load the modules:

> cd /mnt/config/modules
> insmod usbip-core.ko
> insmod usbip-host.ko
> insmod vhci-hcd.ko

You should see the modules when running lsmod:

> lsmod
vhci_hcd 15461 0 - Live 0xbf15c000 (C)
usbip_host 14203 0 - Live 0xbf154000 (C)
usbip_core 4694 2 vhci_hcd,usbip_host, Live 0xbf14e000 (C)

And they should be visible in dmesg:

> dmesg
[71216.873266] usbip_core: module is from the staging directory, the quality is unknown, you have been warned.
[71216.874459] usbip_core: USB/IP Core v1.0.0
[71220.822181] usbip_host: module is from the staging directory, the quality is unknown, you have been warned.
[71220.827490] usbcore: registered new interface driver usbip-host
[71220.827503] usbip_host: USB/IP Host Driver v1.0.0
[71224.911809] vhci_hcd: module is from the staging directory, the quality is unknown, you have been warned.
[71224.921673] vhci_hcd vhci_hcd: USB/IP Virtual Host Controller
[71224.921691] vhci_hcd vhci_hcd: new USB bus registered, assigned bus number 2
[71224.926365] usb usb2: New USB device found, idVendor=1d6b, idProduct=0002
[71224.926380] usb usb2: New USB device strings: Mfr=3, Product=2, SerialNumber=1
[71224.926387] usb usb2: Product: USB/IP Virtual Host Controller
[71224.926395] usb usb2: Manufacturer: Linux 3.8.13-mrvl vhci_hcd
[71224.926401] usb usb2: SerialNumber: vhci_hcd
[71224.931523] hub 2-0:1.0: USB hub found
[71224.931552] hub 2-0:1.0: 8 ports detected
[71224.931881] vhci_hcd: USB/IP 'Virtual' Host Controller (VHCI) Driver v1.0.0
[71225.031264] vhci_hcd: changed 0

So if all of this has worked, then you're already half there. Because there is another requirement to make it all happen and those are the userspace binaries. I will post the info here as soon as I remember how I did that.

Cu
Last edited by BuntStiftLecker; Sep 12, 2017 @ 10:59am
Desert Hobo Sep 12, 2017 @ 12:04pm 
Thanks for this first part. :) If I understand correctly, Steam could provide by default the USB/IP support in the Steam Link with an update, so that would save us all this first part to customize the Link, right? In a way, I'm surprise that this is not already there and running since VirtualHere uses the USB/IP modules to work (under Linux at least)... Maybe this could be a "bug" or "feature request"...

I'll wait for the second part of your How-to.
BuntStiftLecker Sep 12, 2017 @ 2:59pm 
Originally posted by Desert Hobo:
Thanks for this first part. :) If I understand correctly, Steam could provide by default the USB/IP support in the Steam Link with an update, so that would save us all this first part to customize the Link, right? In a way, I'm surprise that this is not already there and running since VirtualHere uses the USB/IP modules to work (under Linux at least)... Maybe this could be a "bug" or "feature request"...

I'll wait for the second part of your How-to.

I don't know Virtual Here - To expensive to just try it. But I guess it's just a rebranded USB/IP stack.
BuntStiftLecker Sep 12, 2017 @ 4:06pm 
Originally posted by Desert Hobo:
Thanks for this first part. :) If I understand correctly, Steam could provide by default the USB/IP support in the Steam Link with an update, so that would save us all this first part to customize the Link, right? In a way, I'm surprise that this is not already there and running since VirtualHere uses the USB/IP modules to work (under Linux at least)... Maybe this could be a "bug" or "feature request"...

I'll wait for the second part of your How-to.

Just for fun:

http://i.imgur.com/cL4leLL.png

I made it work today will put the information together the next few days.

If you want to give it a try on your own:

Build sysfsutils, then build the userspace utilites that are part of the kernel's staging tree.
After that copy the libraries, binaries and modules over to the link, load the modules and use the binaries to configure everything.

You can use /mnt/config/overlay/usr/local/[bin,lib] to store the binaries and libraries accross reboots.

After copying the libraries over, run ldconfig -v to link the libraries.

Last edited by BuntStiftLecker; Sep 12, 2017 @ 4:07pm
BuntStiftLecker Oct 31, 2017 @ 9:43am 
Ok,

next step guys:

So, you have done the first part that I wrote about earlier and it all went fine? Fine... Here's the next steps.

As a side note, one can delete /home/steam/bin/powermanager.sh to disable the powermanager that puts the device to sleep every three minutes or so. It helps...

Open a shell on the main system that we use to build everything and go to /usr/src/steamlink-sdk. There run ./setenv.sh and after that, ./setenv_external.sh.

After running both, change to the subdirectory called "external"

> cd external

In there, download the sysfsutils:

> curl -JOL 'https://sourceforge.net/projects/linux-diag/files/sysfsutils/2.1.0/sysfsutils-2.1.0.tar.gz/download'

Once the download is completed, extract the files:

> tar xvfz sysfsutils-2.1.0.tar.gz

Then change to the subdirectory:

> cd sysfsutils-2.1.0

Configure sysfsutils and build them:

> ./configure --host=$SOC_BUILD --enable-static
> steamlink_make

It will take a bit and the sysfs utilities should be built. Now install them:

> steamlink_make_install

They will be put into the steamlink's rootfs

Once that's done, go to the kernel's driver's staging directory and clean/build the userspace utilities of usbip:

> cd /usr/src/steamlink-sdk//kernel/drivers/staging/usbip/userspace
> steamlink_clean
> steamlink_make

Then install them:

> steamlink_make_install

They will go to the steamlink's rootfs too.

Now all you have todo is to copy stuff over to the steamlink:

Go to /usr/src/steamlink-sdk/rootfs/usr/local

> cd /usr/src/steamlink-sdk/rootfs/usr/local/

And now copy stuff over to the steam link:

> tar cv ./bin ./sbin ./lib | ssh root@IP_OF_STEAMLINK_HERE tar xvf - -C /mnt/config/overlay/usr/local/

The above is one line, it works just as it is. When you're asked for your password, enter it and watch the stuff getting copied over.

After stuff was copied over, logon to the steamlink and run:

> ldconfig -v

It takes a bit until all libraries are recognized and linked (symbolic links in the filesystem).

Afterwards you should be able to run one of the usbip commands:

# usbip list -l
usbip: error: failed to open /usr/share/hwdata//usb.ids
Local USB devices
=================
- busid 1-1 (0424:2514)
1-1:1.0 -> hub

- busid 1-1.1 (28de:1142)
1-1.1:1.0 -> usbhid
1-1.1:1.1 -> usbhid
1-1.1:1.2 -> usbhid
1-1.1:1.3 -> usbhid
1-1.1:1.4 -> usbhid

- busid 1-1.3 (05ac:12a8)
1-1.3:1.0 -> unknown

- busid 1-1.4 (8644:8003)
1-1.4:1.0 -> usb-storage

Ignore the error about /usr/share/hwdata//usb.ids. That's just candy that we don't need right now and can be fixed later.

Let me know how it goes, I will write the third part while you read this one.

< >
Showing 1-15 of 38 comments
Per page: 1530 50

Date Posted: Jan 6, 2017 @ 7:57pm
Posts: 38