Bug 88729

Summary: remote-viewer: Unlock cellphone screen made remote-viewer stuck
Product: Spice Reporter: Dean <dean_yu>
Component: spice-gtkAssignee: Spice Bug List <spice-bugs>
Status: RESOLVED NOTOURBUG QA Contact:
Severity: normal    
Priority: medium CC: dean_yu
Version: unspecified   
Hardware: x86 (IA32)   
OS: Windows (All)   
Whiteboard:
i915 platform: i915 features:

Description Dean 2015-01-23 06:15:07 UTC
I encounter a wierd problem when testing my cell-phone via usb-redirect.

Test environment:
Client OS: win7-32bit
Client: remote-viewer
VM OS:  win7-32bit

Tool-chain:
zadig-2.1 (use libusbk)
usbredir-0.7
spice-gtk-0.27 (use gtk-2.0)
virt-viewer-0.6 (use gtk-2.0)

Test device:
IPhone 5s
Google Nexus 3

Problem:
It seems that almost all USB device can be redirected successfully included cellphone. However, when my IPhone
appeared in the VM OS, I can double click the phone icon, see its storage card. Then, I clicked 'Trust' button on my phone. Then, the whole window of remote-viewer is stuck, and cannot be closed normally( one way to close it is kill the process from task manager).
The same problem can be reproduced on Android phone, take my Nexus 3 as an example. The phone screen is locked with pattern lock before redirect, and unlock it after redirect. Then, remote-viewer is stuck.

Accidentally, I found a way to fix the bug. I add a printf in the beginning of usbredir_handle_msg() function, as below:
static void usbredir_handle_msg(SpiceChannel *c, SpiceMsgIn *in)
{
    SpiceUsbredirChannel *channel = SPICE_USBREDIR_CHANNEL(c);
    SpiceUsbredirChannelPrivate *priv = channel->priv;
    device_error_data data;
    int r, size;
    uint8_t *buf;

    g_return_if_fail(priv->host != NULL);

    /* No recursion allowed! */
    g_return_if_fail(priv->read_buf == NULL);

    buf = spice_msg_in_raw(in, &size);
    priv->read_buf = buf;
    priv->read_buf_size = size;

    printf("msg\n");

    r = usbredirhost_read_guest_data(priv->host);

I don't know why it works. And I try to use sleep(0) to instead, it doesn't work. Then, use sleep(1), it works, but decreased the performance of handling usb message.
Comment 1 Christophe Fergeau 2015-01-23 09:56:32 UTC
Is it an issue similar to http://lists.freedesktop.org/archives/spice-devel/2014-December/018408.html ? According to http://lists.freedesktop.org/archives/spice-devel/2014-December/018430.html this is a libusb bug which is being fixed upstream.
Comment 2 Dean 2015-01-26 01:08:40 UTC
(In reply to Christophe Fergeau from comment #1)
> Is it an issue similar to
> http://lists.freedesktop.org/archives/spice-devel/2014-December/018408.html
> ? According to
> http://lists.freedesktop.org/archives/spice-devel/2014-December/018430.html
> this is a libusb bug which is being fixed upstream.

Yes, they are same. Thanks a lot!
Comment 3 Christophe Fergeau 2015-01-26 10:08:59 UTC
Ok, closing this bug then, thanks for the followup!

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.