Bug 100149 - error on USB redirect: LIBUSB_ERROR_NOT_FOUND
Summary: error on USB redirect: LIBUSB_ERROR_NOT_FOUND
Alias: None
Product: Spice
Classification: Unclassified
Component: usbredir (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium major
Assignee: Hans de Goede
QA Contact:
Depends on:
Reported: 2017-03-10 14:22 UTC by frankie
Modified: 2018-06-03 10:17 UTC (History)
0 users

See Also:
i915 platform:
i915 features:

domain xml, dmesg , remote viewer debug (3.21 KB, application/x-compressed-tar)
2017-03-10 14:22 UTC, frankie

Description frankie 2017-03-10 14:22:21 UTC
Created attachment 130155 [details]
domain xml, dmesg , remote viewer debug

We are trying to switch a PC classroom in the University to
use virtual PCs with Spice. There is a course that requires
the students work with cell phones.

The USB redirection works for pen drives but it won't recognize
the phones. When I set the device to redirect it won't work
and sometimes it shows this message:

    Could not redirect: Samsung Electronics Co.,
    Ltd Galaxy (MTP): error resetting device :

I see it in the remote-viewer doing File -> USB Device Selection.
Clicking on the "Android Samsung" device. But it won't always show
the error, most of the times it just will flickr a little the device
dialog and then unselect the option.

The server is Ubuntu, I tried 16.10 and 17.04 ( devel ).
It has qemu-kvm 2.6.1 and 2.8.

We tried different guests with Windows7, Windows 10 and Ubuntu.
In Windows we installed latest USB and Samsung Android drivers.
We also tried setting the USB driver in the Virtual Machine to USB 2
or USB 3 with the same results.

We tried virt-viewer 4.0-1 and virt-manager 1.3.2 as clients.

My own phone works, but the ones that use in the course fail. May
be it is an issue with older models. We were carefull about the
client not mounting the device and the phone is in MTP mode. The
phone works with nautilus in the client PC without the remote viewer.

I attach the XML domain definition, a dmesg log from the client and a
debug output from launching remote-viewer with --spice-debug.
Comment 1 Hans de Goede 2017-03-13 09:37:42 UTC

This sounds like the cell-phones disconnect / reconnect when talking to them. You can likely fix this by passing --spice-usbredir-auto-redirect-filter="-1,<vid1>,<pid1>,-1,1|-1,<vid2>,<pid2>,-1,1" to remote-viewer where vid is the usb-vendor-id and pid the usb-product-id of the devices you want to redirect, this will cause remote-viewer to autmatically re-redirect the device to the vm when it re-appears on the bus.

You can add more filter rules using |, you will want to check dmesg on the client machines to see what vid/pid the phones use, note they may use multiple for a single phone, this is typcical for devices which disconnect while being enumerated they often do this to switch vid/pid.

Also see: https://www.mankier.com/1/spice-client


Comment 2 S. Mueller 2018-01-28 22:26:29 UTC

I get a similar error when I try to connect a DIGITECH RP1000 guitar multi-effect device via USB. It shows up in the list of USB devices to be redirected, but when I click the device in the list, it takes a short while and I get the error message 

USB redirection error: Could not redirect DigiTech RP1000: error resetting device: LIBUSB_ERROR_NOT_FOUND

I connect to the virtual machine via

remote-viewer  --spice-usbredir-auto-redirect-filter="-1,1210,0017,-1,1"  qemu:///system 1
(1210 is idVendor,  0017 is idProduct from dmesg output).

remote viewer gives as additional error message in the terminal

(remote-viewer:21510): GSpice-CRITICAL **: spice_gtk_session_request_auto_usbredir: assertion 's->auto_usbredir_reqs > 0' failed

(remote-viewer:21510): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory.
This indicates a bug in someone's code. You must ensure an error is NULL before it's set.
The overwriting error message was: error resetting device: LIBUSB_ERROR_NOT_FOUND
libusb: error [udev_hotplug_event] ignoring udev action bind

If I unplug the device and replug, I get the following debug information:

(remote-viewer:21771): GSpice-DEBUG: usb-device-manager.c:974 device added 1210:0017 (0x5651e69937d0)
[53.340534] [00005511] libusb: debug [linux_get_device_address] getting address for device: 1-3 detached: 0
[53.340547] [00005511] libusb: debug [linux_get_device_address] scan 1-3
[53.340577] [00005511] libusb: debug [linux_get_device_address] bus=1 dev=41
[53.340581] [00005511] libusb: debug [udev_hotplug_event] udev hotplug event. action: bind.
[53.340583] [00005511] libusb: error [udev_hotplug_event] ignoring udev action bind

I managed to connect other USB devices like external dvd-drive or memory sticks.

I am quite new to virtual-manager, remore-viewer and virt-viewer, so I might have missed something. It doesn't seem to me that the device is changing vid/pid, as mentioned in the previous solution suggestion.

I run Debian 4.14.13-1 (2018-01-14).

Any help is highly appreciated!
Comment 3 GitLab Migration User 2018-06-03 10:17:59 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/spice/usbredir/issues/5.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.