[Spice-devel] About spice usb redirection

coolper chen lixin.chen at saicocch.com
Wed Sep 28 18:26:04 PDT 2011


hi,
I'm testing spice usb redirection,it works great,and it's better than
usbip, thanks.
I got 1 bug about spice-gtk,if I compile spice-gtk with
--disable-smartcard,usb redir will cause segment fault;the bug is here:
generated_demarshallers.c:

spice_parse_channel_func_t spice_get_server_channel_parser(uint32_t
channel, unsigned int *max_message_type)
{
    static struct {spice_parse_channel_func_t func; unsigned int
max_messages; } channels[10] =  {
        { NULL, 0 },
        { parse_MainChannel_msg, 111},
        { parse_DisplayChannel_msg, 315},
        { parse_InputsChannel_msg, 111},
        { parse_CursorChannel_msg, 108},
        { parse_PlaybackChannel_msg, 106},
        { parse_RecordChannel_msg, 104},
        { parse_TunnelChannel_msg, 108},
#ifdef USE_SMARTCARD
        { parse_SmartcardChannel_msg, 101},
#endif /* USE_SMARTCARD */
        { parse_UsbredirChannel_msg, 101}
    };
    if (channel < 10) {
        if (max_message_type != NULL) {
            *max_message_type = channels[channel].max_messages;
        }
        return channels[channel].func;
    }
    return NULL;
}
when not define USE_SMARTCARD,the cannels[10] array is wrong about
usbredir channel, it may fix with:
#ifdef USE_SMARTCARD
        { parse_SmartcardChannel_msg, 101},
#else
        {NULL, 0},
#endif /* USE_SMARTCARD */

I got 1 bug about usbredir lib when I test a usb device which has two
functions(headphone and microphone);the bug is here:
usbredirhost.c:
static int usbredirhost_cancel_iso_stream(struct usbredirhost *host,

    uint8_t ep, int do_free)
{
    LOCK(host);
    return usbredirhost_cancel_iso_stream(host, ep, do_free);
    UNLOCK(host);
}
the function is infinite recursive call;I guess it call the wrong function, so I changed to:
static int usbredirhost_cancel_iso_stream(struct usbredirhost *host, 
uint8_t ep, int do_free)
{
    LOCK(host);
    return usbredirhost_cancel_iso_stream_unlocked(host, ep, do_free);
    UNLOCK(host);
}
Then,it works perfect.


Coolper Chen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20110929/1a4aaca0/attachment.html>


More information about the Spice-devel mailing list