[Spice-commits] gtk/map-file gtk/spice-glib-sym-file gtk/usb-device-manager.c gtk/usb-device-manager.h
Fabiano FidĂȘncio
fidencio at kemper.freedesktop.org
Wed Nov 19 06:26:28 PST 2014
gtk/map-file | 1 +
gtk/spice-glib-sym-file | 1 +
gtk/usb-device-manager.c | 24 ++++++++++++++++++++++++
gtk/usb-device-manager.h | 1 +
4 files changed, 27 insertions(+)
New commits:
commit d53b8bc63cc2b92a69ab40f0bf149ac3470aa42f
Author: Fabiano FidĂȘncio <fidencio at redhat.com>
Date: Mon Nov 10 14:42:00 2014 +0100
usb-device: Expose libusb device
As we only can filter USB devices by their Classes and sometimes it is
not enough (eg: I do not want to have Keyboard and Mouse, but I want to
have Joysticks, being all of them part of HID Class), let's expose the
libusb device associated to the SpiceUsbDevice, so the applications can
have access to whatever information they need, directly from the libusb
device, to refine their filters.
diff --git a/gtk/map-file b/gtk/map-file
index 9f8d04e..3e9624f 100644
--- a/gtk/map-file
+++ b/gtk/map-file
@@ -114,6 +114,7 @@ spice_uri_set_scheme;
spice_uri_set_user;
spice_uri_to_string;
spice_usb_device_get_description;
+spice_usb_device_get_libusb_device;
spice_usb_device_get_type;
spice_usb_device_manager_can_redirect_device;
spice_usb_device_manager_connect_device_async;
diff --git a/gtk/spice-glib-sym-file b/gtk/spice-glib-sym-file
index 2189fa5..6ea8aeb 100644
--- a/gtk/spice-glib-sym-file
+++ b/gtk/spice-glib-sym-file
@@ -91,6 +91,7 @@ spice_uri_set_scheme
spice_uri_set_user
spice_uri_to_string
spice_usb_device_get_description
+spice_usb_device_get_libusb_device
spice_usb_device_get_type
spice_usb_device_manager_can_redirect_device
spice_usb_device_manager_connect_device_async
diff --git a/gtk/usb-device-manager.c b/gtk/usb-device-manager.c
index 5013b6c..9abcd8c 100644
--- a/gtk/usb-device-manager.c
+++ b/gtk/usb-device-manager.c
@@ -706,6 +706,30 @@ static gboolean spice_usb_device_manager_get_device_descriptor(
return TRUE;
}
+
+/**
+ * spice_usb_device_get_libusb_device:
+ * @device: #SpiceUsbDevice to get the descriptor information of
+ *
+ * Returns: (transfer none): the %libusb_device associated to %SpiceUsbDevice.
+ *
+ * Since: 0.27
+ **/
+gconstpointer
+spice_usb_device_get_libusb_device(const SpiceUsbDevice *device G_GNUC_UNUSED)
+{
+#ifdef USE_USBREDIR
+#ifndef G_OS_WIN32
+ const SpiceUsbDeviceInfo *info = (const SpiceUsbDeviceInfo *)device;
+
+ g_return_val_if_fail(info != NULL, FALSE);
+
+ return info->libdev;
+#endif
+#endif
+ return NULL;
+}
+
static gboolean spice_usb_device_manager_get_libdev_vid_pid(
libusb_device *libdev, int *vid, int *pid)
{
diff --git a/gtk/usb-device-manager.h b/gtk/usb-device-manager.h
index a7e3515..5b4cfbe 100644
--- a/gtk/usb-device-manager.h
+++ b/gtk/usb-device-manager.h
@@ -89,6 +89,7 @@ GType spice_usb_device_get_type(void);
GType spice_usb_device_manager_get_type(void);
gchar *spice_usb_device_get_description(SpiceUsbDevice *device, const gchar *format);
+gconstpointer spice_usb_device_get_libusb_device(const SpiceUsbDevice *device);
SpiceUsbDeviceManager *spice_usb_device_manager_get(SpiceSession *session,
GError **err);
More information about the Spice-commits
mailing list