mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-04 13:58:48 +00:00
Allow overriding the firmware GType from a quirk file
This also allows us to remove quite a lot of boilerplate from plugins.
This commit is contained in:
parent
36d7077f65
commit
764df76d34
@ -67,6 +67,7 @@ typedef struct {
|
||||
guint64 size_max;
|
||||
gint open_refcount; /* atomic */
|
||||
GType specialized_gtype;
|
||||
GType firmware_gtype;
|
||||
GPtrArray *possible_plugins;
|
||||
GPtrArray *retry_recs; /* of FuDeviceRetryRecovery */
|
||||
guint retry_delay;
|
||||
@ -1611,6 +1612,16 @@ fu_device_set_quirk_kv(FuDevice *self, const gchar *key, const gchar *value, GEr
|
||||
priv->specialized_gtype = g_type_from_name(value);
|
||||
return TRUE;
|
||||
}
|
||||
if (g_strcmp0(key, FU_QUIRKS_FIRMWARE_GTYPE) == 0) {
|
||||
if (priv->firmware_gtype != G_TYPE_INVALID) {
|
||||
g_debug("already set firmware GType to %s, ignoring %s",
|
||||
g_type_name(priv->firmware_gtype),
|
||||
value);
|
||||
return TRUE;
|
||||
}
|
||||
priv->firmware_gtype = g_type_from_name(value);
|
||||
return TRUE;
|
||||
}
|
||||
if (g_strcmp0(key, FU_QUIRKS_CHILDREN) == 0) {
|
||||
g_auto(GStrv) sections = g_strsplit(value, ",", -1);
|
||||
for (guint i = 0; sections[i] != NULL; i++) {
|
||||
@ -1646,6 +1657,39 @@ fu_device_get_specialized_gtype(FuDevice *self)
|
||||
return priv->specialized_gtype;
|
||||
}
|
||||
|
||||
/**
|
||||
* fu_device_get_firmware_gtype:
|
||||
* @self: a #FuDevice
|
||||
*
|
||||
* Gets the default firmware type for the device.
|
||||
*
|
||||
* Returns: #GType
|
||||
*
|
||||
* Since: 1.7.2
|
||||
**/
|
||||
GType
|
||||
fu_device_get_firmware_gtype(FuDevice *self)
|
||||
{
|
||||
FuDevicePrivate *priv = GET_PRIVATE(self);
|
||||
return priv->firmware_gtype;
|
||||
}
|
||||
|
||||
/**
|
||||
* fu_device_set_firmware_gtype:
|
||||
* @self: a #FuDevice
|
||||
* @firmware_gtype: a #GType
|
||||
*
|
||||
* Sets the default firmware type for the device.
|
||||
*
|
||||
* Since: 1.7.2
|
||||
**/
|
||||
void
|
||||
fu_device_set_firmware_gtype(FuDevice *self, GType firmware_gtype)
|
||||
{
|
||||
FuDevicePrivate *priv = GET_PRIVATE(self);
|
||||
priv->firmware_gtype = firmware_gtype;
|
||||
}
|
||||
|
||||
static void
|
||||
fu_device_quirks_iter_cb(FuContext *ctx, const gchar *key, const gchar *value, gpointer user_data)
|
||||
{
|
||||
@ -3571,6 +3615,10 @@ fu_device_prepare_firmware(FuDevice *self, GBytes *fw, FwupdInstallFlags flags,
|
||||
firmware = klass->prepare_firmware(self, fw, flags, error);
|
||||
if (firmware == NULL)
|
||||
return NULL;
|
||||
} else if (priv->firmware_gtype != G_TYPE_INVALID) {
|
||||
firmware = g_object_new(priv->firmware_gtype, NULL);
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
} else {
|
||||
firmware = fu_firmware_new_from_bytes(fw);
|
||||
}
|
||||
|
@ -541,6 +541,10 @@ FwupdRelease *
|
||||
fu_device_get_release_default(FuDevice *self);
|
||||
GType
|
||||
fu_device_get_specialized_gtype(FuDevice *self);
|
||||
GType
|
||||
fu_device_get_firmware_gtype(FuDevice *self);
|
||||
void
|
||||
fu_device_set_firmware_gtype(FuDevice *self, GType firmware_gtype);
|
||||
void
|
||||
fu_device_add_internal_flag(FuDevice *self, FuDeviceInternalFlags flag);
|
||||
void
|
||||
|
@ -516,6 +516,7 @@ fu_quirks_init(FuQuirks *self)
|
||||
fu_quirks_add_possible_key(self, FU_QUIRKS_FIRMWARE_SIZE_MIN);
|
||||
fu_quirks_add_possible_key(self, FU_QUIRKS_FLAGS);
|
||||
fu_quirks_add_possible_key(self, FU_QUIRKS_GTYPE);
|
||||
fu_quirks_add_possible_key(self, FU_QUIRKS_FIRMWARE_GTYPE);
|
||||
fu_quirks_add_possible_key(self, FU_QUIRKS_GUID);
|
||||
fu_quirks_add_possible_key(self, FU_QUIRKS_ICON);
|
||||
fu_quirks_add_possible_key(self, FU_QUIRKS_INHIBIT);
|
||||
|
@ -220,6 +220,14 @@ fu_quirks_add_possible_key(FuQuirks *self, const gchar *possible_key);
|
||||
* Since: 1.3.7
|
||||
**/
|
||||
#define FU_QUIRKS_GTYPE "GType"
|
||||
/**
|
||||
* FU_QUIRKS_FIRMWARE_GTYPE:
|
||||
*
|
||||
* The quirk key for the custom firmware GType.
|
||||
*
|
||||
* Since: 1.7.2
|
||||
**/
|
||||
#define FU_QUIRKS_FIRMWARE_GTYPE "FirmwareGType"
|
||||
/**
|
||||
* FU_QUIRKS_PROTOCOL:
|
||||
*
|
||||
|
@ -949,6 +949,8 @@ LIBFWUPDPLUGIN_1.7.1 {
|
||||
LIBFWUPDPLUGIN_1.7.2 {
|
||||
global:
|
||||
fu_context_has_hwid_flag;
|
||||
fu_device_get_firmware_gtype;
|
||||
fu_device_set_firmware_gtype;
|
||||
fu_udev_device_get_bind_id;
|
||||
fu_udev_device_get_sysfs_attr_uint64;
|
||||
fu_udev_device_seek;
|
||||
|
@ -223,18 +223,6 @@ fu_altos_device_write_page(FuAltosDevice *self,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static FuFirmware *
|
||||
fu_altos_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_altos_firmware_new();
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_altos_device_write_firmware(FuDevice *device,
|
||||
FuFirmware *firmware,
|
||||
@ -572,6 +560,7 @@ fu_altos_device_init(FuAltosDevice *self)
|
||||
fu_device_set_vendor(FU_DEVICE(self), "altusmetrum.org");
|
||||
fu_device_set_summary(FU_DEVICE(self), "USB hardware random number generator");
|
||||
fu_device_add_protocol(FU_DEVICE(self), "org.altusmetrum.altos");
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_ALTOS_FIRMWARE);
|
||||
|
||||
/* requires manual step */
|
||||
if (!fu_device_has_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_IS_BOOTLOADER))
|
||||
@ -585,7 +574,6 @@ fu_altos_device_class_init(FuAltosDeviceClass *klass)
|
||||
FuDeviceClass *klass_device = FU_DEVICE_CLASS(klass);
|
||||
klass_device->to_string = fu_altos_device_to_string;
|
||||
klass_device->probe = fu_altos_device_probe;
|
||||
klass_device->prepare_firmware = fu_altos_device_prepare_firmware;
|
||||
klass_device->write_firmware = fu_altos_device_write_firmware;
|
||||
klass_device->dump_firmware = fu_altos_device_dump_firmware;
|
||||
klass_device->set_progress = fu_altos_device_set_progress;
|
||||
|
@ -267,18 +267,6 @@ fu_analogix_device_probe(FuDevice *device, GError **error)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static FuFirmware *
|
||||
fu_analogix_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_analogix_firmware_new();
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_analogix_device_write_image(FuAnalogixDevice *self,
|
||||
FuFirmware *image,
|
||||
@ -465,6 +453,7 @@ fu_analogix_device_init(FuAnalogixDevice *self)
|
||||
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_USABLE_DURING_UPDATE);
|
||||
fu_device_set_version_format(FU_DEVICE(self), FWUPD_VERSION_FORMAT_PAIR);
|
||||
fu_device_set_vendor(FU_DEVICE(self), "Analogix Semiconductor Inc.");
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_ANALOGIX_FIRMWARE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -476,7 +465,6 @@ fu_analogix_device_class_init(FuAnalogixDeviceClass *klass)
|
||||
klass_device->setup = fu_analogix_device_setup;
|
||||
klass_device->open = fu_analogix_device_open;
|
||||
klass_device->probe = fu_analogix_device_probe;
|
||||
klass_device->prepare_firmware = fu_analogix_device_prepare_firmware;
|
||||
klass_device->close = fu_analogix_device_close;
|
||||
klass_device->set_progress = fu_analogix_device_set_progress;
|
||||
}
|
||||
|
@ -342,27 +342,6 @@ fu_dfu_csr_device_download_chunk(FuDfuCsrDevice *self, guint16 idx, GBytes *chun
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static FuFirmware *
|
||||
fu_dfu_csr_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_dfu_firmware_new();
|
||||
|
||||
/* parse the file */
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
if (g_getenv("FWUPD_DFU_CSR_VERBOSE") != NULL) {
|
||||
g_autofree gchar *fw_str = NULL;
|
||||
fw_str = fu_firmware_to_string(firmware);
|
||||
g_debug("%s", fw_str);
|
||||
}
|
||||
|
||||
/* success */
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_dfu_csr_device_download(FuDevice *device,
|
||||
FuFirmware *firmware,
|
||||
@ -455,6 +434,7 @@ fu_dfu_csr_device_init(FuDfuCsrDevice *self)
|
||||
{
|
||||
fu_device_add_protocol(FU_DEVICE(self), "com.qualcomm.dfu");
|
||||
fu_device_add_internal_flag(FU_DEVICE(self), FU_DEVICE_INTERNAL_FLAG_REPLUG_MATCH_GUID);
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_DFU_FIRMWARE);
|
||||
fu_device_register_private_flag(FU_DEVICE(self),
|
||||
FU_DFU_CSR_DEVICE_FLAG_REQUIRE_DELAY,
|
||||
"require-delay");
|
||||
@ -467,7 +447,6 @@ fu_dfu_csr_device_class_init(FuDfuCsrDeviceClass *klass)
|
||||
klass_device->to_string = fu_dfu_csr_device_to_string;
|
||||
klass_device->write_firmware = fu_dfu_csr_device_download;
|
||||
klass_device->dump_firmware = fu_dfu_csr_device_upload;
|
||||
klass_device->prepare_firmware = fu_dfu_csr_device_prepare_firmware;
|
||||
klass_device->attach = fu_dfu_csr_device_attach;
|
||||
klass_device->setup = fu_dfu_csr_device_setup;
|
||||
klass_device->probe = fu_dfu_csr_device_probe;
|
||||
|
@ -656,18 +656,6 @@ fu_ebitdo_device_probe(FuDevice *device, GError **error)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static FuFirmware *
|
||||
fu_ebitdo_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_ebitdo_firmware_new();
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static void
|
||||
fu_ebitdo_set_progress(FuDevice *self, FuProgress *progress)
|
||||
{
|
||||
@ -685,6 +673,7 @@ fu_ebitdo_device_init(FuEbitdoDevice *self)
|
||||
fu_device_add_protocol(FU_DEVICE(self), "com.8bitdo");
|
||||
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_ADD_COUNTERPART_GUIDS);
|
||||
fu_device_add_internal_flag(FU_DEVICE(self), FU_DEVICE_INTERNAL_FLAG_REPLUG_MATCH_GUID);
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_EBITDO_FIRMWARE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -697,6 +686,5 @@ fu_ebitdo_device_class_init(FuEbitdoDeviceClass *klass)
|
||||
klass_device->attach = fu_ebitdo_device_attach;
|
||||
klass_device->open = fu_ebitdo_device_open;
|
||||
klass_device->probe = fu_ebitdo_device_probe;
|
||||
klass_device->prepare_firmware = fu_ebitdo_device_prepare_firmware;
|
||||
klass_device->set_progress = fu_ebitdo_set_progress;
|
||||
}
|
||||
|
@ -34,18 +34,6 @@ struct _FuElanfpDevice {
|
||||
|
||||
G_DEFINE_TYPE(FuElanfpDevice, fu_elanfp_device, FU_TYPE_USB_DEVICE)
|
||||
|
||||
static FuFirmware *
|
||||
fu_elanfp_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_elanfp_firmware_new();
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_elanfp_device_open(FuDevice *device, GError **error)
|
||||
{
|
||||
@ -439,6 +427,7 @@ fu_elanfp_device_init(FuElanfpDevice *device)
|
||||
fu_device_set_install_duration(FU_DEVICE(self), 10);
|
||||
fu_device_set_firmware_size_min(FU_DEVICE(self), 0x20000);
|
||||
fu_device_set_firmware_size_max(FU_DEVICE(self), 0x90000);
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_ELANFP_FIRMWARE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -456,7 +445,6 @@ fu_elanfp_device_class_init(FuElanfpDeviceClass *klass)
|
||||
{
|
||||
FuDeviceClass *klass_device = FU_DEVICE_CLASS(klass);
|
||||
klass_device->setup = fu_elanfp_device_setup;
|
||||
klass_device->prepare_firmware = fu_elanfp_device_prepare_firmware;
|
||||
klass_device->write_firmware = fu_elanfp_device_write_firmware;
|
||||
klass_device->open = fu_elanfp_device_open;
|
||||
klass_device->close = fu_elanfp_device_close;
|
||||
|
@ -202,18 +202,6 @@ fu_ep963x_device_setup(FuDevice *device, GError **error)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static FuFirmware *
|
||||
fu_ep963x_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_ep963x_firmware_new();
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_ep963x_device_wait_cb(FuDevice *device, gpointer user_data, GError **error)
|
||||
{
|
||||
@ -376,6 +364,7 @@ fu_ep963x_device_init(FuEp963xDevice *self)
|
||||
fu_device_set_version_format(FU_DEVICE(self), FWUPD_VERSION_FORMAT_NUMBER);
|
||||
fu_device_set_remove_delay(FU_DEVICE(self), FU_DEVICE_REMOVE_DELAY_RE_ENUMERATE);
|
||||
fu_device_set_firmware_size(FU_DEVICE(self), FU_EP963_FIRMWARE_SIZE);
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_EP963X_FIRMWARE);
|
||||
fu_device_retry_set_delay(FU_DEVICE(self), 100);
|
||||
}
|
||||
|
||||
@ -383,7 +372,6 @@ static void
|
||||
fu_ep963x_device_class_init(FuEp963xDeviceClass *klass)
|
||||
{
|
||||
FuDeviceClass *klass_device = FU_DEVICE_CLASS(klass);
|
||||
klass_device->prepare_firmware = fu_ep963x_device_prepare_firmware;
|
||||
klass_device->write_firmware = fu_ep963x_device_write_firmware;
|
||||
klass_device->attach = fu_ep963x_device_attach;
|
||||
klass_device->detach = fu_ep963x_device_detach;
|
||||
|
@ -209,18 +209,6 @@ fu_hailuck_bl_device_write_block(FuHailuckBlDevice *self,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static FuFirmware *
|
||||
fu_hailuck_bl_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_hailuck_kbd_firmware_new();
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_hailuck_bl_device_write_firmware(FuDevice *device,
|
||||
FuFirmware *firmware,
|
||||
@ -303,6 +291,7 @@ static void
|
||||
fu_hailuck_bl_device_init(FuHailuckBlDevice *self)
|
||||
{
|
||||
fu_device_set_firmware_size(FU_DEVICE(self), 0x4000);
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_HAILUCK_KBD_FIRMWARE);
|
||||
fu_device_add_protocol(FU_DEVICE(self), "com.hailuck.kbd");
|
||||
fu_device_set_name(FU_DEVICE(self), "Keyboard [bootloader]");
|
||||
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_IS_BOOTLOADER);
|
||||
@ -319,7 +308,6 @@ fu_hailuck_bl_device_class_init(FuHailuckBlDeviceClass *klass)
|
||||
{
|
||||
FuDeviceClass *klass_device = FU_DEVICE_CLASS(klass);
|
||||
klass_device->dump_firmware = fu_hailuck_bl_device_dump_firmware;
|
||||
klass_device->prepare_firmware = fu_hailuck_bl_device_prepare_firmware;
|
||||
klass_device->write_firmware = fu_hailuck_bl_device_write_firmware;
|
||||
klass_device->attach = fu_hailuck_bl_device_attach;
|
||||
klass_device->probe = fu_hailuck_bl_device_probe;
|
||||
|
@ -536,18 +536,6 @@ fu_pxi_receiver_device_reset(FuDevice *device, GError **error)
|
||||
error);
|
||||
}
|
||||
|
||||
static FuFirmware *
|
||||
fu_pxi_receiver_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_pxi_firmware_new();
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_pxi_receiver_device_write_firmware(FuDevice *device,
|
||||
FuFirmware *firmware,
|
||||
@ -880,6 +868,7 @@ fu_pxi_receiver_device_init(FuPxiReceiverDevice *self)
|
||||
fu_device_set_version_format(FU_DEVICE(self), FWUPD_VERSION_FORMAT_TRIPLET);
|
||||
fu_device_add_vendor_id(FU_DEVICE(self), "USB:0x093A");
|
||||
fu_device_add_protocol(FU_DEVICE(self), "com.pixart.rf");
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_PXI_FIRMWARE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -890,6 +879,5 @@ fu_pxi_receiver_device_class_init(FuPxiReceiverDeviceClass *klass)
|
||||
klass_device->setup = fu_pxi_receiver_device_setup;
|
||||
klass_device->probe = fu_pxi_receiver_device_probe;
|
||||
klass_device->write_firmware = fu_pxi_receiver_device_write_firmware;
|
||||
klass_device->prepare_firmware = fu_pxi_receiver_device_prepare_firmware;
|
||||
klass_device->set_progress = fu_pxi_receiver_device_set_progress;
|
||||
}
|
||||
|
@ -570,18 +570,6 @@ fu_pxi_wireless_device_reset(FuDevice *device, GError **error)
|
||||
error);
|
||||
}
|
||||
|
||||
static FuFirmware *
|
||||
fu_pxi_wireless_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_pxi_firmware_new();
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_pxi_wireless_device_write_firmware(FuDevice *device,
|
||||
FuFirmware *firmware,
|
||||
@ -665,6 +653,7 @@ fu_pxi_wireless_device_init(FuPxiWirelessDevice *self)
|
||||
fu_device_set_version_format(FU_DEVICE(self), FWUPD_VERSION_FORMAT_TRIPLET);
|
||||
fu_device_add_vendor_id(FU_DEVICE(self), "USB:0x093A");
|
||||
fu_device_add_protocol(FU_DEVICE(self), "com.pixart.rf");
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_PXI_FIRMWARE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -672,7 +661,6 @@ fu_pxi_wireless_device_class_init(FuPxiWirelessDeviceClass *klass)
|
||||
{
|
||||
FuDeviceClass *klass_device = FU_DEVICE_CLASS(klass);
|
||||
klass_device->write_firmware = fu_pxi_wireless_device_write_firmware;
|
||||
klass_device->prepare_firmware = fu_pxi_wireless_device_prepare_firmware;
|
||||
klass_device->to_string = fu_pxi_wireless_device_to_string;
|
||||
klass_device->set_progress = fu_pxi_wireless_device_set_progress;
|
||||
}
|
||||
|
@ -431,18 +431,6 @@ fu_solokey_device_verify(FuSolokeyDevice *self, GBytes *fw_sig, GError **error)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static FuFirmware *
|
||||
fu_solokey_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_solokey_firmware_new();
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_solokey_device_write_firmware(FuDevice *device,
|
||||
FuFirmware *firmware,
|
||||
@ -534,6 +522,7 @@ fu_solokey_device_init(FuSolokeyDevice *self)
|
||||
fu_device_add_protocol(FU_DEVICE(self), "com.solokeys");
|
||||
fu_device_set_name(FU_DEVICE(self), "Solo Secure");
|
||||
fu_device_set_summary(FU_DEVICE(self), "Open source FIDO2 security key");
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_SOLOKEY_FIRMWARE);
|
||||
fu_device_add_icon(FU_DEVICE(self), "applications-internet");
|
||||
}
|
||||
|
||||
@ -542,7 +531,6 @@ fu_solokey_device_class_init(FuSolokeyDeviceClass *klass)
|
||||
{
|
||||
FuDeviceClass *klass_device = FU_DEVICE_CLASS(klass);
|
||||
klass_device->write_firmware = fu_solokey_device_write_firmware;
|
||||
klass_device->prepare_firmware = fu_solokey_device_prepare_firmware;
|
||||
klass_device->setup = fu_solokey_device_setup;
|
||||
klass_device->open = fu_solokey_device_open;
|
||||
klass_device->close = fu_solokey_device_close;
|
||||
|
@ -167,18 +167,6 @@ fu_vli_usbhub_msp430_device_detach(FuDevice *device, FuProgress *progress, GErro
|
||||
return fu_vli_usbhub_i2c_check_status(status, error);
|
||||
}
|
||||
|
||||
static FuFirmware *
|
||||
fu_vli_usbhub_msp430_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_ihex_firmware_new();
|
||||
if (!fu_firmware_tokenize(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
guint8 command;
|
||||
guint8 buf[0x40];
|
||||
@ -339,6 +327,7 @@ fu_vli_usbhub_msp430_device_init(FuVliUsbhubMsp430Device *self)
|
||||
fu_device_set_version_format(FU_DEVICE(self), FWUPD_VERSION_FORMAT_PAIR);
|
||||
fu_device_set_logical_id(FU_DEVICE(self), "I2C");
|
||||
fu_device_set_summary(FU_DEVICE(self), "I²C dock management device");
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_IHEX_FIRMWARE);
|
||||
|
||||
/* the MSP device reboot takes down the entire hub for ~60 seconds */
|
||||
fu_device_set_remove_delay(FU_DEVICE(self), 120 * 1000);
|
||||
@ -352,7 +341,6 @@ fu_vli_usbhub_msp430_device_class_init(FuVliUsbhubMsp430DeviceClass *klass)
|
||||
klass_device->setup = fu_vli_usbhub_msp430_device_setup;
|
||||
klass_device->detach = fu_vli_usbhub_msp430_device_detach;
|
||||
klass_device->write_firmware = fu_vli_usbhub_msp430_device_write_firmware;
|
||||
klass_device->prepare_firmware = fu_vli_usbhub_msp430_device_prepare_firmware;
|
||||
klass_device->set_progress = fu_vli_usbhub_msp430_device_set_progress;
|
||||
}
|
||||
|
||||
|
@ -197,18 +197,6 @@ fu_wacom_device_set_version_bootloader(FuWacomDevice *self, GError **error)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static FuFirmware *
|
||||
fu_wacom_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_ihex_firmware_new();
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_wacom_device_write_firmware(FuDevice *device,
|
||||
FuFirmware *firmware,
|
||||
@ -362,6 +350,7 @@ fu_wacom_device_init(FuWacomDevice *self)
|
||||
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_INTERNAL);
|
||||
fu_device_add_internal_flag(FU_DEVICE(self), FU_DEVICE_INTERNAL_FLAG_REPLUG_MATCH_GUID);
|
||||
fu_device_set_version_format(FU_DEVICE(self), FWUPD_VERSION_FORMAT_PAIR);
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_IHEX_FIRMWARE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -369,7 +358,6 @@ fu_wacom_device_class_init(FuWacomDeviceClass *klass)
|
||||
{
|
||||
FuDeviceClass *klass_device = FU_DEVICE_CLASS(klass);
|
||||
klass_device->to_string = fu_wacom_device_to_string;
|
||||
klass_device->prepare_firmware = fu_wacom_device_prepare_firmware;
|
||||
klass_device->write_firmware = fu_wacom_device_write_firmware;
|
||||
klass_device->attach = fu_wacom_device_attach;
|
||||
klass_device->detach = fu_wacom_device_detach;
|
||||
|
@ -457,18 +457,6 @@ fu_wac_device_switch_to_flash_loader(FuWacDevice *self, GError **error)
|
||||
error);
|
||||
}
|
||||
|
||||
static FuFirmware *
|
||||
fu_wac_device_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_wac_firmware_new();
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_wac_device_write_firmware(FuDevice *device,
|
||||
FuFirmware *firmware,
|
||||
@ -923,6 +911,7 @@ fu_wac_device_init(FuWacDevice *self)
|
||||
fu_device_set_version_format(FU_DEVICE(self), FWUPD_VERSION_FORMAT_BCD);
|
||||
fu_device_set_install_duration(FU_DEVICE(self), 10);
|
||||
fu_device_set_remove_delay(FU_DEVICE(self), FU_DEVICE_REMOVE_DELAY_RE_ENUMERATE);
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_WAC_FIRMWARE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -942,7 +931,6 @@ fu_wac_device_class_init(FuWacDeviceClass *klass)
|
||||
GObjectClass *object_class = G_OBJECT_CLASS(klass);
|
||||
FuDeviceClass *klass_device = FU_DEVICE_CLASS(klass);
|
||||
object_class->finalize = fu_wac_device_finalize;
|
||||
klass_device->prepare_firmware = fu_wac_device_prepare_firmware;
|
||||
klass_device->write_firmware = fu_wac_device_write_firmware;
|
||||
klass_device->to_string = fu_wac_device_to_string;
|
||||
klass_device->setup = fu_wac_device_setup;
|
||||
|
@ -19,18 +19,6 @@ struct _FuWacModuleTouch {
|
||||
|
||||
G_DEFINE_TYPE(FuWacModuleTouch, fu_wac_module_touch, FU_TYPE_WAC_MODULE)
|
||||
|
||||
static FuFirmware *
|
||||
fu_wac_module_touch_prepare_firmware(FuDevice *device,
|
||||
GBytes *fw,
|
||||
FwupdInstallFlags flags,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(FuFirmware) firmware = fu_ihex_firmware_new();
|
||||
if (!fu_firmware_parse(firmware, fw, flags, error))
|
||||
return NULL;
|
||||
return g_steal_pointer(&firmware);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
fu_wac_module_touch_write_firmware(FuDevice *device,
|
||||
FuFirmware *firmware,
|
||||
@ -128,13 +116,13 @@ fu_wac_module_touch_init(FuWacModuleTouch *self)
|
||||
{
|
||||
fu_device_add_flag(FU_DEVICE(self), FWUPD_DEVICE_FLAG_UPDATABLE);
|
||||
fu_device_set_install_duration(FU_DEVICE(self), 30);
|
||||
fu_device_set_firmware_gtype(FU_DEVICE(self), FU_TYPE_IHEX_FIRMWARE);
|
||||
}
|
||||
|
||||
static void
|
||||
fu_wac_module_touch_class_init(FuWacModuleTouchClass *klass)
|
||||
{
|
||||
FuDeviceClass *klass_device = FU_DEVICE_CLASS(klass);
|
||||
klass_device->prepare_firmware = fu_wac_module_touch_prepare_firmware;
|
||||
klass_device->write_firmware = fu_wac_module_touch_write_firmware;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user