diff options
author | Richard Hughes <richard@hughsie.com> | 2022-09-06 12:00:02 +0100 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2022-09-06 12:14:18 +0100 |
commit | 845f3527e1075d03ee72a96b42318f774c7e93de (patch) | |
tree | 17a8d78b5ed2b6f0eccaa545321dd3905f6f0c7e /gusb | |
parent | 7acc6d8ea6e17cde7fbff5adef590bd4b7ced10e (diff) | |
download | gusb-845f3527e1075d03ee72a96b42318f774c7e93de.tar.gz |
trivial: Ignore more requests when emulating a device
Diffstat (limited to 'gusb')
-rw-r--r-- | gusb/gusb-device.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gusb/gusb-device.c b/gusb/gusb-device.c index e888c67..daacd6e 100644 --- a/gusb/gusb-device.c +++ b/gusb/gusb-device.c @@ -1034,6 +1034,10 @@ g_usb_device_get_configuration(GUsbDevice *self, GError **error) g_return_val_if_fail(G_USB_IS_DEVICE(self), -1); g_return_val_if_fail(error == NULL || *error == NULL, -1); + /* emulated */ + if (priv->device == NULL) + return 0x0; + if (priv->handle == NULL) { g_usb_device_not_open_error(self, error); return -1; @@ -1072,6 +1076,10 @@ g_usb_device_set_configuration(GUsbDevice *self, gint configuration, GError **er 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); @@ -1113,6 +1121,10 @@ g_usb_device_claim_interface(GUsbDevice *self, 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); @@ -1153,6 +1165,10 @@ g_usb_device_release_interface(GUsbDevice *self, 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); @@ -1193,6 +1209,10 @@ g_usb_device_set_interface_alt(GUsbDevice *self, gint interface, guint8 alt, GEr 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); |