[Spice-devel] [PATCH 1/5] UsbDeviceManager add redirecting state

Kirill Moizik kirill at daynix.com
Thu Jul 2 06:41:31 PDT 2015


add redirecting field to UsbDeviceManagerPrivate and expose get/set API

Signed-off-by: Kirill Moizik <kirill at daynix.com>
---
 src/map-file             |  2 ++
 src/usb-device-manager.c | 17 +++++++++++++++++
 src/usb-device-manager.h |  6 ++++++
 3 files changed, 25 insertions(+)

diff --git a/src/map-file b/src/map-file
index d5a073f..d3a079e 100644
--- a/src/map-file
+++ b/src/map-file
@@ -117,6 +117,8 @@ spice_uri_to_string;
 spice_usb_device_get_description;
 spice_usb_device_get_libusb_device;
 spice_usb_device_get_type;
+spice_usb_device_manager_set_redirecting;
+spice_usb_device_manager_get_redirecting;
 spice_usb_device_manager_can_redirect_device;
 spice_usb_device_manager_connect_device_async;
 spice_usb_device_manager_connect_device_finish;
diff --git a/src/usb-device-manager.c b/src/usb-device-manager.c
index 5b8151f..2fde03a 100644
--- a/src/usb-device-manager.c
+++ b/src/usb-device-manager.c
@@ -130,6 +130,7 @@ struct _SpiceUsbDeviceManagerPrivate {
     SpiceWinUsbDriver     *installer;
 #endif
     gboolean               use_usbclerk;
+    gboolean               redirecting;
 #endif
     GPtrArray *devices;
     GPtrArray *channels;
@@ -241,6 +242,7 @@ static void spice_usb_device_manager_init(SpiceUsbDeviceManager *self)
 #ifdef USE_USBREDIR
     priv->devices  = g_ptr_array_new_with_free_func((GDestroyNotify)
                                                     spice_usb_device_unref);
+    priv->redirecting = FALSE;
 #endif
 }
 
@@ -1620,6 +1622,21 @@ void spice_usb_device_manager_disconnect_device(SpiceUsbDeviceManager *self,
 }
 
 gboolean
+spice_usb_device_manager_get_redirecting(SpiceUsbDeviceManager  *self)
+{
+    SpiceUsbDeviceManagerPrivate *priv = self->priv;
+    return  priv->redirecting;
+}
+
+void
+spice_usb_device_manager_set_redirecting(SpiceUsbDeviceManager  *self,
+                                         gboolean         redirecting)
+{
+    SpiceUsbDeviceManagerPrivate *priv = self->priv;
+    priv->redirecting = redirecting;
+}
+
+gboolean
 spice_usb_device_manager_can_redirect_device(SpiceUsbDeviceManager  *self,
                                              SpiceUsbDevice         *device,
                                              GError                **err)
diff --git a/src/usb-device-manager.h b/src/usb-device-manager.h
index 5b4cfbe..dca374d 100644
--- a/src/usb-device-manager.h
+++ b/src/usb-device-manager.h
@@ -116,6 +116,12 @@ gboolean
 spice_usb_device_manager_can_redirect_device(SpiceUsbDeviceManager  *self,
                                              SpiceUsbDevice         *device,
                                              GError                **err);
+gboolean
+spice_usb_device_manager_get_redirecting(SpiceUsbDeviceManager  *self);
+
+void
+spice_usb_device_manager_set_redirecting(SpiceUsbDeviceManager  *self,
+                                         gboolean                redirecting);
 
 G_END_DECLS
 
-- 
2.1.0



More information about the Spice-devel mailing list