mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-06 06:27:58 +00:00
Ensure the new GUsbDevice is assigned in subclasses of FuUsbDevice
Re-incorporate the emulated USB devices when the backend device changes.
This commit is contained in:
parent
00ec2d8c25
commit
bc50d59f56
@ -63,6 +63,7 @@
|
|||||||
#include "fu-udev-device-private.h"
|
#include "fu-udev-device-private.h"
|
||||||
#include "fu-usb-device-fw-ds20.h"
|
#include "fu-usb-device-fw-ds20.h"
|
||||||
#include "fu-usb-device-ms-ds20.h"
|
#include "fu-usb-device-ms-ds20.h"
|
||||||
|
#include "fu-usb-device-private.h"
|
||||||
#include "fu-version.h"
|
#include "fu-version.h"
|
||||||
|
|
||||||
#ifdef HAVE_GUDEV
|
#ifdef HAVE_GUDEV
|
||||||
@ -7424,6 +7425,20 @@ fu_engine_backend_device_changed_cb(FuBackend *backend, FuDevice *device, FuEngi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* get the new GUsbDevice for emulated devices */
|
||||||
|
for (guint i = 0; i < devices->len; i++) {
|
||||||
|
FuDevice *device_tmp = g_ptr_array_index(devices, i);
|
||||||
|
if (!fu_device_has_flag(device_tmp, FWUPD_DEVICE_FLAG_EMULATED))
|
||||||
|
continue;
|
||||||
|
if (!FU_IS_USB_DEVICE(device_tmp) || !FU_IS_USB_DEVICE(device))
|
||||||
|
continue;
|
||||||
|
if (g_strcmp0(fu_usb_device_get_platform_id(FU_USB_DEVICE(device_tmp)),
|
||||||
|
fu_usb_device_get_platform_id(FU_USB_DEVICE(device))) == 0) {
|
||||||
|
g_debug("incorporating new GUsbDevice for %s", fu_device_get_id(device));
|
||||||
|
fu_device_incorporate(device_tmp, device);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* run all plugins */
|
/* run all plugins */
|
||||||
for (guint j = 0; j < plugins->len; j++) {
|
for (guint j = 0; j < plugins->len; j++) {
|
||||||
FuPlugin *plugin_tmp = g_ptr_array_index(plugins, j);
|
FuPlugin *plugin_tmp = g_ptr_array_index(plugins, j);
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include <gusb.h>
|
#include <gusb.h>
|
||||||
|
|
||||||
#include "fu-usb-backend.h"
|
#include "fu-usb-backend.h"
|
||||||
#include "fu-usb-device.h"
|
#include "fu-usb-device-private.h"
|
||||||
|
|
||||||
struct _FuUsbBackend {
|
struct _FuUsbBackend {
|
||||||
FuBackend parent_instance;
|
FuBackend parent_instance;
|
||||||
@ -61,8 +61,9 @@ fu_usb_backend_device_added_cb(GUsbContext *ctx, GUsbDevice *usb_device, FuBacke
|
|||||||
g_usb_device_get_pid(usb_device) ==
|
g_usb_device_get_pid(usb_device) ==
|
||||||
fu_usb_device_get_pid(FU_USB_DEVICE(device_tmp))) {
|
fu_usb_device_get_pid(FU_USB_DEVICE(device_tmp))) {
|
||||||
g_debug("replacing GUsbDevice of emulated device %s",
|
g_debug("replacing GUsbDevice of emulated device %s",
|
||||||
fu_device_get_id(device_tmp));
|
fu_usb_device_get_platform_id(FU_USB_DEVICE(device_tmp)));
|
||||||
fu_usb_device_set_dev(FU_USB_DEVICE(device_tmp), usb_device);
|
fu_usb_device_set_dev(FU_USB_DEVICE(device_tmp), usb_device);
|
||||||
|
fu_backend_device_changed(backend, device_tmp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
g_debug("delayed removal of emulated device as VID:PID changed");
|
g_debug("delayed removal of emulated device as VID:PID changed");
|
||||||
|
Loading…
Reference in New Issue
Block a user