fwupd/plugins/synaptics-prometheus/fu-synaprom-firmware.h
Richard Hughes 7afd7cba0d Use FuFirmware as a container for firmware images
In many plugins we've wanted to use ->prepare_firmware() to parse the firmware
ahead of ->detach() and ->write_firmware() but this has the limitation that it
can only return a single blob of data.

For many devices, multiple binary blobs are required from one parsed image,
for instance providing signatures, config and data blobs that have to be pushed
to the device in different way.

This also means we parse the firmware *before* we ask the user to detach.

Break the internal FuDevice API to support these firmware types as they become
more popular.

This also allows us to move the Intel HEX and SREC parsing out of the dfu plugin
as they are used by a few plugins now, and resolving symbols between plugins
isn't exactly awesome.
2019-08-08 13:10:57 +01:00

45 lines
1.2 KiB
C

/*
* Copyright (C) 2019 Richard Hughes <richard@hughsie.com>
* Copyright (C) 2019 Synaptics Inc
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include "fu-firmware.h"
G_BEGIN_DECLS
#define FU_TYPE_SYNAPROM_FIRMWARE (fu_synaprom_firmware_get_type ())
G_DECLARE_FINAL_TYPE (FuSynapromFirmware, fu_synaprom_firmware, FU, SYNAPROM_FIRMWARE, FuFirmware)
#define FU_SYNAPROM_FIRMWARE_TAG_MFW_HEADER 0x0001
#define FU_SYNAPROM_FIRMWARE_TAG_MFW_PAYLOAD 0x0002
#define FU_SYNAPROM_FIRMWARE_TAG_CFG_HEADER 0x0003
#define FU_SYNAPROM_FIRMWARE_TAG_CFG_PAYLOAD 0x0004
/* le */
typedef struct __attribute__((packed)) {
guint32 product;
guint32 id; /* MFW unique id used for compat verification */
guint32 buildtime; /* unix-style build time */
guint32 buildnum; /* build number */
guint8 vmajor; /* major version */
guint8 vminor; /* minor version */
guint8 unused[6];
} FuSynapromFirmwareMfwHeader;
/* le */
typedef struct __attribute__((packed)) {
guint32 product;
guint32 id1; /* verification ID */
guint32 id2; /* verification ID */
guint16 version; /* config version */
guint8 unused[2];
} FuSynapromFirmwareCfgHeader;
FuFirmware *fu_synaprom_firmware_new (void);
G_END_DECLS