mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-07 08:39:48 +00:00
trivial: Split out a new helper funtion
Other devices need to use this functionality too.
This commit is contained in:
parent
f3880bce26
commit
aba4a5a2bd
@ -251,13 +251,7 @@ fu_synaprom_config_detach (FuDevice *device, GError **error)
|
|||||||
static void
|
static void
|
||||||
fu_synaprom_config_flags_notify_cb (FuDevice *parent, GParamSpec *pspec, FuDevice *device)
|
fu_synaprom_config_flags_notify_cb (FuDevice *parent, GParamSpec *pspec, FuDevice *device)
|
||||||
{
|
{
|
||||||
if (fu_device_has_flag (parent, FWUPD_DEVICE_FLAG_IS_BOOTLOADER)) {
|
fu_device_incorporate_flag (device, 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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -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:
|
* fu_device_incorporate_from_component:
|
||||||
* @device: A #FuDevice
|
* @device: A #FuDevice
|
||||||
|
@ -246,6 +246,9 @@ gboolean fu_device_cleanup (FuDevice *self,
|
|||||||
GError **error);
|
GError **error);
|
||||||
void fu_device_incorporate (FuDevice *self,
|
void fu_device_incorporate (FuDevice *self,
|
||||||
FuDevice *donor);
|
FuDevice *donor);
|
||||||
|
void fu_device_incorporate_flag (FuDevice *self,
|
||||||
|
FuDevice *donor,
|
||||||
|
FwupdDeviceFlags flag);
|
||||||
gboolean fu_device_open (FuDevice *self,
|
gboolean fu_device_open (FuDevice *self,
|
||||||
GError **error);
|
GError **error);
|
||||||
gboolean fu_device_close (FuDevice *self,
|
gboolean fu_device_close (FuDevice *self,
|
||||||
|
Loading…
Reference in New Issue
Block a user