diff options
author | Richard Hughes <richard@hughsie.com> | 2022-09-05 18:16:30 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2022-09-05 18:16:30 +0100 |
commit | 42d6ac28cf391aad8a156672dbf364a927d5ac44 (patch) | |
tree | 246ed39bddf909f50d9365bc89bde35ff684b09b | |
parent | f38f99eb7e02cfedf94eccbd853842253261c8ca (diff) | |
download | gusb-42d6ac28cf391aad8a156672dbf364a927d5ac44.tar.gz |
Skip some functionality when emulating
-rw-r--r-- | gusb/gusb-device.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gusb/gusb-device.c b/gusb/gusb-device.c index 6102f27..12ffd77 100644 --- a/gusb/gusb-device.c +++ b/gusb/gusb-device.c @@ -644,6 +644,10 @@ g_usb_device_open(GUsbDevice *self, GError **error) g_return_val_if_fail(G_USB_IS_DEVICE(self), FALSE); g_return_val_if_fail(error == NULL || *error == NULL, FALSE); + /* emulated */ + if (priv->device == NULL) + return TRUE; + /* ignore */ if (g_usb_context_get_flags(priv->context) & G_USB_CONTEXT_FLAGS_AUTO_OPEN_DEVICES) return TRUE; @@ -964,6 +968,10 @@ g_usb_device_close(GUsbDevice *self, GError **error) g_return_val_if_fail(G_USB_IS_DEVICE(self), FALSE); g_return_val_if_fail(error == NULL || *error == NULL, FALSE); + /* emulated */ + if (priv->device == NULL) + return TRUE; + /* ignore */ if (g_usb_context_get_flags(priv->context) & G_USB_CONTEXT_FLAGS_AUTO_OPEN_DEVICES) return TRUE; @@ -1001,6 +1009,10 @@ g_usb_device_reset(GUsbDevice *self, GError **error) g_return_val_if_fail(G_USB_IS_DEVICE(self), FALSE); g_return_val_if_fail(error == NULL || *error == NULL, FALSE); + /* emulated */ + if (priv->device == NULL) + return TRUE; + if (priv->handle == NULL) return g_usb_device_not_open_error(self, error); |