fu-udev-device: call rescan on the device for change events

This allows calling the correct method, and instead doesn't have
all the plugins try to process the event when they're missing
vfuncs
This commit is contained in:
Mario Limonciello 2020-09-10 21:46:05 -05:00 committed by Mario Limonciello
parent 6d23514fb1
commit 6d0c4897e1
3 changed files with 6 additions and 2 deletions

View File

@ -76,8 +76,11 @@ static guint signals[SIGNAL_LAST] = { 0 };
void
fu_udev_device_emit_changed (FuUdevDevice *self)
{
g_autoptr(GError) error = NULL;
g_return_if_fail (FU_IS_UDEV_DEVICE (self));
g_debug ("FuUdevDevice emit changed");
if (!fu_device_rescan (FU_DEVICE (self), &error))
g_debug ("%s", error->message);
g_signal_emit (self, signals[SIGNAL_CHANGED], 0);
}

View File

@ -26,6 +26,7 @@
#include "fu-plugin-private.h"
#include "fu-thunderbolt-firmware.h"
#include "fu-thunderbolt-firmware-update.h"
#include "fu-udev-device-private.h"
static gchar *
udev_mock_add_domain (UMockdevTestbed *bed, int id)
@ -891,8 +892,7 @@ fu_thunderbolt_gudev_uevent_cb (GUdevClient *gudev_client,
const gchar *uuid = g_udev_device_get_sysfs_attr (udev_device, "unique_id");
MockTree *target = (MockTree *) mock_tree_find_uuid (tt->tree, uuid);
g_assert_nonnull (target);
fu_plugin_runner_udev_device_changed (tt->plugin, FU_UDEV_DEVICE (target->fu_device),
&error_local);
fu_udev_device_emit_changed (FU_UDEV_DEVICE (target->fu_device));
return;
}
}

View File

@ -20,6 +20,7 @@
#include "fu-thunderbolt-device.h"
#include "fu-thunderbolt-firmware.h"
#include "fu-thunderbolt-firmware-update.h"
#include "fu-udev-device-private.h"
typedef enum {
FU_THUNDERBOLT_DEVICE_TYPE_DEVICE_CONTROLLER,