[Spice-devel] [spice-gtk Win32 v4 02/17] Introduce SpiceUsbDeviceInfo to be kept instead of a libusb_device

Hans de Goede hdegoede at redhat.com
Thu Jul 5 23:26:29 PDT 2012


Hi,

On 07/05/2012 10:43 PM, Uri Lublin wrote:
> For Windows, it's better not to keep references for libusb_devices
> that are not used.
> So instead of makeing SpiceUsbDevice a box for a libusb_device
> it is going to be a box for a SpiceUsbDeviceInfo.
> ---
>   gtk/usb-device-manager.c |  145 ++++++++++++++++++++++++++++++++++++++++++++++
>   1 files changed, 145 insertions(+), 0 deletions(-)
>
> diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
> index b39c2d4..c4cbc20 100644
> --- a/gtk/usb-device-manager.c
> +++ b/gtk/usb-device-manager.c
> @@ -101,6 +101,16 @@ struct _SpiceUsbDeviceManagerPrivate {
>       GPtrArray *channels;
>   };
>
> +typedef struct _SpiceUsbDeviceInfo {
> +#ifdef USE_USBREDIR
> +    guint8  busnum;
> +    guint8  devaddr;
> +    guint16 vid;
> +    guint16 pid;
> +    int     ref;
> +#endif
> +} SpiceUsbDeviceInfo;
> +
>   #ifdef USE_USBREDIR
>   static void channel_new(SpiceSession *session, SpiceChannel *channel,
>                           gpointer user_data);

Many compilers barf on empty structs, at a minimum you need to put an "int dummy;" in there.

+What Marc-André said :)


More information about the Spice-devel mailing list