From 6ecb11a5845cf5773d7e711c96ab4c2971fda766 Mon Sep 17 00:00:00 2001 From: Richard Hughes Date: Mon, 23 Jan 2023 15:17:27 +0000 Subject: Add g_usb_device_is_emulated() for future use --- gusb/gusb-device.c | 17 +++++++++++++++++ gusb/gusb-device.h | 2 ++ gusb/libgusb.ver | 1 + 3 files changed, 20 insertions(+) diff --git a/gusb/gusb-device.c b/gusb/gusb-device.c index 3c0a125..90f1539 100644 --- a/gusb/gusb-device.c +++ b/gusb/gusb-device.c @@ -641,6 +641,23 @@ _g_usb_device_get_device(GUsbDevice *self) return priv->device; } +/** + * g_usb_device_is_emulated: + * @self: a #GUsbDevice instance + * + * Gets if the device is emulated. + * + * Return value: %TRUE if the device is emulated and not backed by a physical device. + * + * Since: 0.4.4 + **/ +gboolean +g_usb_device_is_emulated(GUsbDevice *self) +{ + GUsbDevicePrivate *priv = GET_PRIVATE(self); + return priv->device == NULL; +} + static gboolean g_usb_device_libusb_error_to_gerror(GUsbDevice *self, gint rc, GError **error) { diff --git a/gusb/gusb-device.h b/gusb/gusb-device.h index 2708f43..124dd57 100644 --- a/gusb/gusb-device.h +++ b/gusb/gusb-device.h @@ -139,6 +139,8 @@ g_usb_device_error_quark(void); const gchar * g_usb_device_get_platform_id(GUsbDevice *self); +gboolean +g_usb_device_is_emulated(GUsbDevice *self); GUsbDevice * g_usb_device_get_parent(GUsbDevice *self); GPtrArray * diff --git a/gusb/libgusb.ver b/gusb/libgusb.ver index d1f9455..59c311c 100644 --- a/gusb/libgusb.ver +++ b/gusb/libgusb.ver @@ -202,6 +202,7 @@ LIBGUSB_0.4.3 { LIBGUSB_0.4.4 { global: + g_usb_device_is_emulated; g_usb_device_remove_tag; local: *; } LIBGUSB_0.4.3; -- cgit v1.2.1