Bug 98449

Summary: Mouse cursor couldn't move when usb device is redirected
Product: Spice Reporter: McHoZhang <vivamcho>
Component: spice-gtkAssignee: Spice Bug List <spice-bugs>
Status: RESOLVED MOVED QA Contact:
Severity: normal    
Priority: medium CC: bugzilla
Version: unspecified   
Hardware: Other   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: the end of spice-debug of spicy.exe
the libvirt.xml of the guest

Description McHoZhang 2016-10-26 03:27:56 UTC
Hello,
   I use MinGW to cross compile spice-gtk on Fedora for Windows, the problem is when I choose the usb device to redict, after the driver being installed on the guest VM , the mouse cursor couldn't move(or sometimes disappear), but it works again as long as I remove the usb device.
   And I want to mention that if I keep moving the mouse cursor from the start when the usb device is redirected, the cursor will remain alive, but if I stop for a few seconds, it can't move anymore. Previously I compiled on Fedora 25(latest version),but
it came out that usb driver not reinstall in local machine, it means that the usb device can't use anymore, then I use Fedora 19 and solve this problem, I believe they install the different MinGW or GTK library.
   I've also tried to compile it with gcc, and run on linux, it seems to work fine, so I don't know if it's the spice-gtk ,usbdk or the mingw problem .

   I use:
   Fedora 19
   mingw32 and mingw64 (respectively for x86 and x64 windows 7)
   gtk+ - 3.12
   spice-gtk 0.31 (actually I've also tried 0.29,0.19)
   usbclerk
   usbdk (1.0.15 and 1.0.6)

   I'm very appreciate if anyone can tell me what I do wrong, or what may cause this problem.
Comment 1 Victor Toso 2016-10-26 11:01:07 UTC
(In reply to McHoZhang from comment #0)
> Hello,
>    I use MinGW to cross compile spice-gtk on Fedora for Windows, the problem
> is when I choose the usb device to redict, after the driver being installed
> on the guest VM , the mouse cursor couldn't move(or sometimes disappear),
> but it works again as long as I remove the usb device.

You could enable debug to see what's going on.

>    And I want to mention that if I keep moving the mouse cursor from the
> start when the usb device is redirected, the cursor will remain alive, but
> if I stop for a few seconds, it can't move anymore. Previously I compiled on
> Fedora 25(latest version),but
> it came out that usb driver not reinstall in local machine, it means that
> the usb device can't use anymore, then I use Fedora 19 and solve this
> problem, I believe they install the different MinGW or GTK library.

Just to be sure, you are using mingw infrastructure to cross-compile spice-gtk itself as mingw-spice-gtk does enable usbredir for windows by default [0]

[0] http://pkgs.fedoraproject.org/cgit/rpms/mingw-spice-gtk.git/tree/mingw-spice-gtk.spec#n107

>    I've also tried to compile it with gcc, and run on linux, it seems to
> work fine, so I don't know if it's the spice-gtk ,usbdk or the mingw problem
>    I use:
>    Fedora 19
>    mingw32 and mingw64 (respectively for x86 and x64 windows 7)
>    gtk+ - 3.12
>    spice-gtk 0.31 (actually I've also tried 0.29,0.19)

usbdk integration with spice-gtk was introduced in 0.32

>    usbclerk
>    usbdk (1.0.15 and 1.0.6)
> 
>    I'm very appreciate if anyone can tell me what I do wrong, or what may
> cause this problem.

1) Use fedora 24 or fedora 25
2) Use spice-gtk with usbdk integration (0.32 or 0.33)
3) If it fails, provide debug from the client as it can hint the issue
Comment 2 McHoZhang 2016-10-27 11:58:30 UTC
Created attachment 127561 [details]
the end of spice-debug of spicy.exe

the libusb debug logs happened when redirecting usb device, then spicy.exe crash and exit when unplug the usb device, as the end of the log describes.
Comment 3 McHoZhang 2016-10-27 11:59:09 UTC
(In reply to Victor Toso from comment #1)
   Thanks for the reply, now I use Fedora 24 and spice-gtk 0.33, but it turn out the same issue. And just to be sure, I still need to install usbclerk,right? I use usbclerk 0.3.3.

   I found that "toggle mouse mode" in Options can't work properly either, the mouse can't click when toggled. And if toggle the mouse mode when redirecting usb device, the mouse cursor can move, but still can't click.

   I enable spice-debug, it repeatedly output lots of libusb debug logs when redirecting usb device, and I provide part of it in the attachment. Then I unplug the usb device , and spicy.exe crash and exit, as the end of the attachment.

   the spice-gtk configure:

      Spice-Gtk 0.33
        ==============
        prefix:                   /usr/i686-w64-mingw32/sys-root/mingw
        c compiler:               i686-w64-mingw32-gcc
        Target:                   Windows

        Gtk:                      3.0
        Coroutine:                winfiber
        PulseAudio:               no
        GStreamer Audio:          yes
        GStreamer Video:          yes
        SASL support:             no
        Smartcard support:        no
        USB redirection support:  yes 
        DBus:                     yes
        WebDAV support:           no
        LZ4 support:              no

        Now type 'make' to build spice-gtk

     configure: WARNING: The avdec_h264 GStreamer element(s) are missing. You should be able to find them in the gstreamer-libav 1.0 package.
     configure: WARNING: The GStreamer video decoder can be built but may not work.
Comment 4 Victor Toso 2016-10-27 12:40:04 UTC
Hi,

(In reply to McHoZhang from comment #3)
> (In reply to Victor Toso from comment #1)
> I still need to install usbclerk,right? I use usbclerk 0.3.3.

Nops. You need to install UsbDk only (in the machine you run spicy.exe, which is the client machine)


> I found that "toggle mouse mode" in Options can't work properly either,
> the mouse can't click when toggled. And if toggle the mouse mode when
> redirecting usb device, the mouse cursor can move, but still can't click.

Right. The toggle mouse mode is there to toggle between server mode and client mode. It should work in server mode.

> 
> I enable spice-debug, it repeatedly output lots of libusb debug logs when
> redirecting usb device, and I provide part of it in the attachment. Then I
> unplug the usb device , and spicy.exe crash and exit, as the end of the
> attachment.
> 
>    the spice-gtk configure:
> 
>       Spice-Gtk 0.33
>         ==============
>         prefix:                   /usr/i686-w64-mingw32/sys-root/mingw
>         c compiler:               i686-w64-mingw32-gcc
>         Target:                   Windows
> 
>         Gtk:                      3.0
>         Coroutine:                winfiber
>         PulseAudio:               no
>         GStreamer Audio:          yes
>         GStreamer Video:          yes

You can disable gstreamer video if you want

>         SASL support:             no
>         Smartcard support:        no
>         USB redirection support:  yes 
>         DBus:                     yes
>         WebDAV support:           no
>         LZ4 support:              no
> 
>         Now type 'make' to build spice-gtk
> 
>      configure: WARNING: The avdec_h264 GStreamer element(s) are missing.
> You should be able to find them in the gstreamer-libav 1.0 package.
>      configure: WARNING: The GStreamer video decoder can be built but may
> not work.

Sorry, there is another nitpic here. You need to cross compile the latest libusb with --enable-usbdk as well, please check [0] for the request to update this in mingw-libusbx

[0] https://bugzilla.redhat.com/show_bug.cgi?id=1388680

So, I'm afraid that you might be seeing a real bug with the mouse while redirecting the usb device but I plan to test it after we update mingw-libusbx and mingw-spice-gtk.

If everthing goes well, next mingw-libusbx will have --enable-usbdk and next mingw-spice-gtk will have --enable-usbredir; the same will apply for the windows version of remote-viewer [1]

[1] https://virt-manager.org/download/

In case you test the latest libusb on windows, let me know if the issue is solved; Also, it might be interesting to share the qemu command line of your guest (or the libvirt xml with virsh dumpxml <domain>)
Comment 5 Victor Toso 2016-10-27 12:43:41 UTC
(In reply to McHoZhang from comment #2)
> Created attachment 127561 [details]
> the end of spice-debug of spicy.exe
> 
> the libusb debug logs happened when redirecting usb device, then spicy.exe
> crash and exit when unplug the usb device, as the end of the log describes.

it does not say much, sadly. a backtrace would be much more useful
Comment 6 McHoZhang 2016-10-31 09:05:08 UTC
(In reply to Victor Toso from comment #5)
Sorry for the late reply, I compile the libusb 1.0.21 with --enable-usbdk , usbredir 0.7.1 and spice-gtk 0.33, it works alright on Linux guest VM, but fails on Windows7 guest VM (I hadn't found out before since I always test on windows). I hope this would be some valuable information,
Comment 7 McHoZhang 2016-10-31 09:11:49 UTC
Created attachment 127638 [details]
the libvirt.xml of the guest

the guest is run on openstack
Comment 8 Victor Toso 2016-10-31 13:24:20 UTC
Hi,

(In reply to McHoZhang from comment #6)
> (In reply to Victor Toso from comment #5)
> Sorry for the late reply, I compile the libusb 1.0.21 with --enable-usbdk ,
> usbredir 0.7.1 and spice-gtk 0.33, it works alright on Linux guest VM

If you are using windows client and it works with linux guest, that's really great.

> but
> fails on Windows7 guest VM (I hadn't found out before since I always test on
> windows). I hope this would be some valuable information,

using windows client and fails with windows 7 as guest. ok.

I'll be trying to reproduce this soon. I've updated the mingw-libusbx to the latest in fedora and I plan to bump mingw-spice-gtk to 0.33 with usbredir enabled.... then I'll try to test this.
Comment 9 Victor Toso 2016-11-07 17:59:38 UTC
Hi,

I've built mingw-libusb 1.0.21 [0] version which integrations nicely with UsbDk; Then I've built mingw-spice-gtk with usbredir [1]; After small updates on msitools (related to gstreamer1 packages) I've created a virt-viewer-5.0 binary for testing (only for *testing*)

It would be *great* to have your input on this as it is the base for the actual release in a few weeks.

[0] http://koji.fedoraproject.org/koji/buildinfo?buildID=813602
[1] http://koji.fedoraproject.org/koji/buildinfo?buildID=812513
[2] https://victortoso.fedorapeople.org/

PS: you can built it yourself if you prefer, using [0] and [1]
Comment 10 Victor Toso 2016-11-15 13:58:16 UTC
I can't reproduce this on Windows 7 x64, using the build from comment #9.
Comment 11 GitLab Migration User 2018-06-03 10:20:19 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/spice-gtk/issues/9.

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.