Bug 844657 - RFE: add a usbredirclient, to use with a qemu socket chardev in server mode
RFE: add a usbredirclient, to use with a qemu socket chardev in server mode
Status: CLOSED DEFERRED
Product: Fedora
Classification: Fedora
Component: usbredir (Show other bugs)
rawhide
Unspecified Unspecified
unspecified Severity low
: ---
: ---
Assigned To: Hans de Goede
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-07-31 05:54 EDT by Albert Graham
Modified: 2013-12-16 13:32 EST (History)
4 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-12-16 13:32:00 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Albert Graham 2012-07-31 05:54:51 EDT
Description of problem:

USB redirection across the network is a very very usful feature. However, it seems to be limited to Spice based clients because there are no client tools that use the new usbredir package at this time.

As a result of this, usbredir is pretty much limited to Qemu VMs that support this feature.

The usbredir.spec file builds a "usbredir-server" sub-package but does not build a corresponding "usbredir-client" sub-package even though there is a usbredirtestclient included in the upstream package for this purpose.

Making this "usbredir-client" sub-package available will expose useredir ability as "General Purpose USB redirection" tool to a much wider audience for testing and extending its capabilities.

Version-Release number of selected component (if applicable):

usbredir <= 0.4.3-3.fc1x

How reproducible:

Steps to Reproduce:
1. rpmbuild --rebuild usbredir-0.4.3-*.src.rpm 
2. 
3.
  
Actual results:

no usbredir-client package - as expected.

Expected results:

usbredir-client package built

Additional info:

Something along the following lines added to the usbredir.spec file to will produce the usbredir-client package which should then work out of the box.

%package        client
Summary:        Simple USB host TCP client
Group:          System Environment/Daemons
License:        GPLv2+
Requires:       %{name}%{?_isa} = %{version}-%{release}

%description    client
A simple USB host TCP client, using libusbredirparser.

%install
make install DESTDIR=$RPM_BUILD_ROOT
rm $RPM_BUILD_ROOT%{_libdir}/libusbredir*.la

# copy and rename binary 
cp -a usbredirtestclient/.libs/usbredirtestclient $RPM_BUILD_ROOT%{_sbindir}/usbredir-client

%files client
%doc COPYING
%{_sbindir}/usbredir-client
%{_mandir}/man1/*
Comment 1 Albert Graham 2012-07-31 07:02:54 EDT
It appears that the usbredirtestclient is infact a protocol testing client rather than an usbredir client that talks to the usbredir-server in the same package.

So I suppose this bug is more of a feature request than a bug :(
Comment 2 Hans de Goede 2012-07-31 07:22:46 EDT
Hi,

(In reply to comment #1)
> It appears that the usbredirtestclient is infact a protocol testing client
> rather than an usbredir client that talks to the usbredir-server in the same
> package.

Correct.

So if you want to use usbredir without spice atm you can do that like this:

On the machine which has the physica; usb device  you want to share do:
sudo usbredirserver 0c45:63f8

Where 0c45:63f8 is the usb id of the device you want to share.

Then after starting the server, start qemu with the following cmdline options added:
 -readconfig /etc/qemu/ich9-ehci-uhci.cfg \
 -chardev socket,host=localhost,port=4000,id=usbredirchardev1 \
 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,debug=3 \

You can find ich9-ehci-uhci.cfg here:
http://cgit.freedesktop.org/spice/qemu/plain/docs/ich9-ehci-uhci.cfg

Or in Fedora-17, with virt-manager, you can change the USB-controller type to "USB 2" and add a TCP USB redirection device.

Note that qemu supports operating as a TCP-server to, so you could use something like:
 -readconfig /etc/qemu/ich9-ehci-uhci.cfg \
 -chardev socket,server,port=4000,id=usbredirchardev1 \
 -device usb-redir,chardev=usbredirchardev1,id=usbredirdev1,debug=3 \

And then first start qemu and then have a usbredirserver-like usbredirclient application, connect to the qemu process to give a device to qemu, this way you could also disconnect the usbredir-client, and restart it with a different device, etc.

This does require someone writing a usbredirclient application, this should be easy since all the hard stuf is done by using libusbredirhost , if you look at libusbredirserver it is very small, just doing the tcp and driving the libusb select loop.

The easiest way to get a usbredirclient is probably to just modify usbredirserver.c so that when started with an extra cmdline option instead of listening it tries to build a connection to a given hostname:port itself, re-using the select loop, and other stuff from usbredirserver. This is actually a pretty easy project for some one to do, and patches for this are certainly welcome.

Regards,

Hans
Comment 3 Hans de Goede 2012-07-31 07:28:39 EDT
p.s.

Using a socket chardev clearly is an untested code-path in the qemu usbredir code, so if you give this a try and when you've the usbredirclient up and running and things don't work / you hit a wall then, feel free to attach your work in progress here and I'll take a look.
Comment 4 Cole Robinson 2013-12-16 13:32:00 EST
Since this has just sat here for 1.5 years, I moved it to the upstream tracker:

https://bugs.freedesktop.org/show_bug.cgi?id=72766

Note You need to log in before you can comment on or make changes to this bug.