diff options
author | Richard Hughes <richard@hughsie.com> | 2023-01-23 15:17:27 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2023-01-24 08:01:41 +0000 |
commit | 6ecb11a5845cf5773d7e711c96ab4c2971fda766 (patch) | |
tree | d99b6952ad362fb300fe812fea515fcea9b594a7 | |
parent | d6ad4f72ad897fec83719b744a2265f22e996fe6 (diff) | |
download | gusb-6ecb11a5845cf5773d7e711c96ab4c2971fda766.tar.gz |
Add g_usb_device_is_emulated() for future use
-rw-r--r-- | gusb/gusb-device.c | 17 | ||||
-rw-r--r-- | gusb/gusb-device.h | 2 | ||||
-rw-r--r-- | gusb/libgusb.ver | 1 |
3 files changed, 20 insertions, 0 deletions
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; |