Hi Shuah,
On 12/13/19 6:33 AM, Shuah Khan wrote:
Hi Zhai,
On 12/11/19 8:19 PM, Zhai Zhaoxuan wrote:
Hi Shuah,
For me, I want to let the remote control software passing some
virtual device (e.g. ethernet device) to the remote computer.
More specifically, the remote computer is connected to a private
network, and the local computer is connected to the Internet. And the
local can only connect to the remote computer using RDP/SPICE
protocols, some other softwares such as vmware client, or even remote
management cards.
All these protocols or softwares support USB redirection.
Does USB redirection support virtual devices? My understanding
it is usually a physical device connected to the local system.
Yes. At least "spicy" (a SPICE protocol client program) allows users
choose virtual devices in the list.
But "spicy" is unable to reset devices. "spicy" redirection fails with
the error: "Could not redirect [Device Product Name] at 6-2: error
resetting device: LIBUSB_ERROR_NOT_FOUND".
So I can
create a virtual ethernet device with usbip,
How are you creating the virtual device?
usbip creates a virtual device and attach the device to the vhci.
It just like local usbip client connected to a virtual remote system.
And the virtual remote system has a usb ethernet card.
But in my use case, the virtual remote system is emulated by the
user-space program.
let them
Who is them here?
redirect the USB
"them" indicates SPICE/RDP protocols, remote control softwares (e.g
vmware client), and remote management cards, etc.
They are protocols or programs which allows the user passing a local USB
device to the remote system.
Let's call them "AGENT".
ethernet device to the remote computer, and enable NAT forward.
Is this virtual device is exported by USBIP host driver on your local
machine?
Yes, you are correct!
Then I am able to access the private network with local computer.
Currently, I am writing a user-space program. It runs usbip protocol,
and can be connected and attached to the vhci.
Why do you need to write a user-space program and what does it do?
Where does this vhci run? On the local system? I still don't fully
follow the use-case.
The vhci runs on local system.
The user-space program transfers the data from vhci to the network
subsystem. I plans use TAP device to communicate with the network subsystem.
If the USB redirection sucessed, the full chain will be:
remote kernel network subsystem <--> remote USB bus <--> AGENT <-->
local vhci <--> local user-space program <--> local TAP device <-->
local kernel network subsystem
But the USB redirection will always reset the USB device before it
passing the device to the remote computer.
Does USB redirection support virtual devices?
Yes. The virtual devices are USB devices. The remote agents does not
filter out the virtual devices.
And now, this "reset" results the device be disabled and never be
enabled again. So the redirection fails.
In addition to this, I think usbip is a great module to allow the
user emulate some other devices and passing them to the remote
computer easily. For example, the virtual serial port can be emulated
in user-space, and communicate with the remote computer over SPICE.
And then, I can get the console output from the remote computer or
send console command to it.
thanks,
-- Shuah
Thanks,
Zhai Zhaoxuan