diff options
author | Richard Hughes <richard@hughsie.com> | 2023-02-02 16:43:16 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2023-02-03 12:30:17 +0000 |
commit | 3124faf28e23009bd304dbd66cd32227c4142a9b (patch) | |
tree | 746eda7399bea4a62de465fff0b016e1ab0b36ce /gusb/gusb-device.c | |
parent | 4db790b78afc0642be95416cccba9c05b7ca5c5a (diff) | |
download | gusb-3124faf28e23009bd304dbd66cd32227c4142a9b.tar.gz |
Do not emit spurious ::device-removed events when emulating
If we load new emulation data we have to do horrible tricks in the caller to
avoid handling the remove event when loading new event data.
Make the caller (fwupd) much simpler by emitting the correct signals.
Also add a ::device-changed signal that we can use to reload the device events.
Diffstat (limited to 'gusb/gusb-device.c')
-rw-r--r-- | gusb/gusb-device.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gusb/gusb-device.c b/gusb/gusb-device.c index 60c70c1..bbda96c 100644 --- a/gusb/gusb-device.c +++ b/gusb/gusb-device.c @@ -222,6 +222,16 @@ g_usb_device_init(GUsbDevice *self) priv->tags = g_ptr_array_new_with_free_func(g_free); } +/* private */ +void +_g_usb_device_add_event(GUsbDevice *self, GUsbDeviceEvent *event) +{ + GUsbDevicePrivate *priv = GET_PRIVATE(self); + g_return_if_fail(G_USB_IS_DEVICE(self)); + g_return_if_fail(G_USB_IS_DEVICE_EVENT(event)); + g_ptr_array_add(priv->events, g_object_ref(event)); +} + gboolean _g_usb_device_load(GUsbDevice *self, JsonObject *json_object, GError **error) { |