[Spice-devel] [spice-gtk Win32 v5 20/22] usb-device-manager: add 'state' field to SpiceUsbDeviceInfo

Marc-André Lureau marcandre.lureau at gmail.com
Mon Jul 9 10:12:27 PDT 2012


ack

On Mon, Jul 9, 2012 at 2:15 PM, Uri Lublin <uril at redhat.com> wrote:
> To be used on Win32 to ignore extra udev events
> received during driver install/uninstall.
> ---
>  gtk/usb-device-manager.c |   37 +++++++++++++++++++++++++++++++++++++
>  1 files changed, 37 insertions(+), 0 deletions(-)
>
> diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
> index 7733682..306b22b 100644
> --- a/gtk/usb-device-manager.c
> +++ b/gtk/usb-device-manager.c
> @@ -110,6 +110,16 @@ struct _SpiceUsbDeviceManagerPrivate {
>      GPtrArray *channels;
>  };
>
> +enum {
> +    SPICE_USB_DEVICE_STATE_NONE = 0, /* this is also DISCONNECTED */
> +    SPICE_USB_DEVICE_STATE_CONNECTING,
> +    SPICE_USB_DEVICE_STATE_CONNECTED,
> +    SPICE_USB_DEVICE_STATE_DISCONNECTING,
> +    SPICE_USB_DEVICE_STATE_INSTALLING,
> +    SPICE_USB_DEVICE_STATE_UNINSTALLING,
> +    SPICE_USB_DEVICE_STATE_MAX
> +};
> +
>  #ifdef USE_USBREDIR
>
>  typedef struct _SpiceUsbDeviceInfo {
> @@ -117,6 +127,8 @@ typedef struct _SpiceUsbDeviceInfo {
>      guint8  devaddr;
>      guint16 vid;
>      guint16 pid;
> +    guint8  state;
> +    guint8  reserved;
>      gint    ref;
>  } SpiceUsbDeviceInfo;
>
> @@ -136,6 +148,11 @@ static SpiceUsbDeviceInfo *spice_usb_device_new(libusb_device *libdev);
>  static SpiceUsbDevice *spice_usb_device_ref(SpiceUsbDevice *device);
>  static void spice_usb_device_unref(SpiceUsbDevice *device);
>
> +#ifdef G_OS_WIN32
> +static guint8 spice_usb_device_get_state(SpiceUsbDevice *device);
> +static void  spice_usb_device_set_state(SpiceUsbDevice *device, guint8 s);
> +#endif
> +
>  static gboolean spice_usb_device_equal_libdev(SpiceUsbDevice *device,
>                                                libusb_device *libdev);
>  static SpiceUsbDevice *
> @@ -1364,6 +1381,26 @@ guint16 spice_usb_device_get_pid(SpiceUsbDevice *device)
>      return info->pid;
>  }
>
> +#ifdef G_OS_WIN32
> +void spice_usb_device_set_state(SpiceUsbDevice *device, guint8 state)
> +{
> +    SpiceUsbDeviceInfo *info = (SpiceUsbDeviceInfo *)device;
> +
> +    g_return_if_fail(info != NULL);
> +
> +    info->state = state;
> +}
> +
> +guint8 spice_usb_device_get_state(SpiceUsbDevice *device)
> +{
> +    SpiceUsbDeviceInfo *info = (SpiceUsbDeviceInfo *)device;
> +
> +    g_return_val_if_fail(info != NULL, 0);
> +
> +    return info->state;
> +}
> +#endif
> +
>  static SpiceUsbDevice *spice_usb_device_ref(SpiceUsbDevice *device)
>  {
>      SpiceUsbDeviceInfo *info = (SpiceUsbDeviceInfo *)device;
> --
> 1.7.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel



-- 
Marc-André Lureau


More information about the Spice-devel mailing list