diff --git a/plugins/synaptics-prometheus/fu-synaprom-config.c b/plugins/synaptics-prometheus/fu-synaprom-config.c index 3a4c7c278..480c1a517 100644 --- a/plugins/synaptics-prometheus/fu-synaprom-config.c +++ b/plugins/synaptics-prometheus/fu-synaprom-config.c @@ -251,13 +251,7 @@ fu_synaprom_config_detach (FuDevice *device, GError **error) static void fu_synaprom_config_flags_notify_cb (FuDevice *parent, GParamSpec *pspec, FuDevice *device) { - if (fu_device_has_flag (parent, FWUPD_DEVICE_FLAG_IS_BOOTLOADER)) { - g_debug ("parent set IS_BOOTLOADER, mirroring to child"); - fu_device_add_flag (device, FWUPD_DEVICE_FLAG_IS_BOOTLOADER); - } else { - g_debug ("parent unset IS_BOOTLOADER, mirroring to child"); - fu_device_remove_flag (device, FWUPD_DEVICE_FLAG_IS_BOOTLOADER); - } + fu_device_incorporate_flag (device, parent, FWUPD_DEVICE_FLAG_IS_BOOTLOADER); } static void diff --git a/src/fu-device.c b/src/fu-device.c index e08f38c6e..6f507a2f6 100644 --- a/src/fu-device.c +++ b/src/fu-device.c @@ -2607,6 +2607,28 @@ fu_device_incorporate (FuDevice *self, FuDevice *donor) } } +/** + * fu_device_incorporate_flag: + * @self: A #FuDevice + * @donor: Another #FuDevice + * @flag: A #FwupdDeviceFlags value + * + * Copy the value of a specific flag from the donor object. + * + * Since: 1.3.5 + **/ +void +fu_device_incorporate_flag (FuDevice *self, FuDevice *donor, FwupdDeviceFlags flag) +{ + if (fu_device_has_flag (donor, flag) && !fu_device_has_flag (self, flag)) { + g_debug ("donor set %s", fwupd_device_flag_to_string (flag)); + fu_device_add_flag (self, flag); + } else if (!fu_device_has_flag (donor, flag) && fu_device_has_flag (self, flag)) { + g_debug ("donor unset %s", fwupd_device_flag_to_string (flag)); + fu_device_remove_flag (self, flag); + } +} + /** * fu_device_incorporate_from_component: * @device: A #FuDevice diff --git a/src/fu-device.h b/src/fu-device.h index 7cd710090..1fffc23fc 100644 --- a/src/fu-device.h +++ b/src/fu-device.h @@ -246,6 +246,9 @@ gboolean fu_device_cleanup (FuDevice *self, GError **error); void fu_device_incorporate (FuDevice *self, FuDevice *donor); +void fu_device_incorporate_flag (FuDevice *self, + FuDevice *donor, + FwupdDeviceFlags flag); gboolean fu_device_open (FuDevice *self, GError **error); gboolean fu_device_close (FuDevice *self,