/*
 * This file is auto-generated, do not modify!
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#include "config.h"

#include <glib.h>

#include "fu-synaptics-prometheus-struct.h"
#include "fu-byte-array.h"
#include "fu-bytes.h"
#include "fu-mem-private.h"
#include "fu-string.h"

#ifdef G_LOG_DOMAIN
  #undef G_LOG_DOMAIN
#endif
#define G_LOG_DOMAIN "FuStruct"


/**
 * fu_synaptics_prometheus_product_to_string:
 * @val: value, e.g. %FU_SYNAPTICS_PROMETHEUS_PRODUCT_PROMETHEUSPBL
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 **/
static const gchar *
fu_synaptics_prometheus_product_to_string(FuSynapticsPrometheusProduct val)
{
    if (val == FU_SYNAPTICS_PROMETHEUS_PRODUCT_PROMETHEUS)
        return "prometheus";
    if (val == FU_SYNAPTICS_PROMETHEUS_PRODUCT_PROMETHEUSPBL)
        return "prometheuspbl";
    if (val == FU_SYNAPTICS_PROMETHEUS_PRODUCT_PROMETHEUSMSBL)
        return "prometheusmsbl";
    if (val == FU_SYNAPTICS_PROMETHEUS_PRODUCT_TRITON)
        return "triton";
    if (val == FU_SYNAPTICS_PROMETHEUS_PRODUCT_TRITONPBL)
        return "tritonpbl";
    if (val == FU_SYNAPTICS_PROMETHEUS_PRODUCT_TRITONMSBL)
        return "tritonmsbl";
    return NULL;
}

/**
 * fu_synaptics_prometheus_result_to_string:
 * @val: value, e.g. %FU_SYNAPTICS_PROMETHEUS_RESULT_GEN_OPERATION_CANCELED
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 **/
const gchar *
fu_synaptics_prometheus_result_to_string(FuSynapticsPrometheusResult val)
{
    if (val == FU_SYNAPTICS_PROMETHEUS_RESULT_OK)
        return "ok";
    if (val == FU_SYNAPTICS_PROMETHEUS_RESULT_GEN_OPERATION_CANCELED)
        return "gen-operation-canceled";
    if (val == FU_SYNAPTICS_PROMETHEUS_RESULT_GEN_INVALID)
        return "gen-invalid";
    if (val == FU_SYNAPTICS_PROMETHEUS_RESULT_GEN_BAD_PARAM)
        return "gen-bad-param";
    if (val == FU_SYNAPTICS_PROMETHEUS_RESULT_GEN_NULL_POINTER)
        return "gen-null-pointer";
    if (val == FU_SYNAPTICS_PROMETHEUS_RESULT_GEN_UNEXPECTED_FORMAT)
        return "gen-unexpected-format";
    if (val == FU_SYNAPTICS_PROMETHEUS_RESULT_GEN_TIMEOUT)
        return "gen-timeout";
    if (val == FU_SYNAPTICS_PROMETHEUS_RESULT_GEN_OBJECT_DOESNT_EXIST)
        return "gen-object-doesnt-exist";
    if (val == FU_SYNAPTICS_PROMETHEUS_RESULT_GEN_ERROR)
        return "gen-error";
    if (val == FU_SYNAPTICS_PROMETHEUS_RESULT_SENSOR_MALFUNCTIONED)
        return "sensor-malfunctioned";
    if (val == FU_SYNAPTICS_PROMETHEUS_RESULT_SYS_OUT_OF_MEMORY)
        return "sys-out-of-memory";
    return NULL;
}


/**
 * fu_synaptics_prometheus_firmware_tag_to_string:
 * @val: value, e.g. %FU_SYNAPTICS_PROMETHEUS_FIRMWARE_TAG_MFW_UPDATE_PAYLOAD
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 **/
const gchar *
fu_synaptics_prometheus_firmware_tag_to_string(FuSynapticsPrometheusFirmwareTag val)
{
    if (val == FU_SYNAPTICS_PROMETHEUS_FIRMWARE_TAG_MFW_UPDATE_HEADER)
        return "mfw-update-header";
    if (val == FU_SYNAPTICS_PROMETHEUS_FIRMWARE_TAG_MFW_UPDATE_PAYLOAD)
        return "mfw-update-payload";
    if (val == FU_SYNAPTICS_PROMETHEUS_FIRMWARE_TAG_CFG_UPDATE_HEADER)
        return "cfg-update-header";
    if (val == FU_SYNAPTICS_PROMETHEUS_FIRMWARE_TAG_CFG_UPDATE_PAYLOAD)
        return "cfg-update-payload";
    return NULL;
}
/**
 * fu_struct_synaptics_prometheus_request_ref: (skip):
 **/
FuStructSynapticsPrometheusRequest *
fu_struct_synaptics_prometheus_request_ref(FuStructSynapticsPrometheusRequest *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_synaptics_prometheus_request_unref: (skip):
 **/
void
fu_struct_synaptics_prometheus_request_unref(FuStructSynapticsPrometheusRequest *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructSynapticsPrometheusRequest refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_synaptics_prometheus_request_new_internal: (skip):
 **/
static FuStructSynapticsPrometheusRequest *
fu_struct_synaptics_prometheus_request_new_internal(void)
{
    FuStructSynapticsPrometheusRequest *st = g_new0(FuStructSynapticsPrometheusRequest, 1);
    st->refcount = 1;
    return st;
}

/* getters */

/* setters */
/**
 * fu_struct_synaptics_prometheus_request_set_cmd: (skip):
 **/
void
fu_struct_synaptics_prometheus_request_set_cmd(FuStructSynapticsPrometheusRequest *st, FuSynapticsPrometheusCmd value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[0] = value;
}
/**
 * fu_struct_synaptics_prometheus_request_new: (skip):
 **/
FuStructSynapticsPrometheusRequest *
fu_struct_synaptics_prometheus_request_new(void)
{
    FuStructSynapticsPrometheusRequest *st = fu_struct_synaptics_prometheus_request_new_internal();
    st->buf = g_byte_array_sized_new(1);
    fu_byte_array_set_size(st->buf, 1, 0x0);
    return st;
}
/**
 * fu_struct_synaptics_prometheus_reply_generic_ref: (skip):
 **/
FuStructSynapticsPrometheusReplyGeneric *
fu_struct_synaptics_prometheus_reply_generic_ref(FuStructSynapticsPrometheusReplyGeneric *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_synaptics_prometheus_reply_generic_unref: (skip):
 **/
void
fu_struct_synaptics_prometheus_reply_generic_unref(FuStructSynapticsPrometheusReplyGeneric *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructSynapticsPrometheusReplyGeneric refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_synaptics_prometheus_reply_generic_new_internal: (skip):
 **/
static FuStructSynapticsPrometheusReplyGeneric *
fu_struct_synaptics_prometheus_reply_generic_new_internal(void)
{
    FuStructSynapticsPrometheusReplyGeneric *st = g_new0(FuStructSynapticsPrometheusReplyGeneric, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_synaptics_prometheus_reply_generic_get_status: (skip):
 **/
guint16
fu_struct_synaptics_prometheus_reply_generic_get_status(const FuStructSynapticsPrometheusReplyGeneric *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 0, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_synaptics_prometheus_reply_generic_to_string: (skip):
 **/
static gchar *
fu_struct_synaptics_prometheus_reply_generic_to_string(const FuStructSynapticsPrometheusReplyGeneric *st)
{
    g_autoptr(GString) str = g_string_new("FuStructSynapticsPrometheusReplyGeneric:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  status: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_generic_get_status(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
static gboolean
fu_struct_synaptics_prometheus_reply_generic_validate_internal(FuStructSynapticsPrometheusReplyGeneric *st, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    return TRUE;
}
static gboolean
fu_struct_synaptics_prometheus_reply_generic_parse_internal(FuStructSynapticsPrometheusReplyGeneric *st, GError **error)
{
    if (g_log_get_debug_enabled()) {
        g_autofree gchar *str = fu_struct_synaptics_prometheus_reply_generic_to_string(st);
        g_debug("%s", str);
    }
    if (!fu_struct_synaptics_prometheus_reply_generic_validate_internal(st, error))
        return FALSE;
    return TRUE;
}

/**
 * fu_struct_synaptics_prometheus_reply_generic_parse: (skip):
 **/
FuStructSynapticsPrometheusReplyGeneric *
fu_struct_synaptics_prometheus_reply_generic_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(FuStructSynapticsPrometheusReplyGeneric) st = fu_struct_synaptics_prometheus_reply_generic_new_internal();
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 2, error)) {
        g_prefix_error_literal(error, "invalid struct FuStructSynapticsPrometheusReplyGeneric: ");
        return NULL;
    }
    st->buf = g_byte_array_new();
    g_byte_array_append(st->buf, buf + offset, 2);
    if (!fu_struct_synaptics_prometheus_reply_generic_parse_internal(st, error))
        return NULL;
    return g_steal_pointer(&st);
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_ref: (skip):
 **/
FuStructSynapticsPrometheusReplyGetVersion *
fu_struct_synaptics_prometheus_reply_get_version_ref(FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_unref: (skip):
 **/
void
fu_struct_synaptics_prometheus_reply_get_version_unref(FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructSynapticsPrometheusReplyGetVersion refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_new_internal: (skip):
 **/
static FuStructSynapticsPrometheusReplyGetVersion *
fu_struct_synaptics_prometheus_reply_get_version_new_internal(void)
{
    FuStructSynapticsPrometheusReplyGetVersion *st = g_new0(FuStructSynapticsPrometheusReplyGetVersion, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_status: (skip):
 **/
guint16
fu_struct_synaptics_prometheus_reply_get_version_get_status(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 0, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_buildtime: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_reply_get_version_get_buildtime(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 2, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_buildnum: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_reply_get_version_get_buildnum(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 6, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_vmajor: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_reply_get_version_get_vmajor(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[10];
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_vminor: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_reply_get_version_get_vminor(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[11];
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_target: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_reply_get_version_get_target(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[12];
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_product: (skip):
 **/
FuSynapticsPrometheusProduct
fu_struct_synaptics_prometheus_reply_get_version_get_product(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[13];
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_siliconrev: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_reply_get_version_get_siliconrev(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[14];
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_formalrel: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_reply_get_version_get_formalrel(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[15];
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_platform: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_reply_get_version_get_platform(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[16];
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_patch: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_reply_get_version_get_patch(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[17];
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_serial_number: (skip):
 **/
const guint8 *
fu_struct_synaptics_prometheus_reply_get_version_get_serial_number(const FuStructSynapticsPrometheusReplyGetVersion *st, gsize *bufsz)
{
    g_return_val_if_fail(st != NULL, NULL);
    if (bufsz != NULL)
        *bufsz = 6;
    return st->buf->data + 18;
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_security0: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_reply_get_version_get_security0(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[24];
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_security1: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_reply_get_version_get_security1(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[25];
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_patchsig: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_reply_get_version_get_patchsig(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 26, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_iface: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_reply_get_version_get_iface(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[30];
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_otpsig: (skip):
 **/
const guint8 *
fu_struct_synaptics_prometheus_reply_get_version_get_otpsig(const FuStructSynapticsPrometheusReplyGetVersion *st, gsize *bufsz)
{
    g_return_val_if_fail(st != NULL, NULL);
    if (bufsz != NULL)
        *bufsz = 3;
    return st->buf->data + 31;
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_otpspare1: (skip):
 **/
guint16
fu_struct_synaptics_prometheus_reply_get_version_get_otpspare1(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 34, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_reply_get_version_get_device_type: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_reply_get_version_get_device_type(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[37];
}

/* setters */
/**
 * fu_struct_synaptics_prometheus_reply_get_version_to_string: (skip):
 **/
static gchar *
fu_struct_synaptics_prometheus_reply_get_version_to_string(const FuStructSynapticsPrometheusReplyGetVersion *st)
{
    g_autoptr(GString) str = g_string_new("FuStructSynapticsPrometheusReplyGetVersion:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  status: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_status(st));
    g_string_append_printf(str, "  buildtime: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_buildtime(st));
    g_string_append_printf(str, "  buildnum: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_buildnum(st));
    g_string_append_printf(str, "  vmajor: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_vmajor(st));
    g_string_append_printf(str, "  vminor: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_vminor(st));
    g_string_append_printf(str, "  target: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_target(st));
    {
        const gchar *tmp = fu_synaptics_prometheus_product_to_string(fu_struct_synaptics_prometheus_reply_get_version_get_product(st));
        if (tmp != NULL) {
            g_string_append_printf(str, "  product: 0x%x [%s]\n", (guint) fu_struct_synaptics_prometheus_reply_get_version_get_product(st), tmp);
        } else {
            g_string_append_printf(str, "  product: 0x%x\n", (guint) fu_struct_synaptics_prometheus_reply_get_version_get_product(st));
        }
    }
    g_string_append_printf(str, "  siliconrev: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_siliconrev(st));
    g_string_append_printf(str, "  formalrel: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_formalrel(st));
    g_string_append_printf(str, "  platform: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_platform(st));
    g_string_append_printf(str, "  patch: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_patch(st));
    {
        gsize bufsz = 0;
        const guint8 *buf = fu_struct_synaptics_prometheus_reply_get_version_get_serial_number(st, &bufsz);
        g_autoptr(GString) tmp = g_string_new(NULL);
        for (gsize i = 0; i < bufsz; i++)
            g_string_append_printf(tmp, "%02X", buf[i]);
        g_string_append_printf(str, "  serial_number: 0x%s\n", tmp->str);
    }
    g_string_append_printf(str, "  security0: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_security0(st));
    g_string_append_printf(str, "  security1: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_security1(st));
    g_string_append_printf(str, "  patchsig: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_patchsig(st));
    g_string_append_printf(str, "  iface: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_iface(st));
    {
        gsize bufsz = 0;
        const guint8 *buf = fu_struct_synaptics_prometheus_reply_get_version_get_otpsig(st, &bufsz);
        g_autoptr(GString) tmp = g_string_new(NULL);
        for (gsize i = 0; i < bufsz; i++)
            g_string_append_printf(tmp, "%02X", buf[i]);
        g_string_append_printf(str, "  otpsig: 0x%s\n", tmp->str);
    }
    g_string_append_printf(str, "  otpspare1: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_otpspare1(st));
    g_string_append_printf(str, "  device_type: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_get_version_get_device_type(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
static gboolean
fu_struct_synaptics_prometheus_reply_get_version_validate_internal(FuStructSynapticsPrometheusReplyGetVersion *st, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    return TRUE;
}
static gboolean
fu_struct_synaptics_prometheus_reply_get_version_parse_internal(FuStructSynapticsPrometheusReplyGetVersion *st, GError **error)
{
    if (g_log_get_debug_enabled()) {
        g_autofree gchar *str = fu_struct_synaptics_prometheus_reply_get_version_to_string(st);
        g_debug("%s", str);
    }
    if (!fu_struct_synaptics_prometheus_reply_get_version_validate_internal(st, error))
        return FALSE;
    return TRUE;
}

/**
 * fu_struct_synaptics_prometheus_reply_get_version_parse: (skip):
 **/
FuStructSynapticsPrometheusReplyGetVersion *
fu_struct_synaptics_prometheus_reply_get_version_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(FuStructSynapticsPrometheusReplyGetVersion) st = fu_struct_synaptics_prometheus_reply_get_version_new_internal();
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 38, error)) {
        g_prefix_error_literal(error, "invalid struct FuStructSynapticsPrometheusReplyGetVersion: ");
        return NULL;
    }
    st->buf = g_byte_array_new();
    g_byte_array_append(st->buf, buf + offset, 38);
    if (!fu_struct_synaptics_prometheus_reply_get_version_parse_internal(st, error))
        return NULL;
    return g_steal_pointer(&st);
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_ref: (skip):
 **/
FuStructSynapticsPrometheusMfwHdr *
fu_struct_synaptics_prometheus_mfw_hdr_ref(FuStructSynapticsPrometheusMfwHdr *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_unref: (skip):
 **/
void
fu_struct_synaptics_prometheus_mfw_hdr_unref(FuStructSynapticsPrometheusMfwHdr *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructSynapticsPrometheusMfwHdr refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_new_internal: (skip):
 **/
static FuStructSynapticsPrometheusMfwHdr *
fu_struct_synaptics_prometheus_mfw_hdr_new_internal(void)
{
    FuStructSynapticsPrometheusMfwHdr *st = g_new0(FuStructSynapticsPrometheusMfwHdr, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_get_product: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_mfw_hdr_get_product(const FuStructSynapticsPrometheusMfwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_get_id: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_mfw_hdr_get_id(const FuStructSynapticsPrometheusMfwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 4, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_get_buildtime: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_mfw_hdr_get_buildtime(const FuStructSynapticsPrometheusMfwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 8, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_get_buildnum: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_mfw_hdr_get_buildnum(const FuStructSynapticsPrometheusMfwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 12, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_get_vmajor: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_mfw_hdr_get_vmajor(const FuStructSynapticsPrometheusMfwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[16];
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_get_vminor: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_mfw_hdr_get_vminor(const FuStructSynapticsPrometheusMfwHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[17];
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_get_unused: (skip):
 **/
const guint8 *
fu_struct_synaptics_prometheus_mfw_hdr_get_unused(const FuStructSynapticsPrometheusMfwHdr *st, gsize *bufsz)
{
    g_return_val_if_fail(st != NULL, NULL);
    if (bufsz != NULL)
        *bufsz = 6;
    return st->buf->data + 18;
}

/* setters */
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_set_product: (skip):
 **/
void
fu_struct_synaptics_prometheus_mfw_hdr_set_product(FuStructSynapticsPrometheusMfwHdr *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->buf->data + 0, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_set_id: (skip):
 **/
void
fu_struct_synaptics_prometheus_mfw_hdr_set_id(FuStructSynapticsPrometheusMfwHdr *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->buf->data + 4, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_set_buildtime: (skip):
 **/
void
fu_struct_synaptics_prometheus_mfw_hdr_set_buildtime(FuStructSynapticsPrometheusMfwHdr *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->buf->data + 8, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_set_buildnum: (skip):
 **/
void
fu_struct_synaptics_prometheus_mfw_hdr_set_buildnum(FuStructSynapticsPrometheusMfwHdr *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->buf->data + 12, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_set_vmajor: (skip):
 **/
void
fu_struct_synaptics_prometheus_mfw_hdr_set_vmajor(FuStructSynapticsPrometheusMfwHdr *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[16] = value;
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_set_vminor: (skip):
 **/
void
fu_struct_synaptics_prometheus_mfw_hdr_set_vminor(FuStructSynapticsPrometheusMfwHdr *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[17] = value;
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_set_unused: (skip):
 **/
gboolean
fu_struct_synaptics_prometheus_mfw_hdr_set_unused(FuStructSynapticsPrometheusMfwHdr *st, const guint8 *buf, gsize bufsz, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    g_return_val_if_fail(buf != NULL, FALSE);
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
    return fu_memcpy_safe(st->buf->data, st->buf->len, 18, buf, bufsz, 0x0, bufsz, error);
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_new: (skip):
 **/
FuStructSynapticsPrometheusMfwHdr *
fu_struct_synaptics_prometheus_mfw_hdr_new(void)
{
    FuStructSynapticsPrometheusMfwHdr *st = fu_struct_synaptics_prometheus_mfw_hdr_new_internal();
    st->buf = g_byte_array_sized_new(24);
    fu_byte_array_set_size(st->buf, 24, 0x0);
    fu_struct_synaptics_prometheus_mfw_hdr_set_id(st, 0xFF);
    fu_struct_synaptics_prometheus_mfw_hdr_set_buildtime(st, 0xFF);
    fu_struct_synaptics_prometheus_mfw_hdr_set_buildnum(st, 0xFF);
    fu_struct_synaptics_prometheus_mfw_hdr_set_vmajor(st, 10);
    fu_struct_synaptics_prometheus_mfw_hdr_set_vminor(st, 1);
    return st;
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_to_string: (skip):
 **/
static gchar *
fu_struct_synaptics_prometheus_mfw_hdr_to_string(const FuStructSynapticsPrometheusMfwHdr *st)
{
    g_autoptr(GString) str = g_string_new("FuStructSynapticsPrometheusMfwHdr:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  product: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_mfw_hdr_get_product(st));
    g_string_append_printf(str, "  id: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_mfw_hdr_get_id(st));
    g_string_append_printf(str, "  buildtime: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_mfw_hdr_get_buildtime(st));
    g_string_append_printf(str, "  buildnum: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_mfw_hdr_get_buildnum(st));
    g_string_append_printf(str, "  vmajor: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_mfw_hdr_get_vmajor(st));
    g_string_append_printf(str, "  vminor: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_mfw_hdr_get_vminor(st));
    {
        gsize bufsz = 0;
        const guint8 *buf = fu_struct_synaptics_prometheus_mfw_hdr_get_unused(st, &bufsz);
        g_autoptr(GString) tmp = g_string_new(NULL);
        for (gsize i = 0; i < bufsz; i++)
            g_string_append_printf(tmp, "%02X", buf[i]);
        g_string_append_printf(str, "  unused: 0x%s\n", tmp->str);
    }
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
static gboolean
fu_struct_synaptics_prometheus_mfw_hdr_validate_internal(FuStructSynapticsPrometheusMfwHdr *st, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    return TRUE;
}
static gboolean
fu_struct_synaptics_prometheus_mfw_hdr_parse_internal(FuStructSynapticsPrometheusMfwHdr *st, GError **error)
{
    if (g_log_get_debug_enabled()) {
        g_autofree gchar *str = fu_struct_synaptics_prometheus_mfw_hdr_to_string(st);
        g_debug("%s", str);
    }
    if (!fu_struct_synaptics_prometheus_mfw_hdr_validate_internal(st, error))
        return FALSE;
    return TRUE;
}
/**
 * fu_struct_synaptics_prometheus_mfw_hdr_parse_stream: (skip):
 **/
FuStructSynapticsPrometheusMfwHdr *
fu_struct_synaptics_prometheus_mfw_hdr_parse_stream(GInputStream *stream, gsize offset, GError **error)
{
    g_autoptr(FuStructSynapticsPrometheusMfwHdr) st = fu_struct_synaptics_prometheus_mfw_hdr_new_internal();
    st->buf = fu_input_stream_read_byte_array(stream, offset, 24, NULL, error);
    if (st->buf == NULL) {
        g_prefix_error(error, "FuStructSynapticsPrometheusMfwHdr failed read of 0x%x: ", (guint) 24);
        return NULL;
    }
    if (st->buf->len != 24) {
        g_set_error(error,
                    FWUPD_ERROR,
                    FWUPD_ERROR_INVALID_DATA,
                    "FuStructSynapticsPrometheusMfwHdr requested 0x%x and got 0x%x",
                    (guint) 24,
                    (guint) st->buf->len);
        return NULL;
    }
    if (!fu_struct_synaptics_prometheus_mfw_hdr_parse_internal(st, error))
        return NULL;
    return g_steal_pointer(&st);
}
/**
 * fu_struct_synaptics_prometheus_hdr_ref: (skip):
 **/
FuStructSynapticsPrometheusHdr *
fu_struct_synaptics_prometheus_hdr_ref(FuStructSynapticsPrometheusHdr *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_synaptics_prometheus_hdr_unref: (skip):
 **/
void
fu_struct_synaptics_prometheus_hdr_unref(FuStructSynapticsPrometheusHdr *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructSynapticsPrometheusHdr refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_synaptics_prometheus_hdr_new_internal: (skip):
 **/
static FuStructSynapticsPrometheusHdr *
fu_struct_synaptics_prometheus_hdr_new_internal(void)
{
    FuStructSynapticsPrometheusHdr *st = g_new0(FuStructSynapticsPrometheusHdr, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_synaptics_prometheus_hdr_get_tag: (skip):
 **/
FuSynapticsPrometheusFirmwareTag
fu_struct_synaptics_prometheus_hdr_get_tag(const FuStructSynapticsPrometheusHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 0, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_hdr_get_bufsz: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_hdr_get_bufsz(const FuStructSynapticsPrometheusHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 2, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_synaptics_prometheus_hdr_set_tag: (skip):
 **/
void
fu_struct_synaptics_prometheus_hdr_set_tag(FuStructSynapticsPrometheusHdr *st, FuSynapticsPrometheusFirmwareTag value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->buf->data + 0, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_hdr_set_bufsz: (skip):
 **/
void
fu_struct_synaptics_prometheus_hdr_set_bufsz(FuStructSynapticsPrometheusHdr *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->buf->data + 2, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_hdr_new: (skip):
 **/
FuStructSynapticsPrometheusHdr *
fu_struct_synaptics_prometheus_hdr_new(void)
{
    FuStructSynapticsPrometheusHdr *st = fu_struct_synaptics_prometheus_hdr_new_internal();
    st->buf = g_byte_array_sized_new(6);
    fu_byte_array_set_size(st->buf, 6, 0x0);
    return st;
}
/**
 * fu_struct_synaptics_prometheus_hdr_to_string: (skip):
 **/
static gchar *
fu_struct_synaptics_prometheus_hdr_to_string(const FuStructSynapticsPrometheusHdr *st)
{
    g_autoptr(GString) str = g_string_new("FuStructSynapticsPrometheusHdr:\n");
    g_return_val_if_fail(st != NULL, NULL);
    {
        const gchar *tmp = fu_synaptics_prometheus_firmware_tag_to_string(fu_struct_synaptics_prometheus_hdr_get_tag(st));
        if (tmp != NULL) {
            g_string_append_printf(str, "  tag: 0x%x [%s]\n", (guint) fu_struct_synaptics_prometheus_hdr_get_tag(st), tmp);
        } else {
            g_string_append_printf(str, "  tag: 0x%x\n", (guint) fu_struct_synaptics_prometheus_hdr_get_tag(st));
        }
    }
    g_string_append_printf(str, "  bufsz: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_hdr_get_bufsz(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
static gboolean
fu_struct_synaptics_prometheus_hdr_validate_internal(FuStructSynapticsPrometheusHdr *st, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    return TRUE;
}
static gboolean
fu_struct_synaptics_prometheus_hdr_parse_internal(FuStructSynapticsPrometheusHdr *st, GError **error)
{
    if (g_log_get_debug_enabled()) {
        g_autofree gchar *str = fu_struct_synaptics_prometheus_hdr_to_string(st);
        g_debug("%s", str);
    }
    if (!fu_struct_synaptics_prometheus_hdr_validate_internal(st, error))
        return FALSE;
    return TRUE;
}
/**
 * fu_struct_synaptics_prometheus_hdr_parse_stream: (skip):
 **/
FuStructSynapticsPrometheusHdr *
fu_struct_synaptics_prometheus_hdr_parse_stream(GInputStream *stream, gsize offset, GError **error)
{
    g_autoptr(FuStructSynapticsPrometheusHdr) st = fu_struct_synaptics_prometheus_hdr_new_internal();
    st->buf = fu_input_stream_read_byte_array(stream, offset, 6, NULL, error);
    if (st->buf == NULL) {
        g_prefix_error(error, "FuStructSynapticsPrometheusHdr failed read of 0x%x: ", (guint) 6);
        return NULL;
    }
    if (st->buf->len != 6) {
        g_set_error(error,
                    FWUPD_ERROR,
                    FWUPD_ERROR_INVALID_DATA,
                    "FuStructSynapticsPrometheusHdr requested 0x%x and got 0x%x",
                    (guint) 6,
                    (guint) st->buf->len);
        return NULL;
    }
    if (!fu_struct_synaptics_prometheus_hdr_parse_internal(st, error))
        return NULL;
    return g_steal_pointer(&st);
}
/**
 * fu_struct_synaptics_prometheus_cfg_hdr_ref: (skip):
 **/
FuStructSynapticsPrometheusCfgHdr *
fu_struct_synaptics_prometheus_cfg_hdr_ref(FuStructSynapticsPrometheusCfgHdr *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_synaptics_prometheus_cfg_hdr_unref: (skip):
 **/
void
fu_struct_synaptics_prometheus_cfg_hdr_unref(FuStructSynapticsPrometheusCfgHdr *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructSynapticsPrometheusCfgHdr refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_synaptics_prometheus_cfg_hdr_new_internal: (skip):
 **/
static FuStructSynapticsPrometheusCfgHdr *
fu_struct_synaptics_prometheus_cfg_hdr_new_internal(void)
{
    FuStructSynapticsPrometheusCfgHdr *st = g_new0(FuStructSynapticsPrometheusCfgHdr, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_synaptics_prometheus_cfg_hdr_get_product: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_cfg_hdr_get_product(const FuStructSynapticsPrometheusCfgHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_cfg_hdr_get_id1: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_cfg_hdr_get_id1(const FuStructSynapticsPrometheusCfgHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 4, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_cfg_hdr_get_id2: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_cfg_hdr_get_id2(const FuStructSynapticsPrometheusCfgHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 8, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_cfg_hdr_get_version: (skip):
 **/
guint16
fu_struct_synaptics_prometheus_cfg_hdr_get_version(const FuStructSynapticsPrometheusCfgHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 12, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_synaptics_prometheus_cfg_hdr_to_string: (skip):
 **/
static gchar *
fu_struct_synaptics_prometheus_cfg_hdr_to_string(const FuStructSynapticsPrometheusCfgHdr *st)
{
    g_autoptr(GString) str = g_string_new("FuStructSynapticsPrometheusCfgHdr:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  product: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_cfg_hdr_get_product(st));
    g_string_append_printf(str, "  id1: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_cfg_hdr_get_id1(st));
    g_string_append_printf(str, "  id2: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_cfg_hdr_get_id2(st));
    g_string_append_printf(str, "  version: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_cfg_hdr_get_version(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
static gboolean
fu_struct_synaptics_prometheus_cfg_hdr_validate_internal(FuStructSynapticsPrometheusCfgHdr *st, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    return TRUE;
}
static gboolean
fu_struct_synaptics_prometheus_cfg_hdr_parse_internal(FuStructSynapticsPrometheusCfgHdr *st, GError **error)
{
    if (g_log_get_debug_enabled()) {
        g_autofree gchar *str = fu_struct_synaptics_prometheus_cfg_hdr_to_string(st);
        g_debug("%s", str);
    }
    if (!fu_struct_synaptics_prometheus_cfg_hdr_validate_internal(st, error))
        return FALSE;
    return TRUE;
}
/**
 * fu_struct_synaptics_prometheus_cfg_hdr_parse_stream: (skip):
 **/
FuStructSynapticsPrometheusCfgHdr *
fu_struct_synaptics_prometheus_cfg_hdr_parse_stream(GInputStream *stream, gsize offset, GError **error)
{
    g_autoptr(FuStructSynapticsPrometheusCfgHdr) st = fu_struct_synaptics_prometheus_cfg_hdr_new_internal();
    st->buf = fu_input_stream_read_byte_array(stream, offset, 16, NULL, error);
    if (st->buf == NULL) {
        g_prefix_error(error, "FuStructSynapticsPrometheusCfgHdr failed read of 0x%x: ", (guint) 16);
        return NULL;
    }
    if (st->buf->len != 16) {
        g_set_error(error,
                    FWUPD_ERROR,
                    FWUPD_ERROR_INVALID_DATA,
                    "FuStructSynapticsPrometheusCfgHdr requested 0x%x and got 0x%x",
                    (guint) 16,
                    (guint) st->buf->len);
        return NULL;
    }
    if (!fu_struct_synaptics_prometheus_cfg_hdr_parse_internal(st, error))
        return NULL;
    return g_steal_pointer(&st);
}
/**
 * fu_struct_synaptics_prometheus_iota_config_version_ref: (skip):
 **/
FuStructSynapticsPrometheusIotaConfigVersion *
fu_struct_synaptics_prometheus_iota_config_version_ref(FuStructSynapticsPrometheusIotaConfigVersion *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_synaptics_prometheus_iota_config_version_unref: (skip):
 **/
void
fu_struct_synaptics_prometheus_iota_config_version_unref(FuStructSynapticsPrometheusIotaConfigVersion *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructSynapticsPrometheusIotaConfigVersion refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_synaptics_prometheus_iota_config_version_new_internal: (skip):
 **/
static FuStructSynapticsPrometheusIotaConfigVersion *
fu_struct_synaptics_prometheus_iota_config_version_new_internal(void)
{
    FuStructSynapticsPrometheusIotaConfigVersion *st = g_new0(FuStructSynapticsPrometheusIotaConfigVersion, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_synaptics_prometheus_iota_config_version_get_config_id1: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_iota_config_version_get_config_id1(const FuStructSynapticsPrometheusIotaConfigVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_iota_config_version_get_config_id2: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_iota_config_version_get_config_id2(const FuStructSynapticsPrometheusIotaConfigVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 4, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_iota_config_version_get_version: (skip):
 **/
guint16
fu_struct_synaptics_prometheus_iota_config_version_get_version(const FuStructSynapticsPrometheusIotaConfigVersion *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 8, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_synaptics_prometheus_iota_config_version_to_string: (skip):
 **/
static gchar *
fu_struct_synaptics_prometheus_iota_config_version_to_string(const FuStructSynapticsPrometheusIotaConfigVersion *st)
{
    g_autoptr(GString) str = g_string_new("FuStructSynapticsPrometheusIotaConfigVersion:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  config_id1: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_iota_config_version_get_config_id1(st));
    g_string_append_printf(str, "  config_id2: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_iota_config_version_get_config_id2(st));
    g_string_append_printf(str, "  version: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_iota_config_version_get_version(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
static gboolean
fu_struct_synaptics_prometheus_iota_config_version_validate_internal(FuStructSynapticsPrometheusIotaConfigVersion *st, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    return TRUE;
}
static gboolean
fu_struct_synaptics_prometheus_iota_config_version_parse_internal(FuStructSynapticsPrometheusIotaConfigVersion *st, GError **error)
{
    if (g_log_get_debug_enabled()) {
        g_autofree gchar *str = fu_struct_synaptics_prometheus_iota_config_version_to_string(st);
        g_debug("%s", str);
    }
    if (!fu_struct_synaptics_prometheus_iota_config_version_validate_internal(st, error))
        return FALSE;
    return TRUE;
}

/**
 * fu_struct_synaptics_prometheus_iota_config_version_parse: (skip):
 **/
FuStructSynapticsPrometheusIotaConfigVersion *
fu_struct_synaptics_prometheus_iota_config_version_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(FuStructSynapticsPrometheusIotaConfigVersion) st = fu_struct_synaptics_prometheus_iota_config_version_new_internal();
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 16, error)) {
        g_prefix_error_literal(error, "invalid struct FuStructSynapticsPrometheusIotaConfigVersion: ");
        return NULL;
    }
    st->buf = g_byte_array_new();
    g_byte_array_append(st->buf, buf + offset, 16);
    if (!fu_struct_synaptics_prometheus_iota_config_version_parse_internal(st, error))
        return NULL;
    return g_steal_pointer(&st);
}
/**
 * fu_struct_synaptics_prometheus_reply_iota_find_hdr_ref: (skip):
 **/
FuStructSynapticsPrometheusReplyIotaFindHdr *
fu_struct_synaptics_prometheus_reply_iota_find_hdr_ref(FuStructSynapticsPrometheusReplyIotaFindHdr *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_synaptics_prometheus_reply_iota_find_hdr_unref: (skip):
 **/
void
fu_struct_synaptics_prometheus_reply_iota_find_hdr_unref(FuStructSynapticsPrometheusReplyIotaFindHdr *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructSynapticsPrometheusReplyIotaFindHdr refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_synaptics_prometheus_reply_iota_find_hdr_new_internal: (skip):
 **/
static FuStructSynapticsPrometheusReplyIotaFindHdr *
fu_struct_synaptics_prometheus_reply_iota_find_hdr_new_internal(void)
{
    FuStructSynapticsPrometheusReplyIotaFindHdr *st = g_new0(FuStructSynapticsPrometheusReplyIotaFindHdr, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_synaptics_prometheus_reply_iota_find_hdr_get_status: (skip):
 **/
guint16
fu_struct_synaptics_prometheus_reply_iota_find_hdr_get_status(const FuStructSynapticsPrometheusReplyIotaFindHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 0, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_reply_iota_find_hdr_get_fullsize: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_reply_iota_find_hdr_get_fullsize(const FuStructSynapticsPrometheusReplyIotaFindHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 2, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_reply_iota_find_hdr_get_nbytes: (skip):
 **/
guint16
fu_struct_synaptics_prometheus_reply_iota_find_hdr_get_nbytes(const FuStructSynapticsPrometheusReplyIotaFindHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 6, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_reply_iota_find_hdr_get_itype: (skip):
 **/
guint16
fu_struct_synaptics_prometheus_reply_iota_find_hdr_get_itype(const FuStructSynapticsPrometheusReplyIotaFindHdr *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 8, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_synaptics_prometheus_reply_iota_find_hdr_to_string: (skip):
 **/
static gchar *
fu_struct_synaptics_prometheus_reply_iota_find_hdr_to_string(const FuStructSynapticsPrometheusReplyIotaFindHdr *st)
{
    g_autoptr(GString) str = g_string_new("FuStructSynapticsPrometheusReplyIotaFindHdr:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  status: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_iota_find_hdr_get_status(st));
    g_string_append_printf(str, "  fullsize: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_iota_find_hdr_get_fullsize(st));
    g_string_append_printf(str, "  nbytes: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_iota_find_hdr_get_nbytes(st));
    g_string_append_printf(str, "  itype: 0x%x\n",
                           (guint) fu_struct_synaptics_prometheus_reply_iota_find_hdr_get_itype(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
static gboolean
fu_struct_synaptics_prometheus_reply_iota_find_hdr_validate_internal(FuStructSynapticsPrometheusReplyIotaFindHdr *st, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    return TRUE;
}
static gboolean
fu_struct_synaptics_prometheus_reply_iota_find_hdr_parse_internal(FuStructSynapticsPrometheusReplyIotaFindHdr *st, GError **error)
{
    if (g_log_get_debug_enabled()) {
        g_autofree gchar *str = fu_struct_synaptics_prometheus_reply_iota_find_hdr_to_string(st);
        g_debug("%s", str);
    }
    if (!fu_struct_synaptics_prometheus_reply_iota_find_hdr_validate_internal(st, error))
        return FALSE;
    return TRUE;
}

/**
 * fu_struct_synaptics_prometheus_reply_iota_find_hdr_parse: (skip):
 **/
FuStructSynapticsPrometheusReplyIotaFindHdr *
fu_struct_synaptics_prometheus_reply_iota_find_hdr_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(FuStructSynapticsPrometheusReplyIotaFindHdr) st = fu_struct_synaptics_prometheus_reply_iota_find_hdr_new_internal();
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 10, error)) {
        g_prefix_error_literal(error, "invalid struct FuStructSynapticsPrometheusReplyIotaFindHdr: ");
        return NULL;
    }
    st->buf = g_byte_array_new();
    g_byte_array_append(st->buf, buf + offset, 10);
    if (!fu_struct_synaptics_prometheus_reply_iota_find_hdr_parse_internal(st, error))
        return NULL;
    return g_steal_pointer(&st);
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_ref: (skip):
 **/
FuStructSynapticsPrometheusCmdIotaFind *
fu_struct_synaptics_prometheus_cmd_iota_find_ref(FuStructSynapticsPrometheusCmdIotaFind *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_unref: (skip):
 **/
void
fu_struct_synaptics_prometheus_cmd_iota_find_unref(FuStructSynapticsPrometheusCmdIotaFind *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructSynapticsPrometheusCmdIotaFind refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_new_internal: (skip):
 **/
static FuStructSynapticsPrometheusCmdIotaFind *
fu_struct_synaptics_prometheus_cmd_iota_find_new_internal(void)
{
    FuStructSynapticsPrometheusCmdIotaFind *st = g_new0(FuStructSynapticsPrometheusCmdIotaFind, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_get_itype: (skip):
 **/
guint16
fu_struct_synaptics_prometheus_cmd_iota_find_get_itype(const FuStructSynapticsPrometheusCmdIotaFind *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 0, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_get_flags: (skip):
 **/
guint16
fu_struct_synaptics_prometheus_cmd_iota_find_get_flags(const FuStructSynapticsPrometheusCmdIotaFind *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->buf->data + 2, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_get_maxniotas: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_cmd_iota_find_get_maxniotas(const FuStructSynapticsPrometheusCmdIotaFind *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[4];
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_get_firstidx: (skip):
 **/
guint8
fu_struct_synaptics_prometheus_cmd_iota_find_get_firstidx(const FuStructSynapticsPrometheusCmdIotaFind *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->buf->data[5];
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_get_offset: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_cmd_iota_find_get_offset(const FuStructSynapticsPrometheusCmdIotaFind *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 8, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_get_nbytes: (skip):
 **/
guint32
fu_struct_synaptics_prometheus_cmd_iota_find_get_nbytes(const FuStructSynapticsPrometheusCmdIotaFind *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 12, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_set_itype: (skip):
 **/
void
fu_struct_synaptics_prometheus_cmd_iota_find_set_itype(FuStructSynapticsPrometheusCmdIotaFind *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->buf->data + 0, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_set_flags: (skip):
 **/
void
fu_struct_synaptics_prometheus_cmd_iota_find_set_flags(FuStructSynapticsPrometheusCmdIotaFind *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->buf->data + 2, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_set_maxniotas: (skip):
 **/
void
fu_struct_synaptics_prometheus_cmd_iota_find_set_maxniotas(FuStructSynapticsPrometheusCmdIotaFind *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[4] = value;
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_set_firstidx: (skip):
 **/
void
fu_struct_synaptics_prometheus_cmd_iota_find_set_firstidx(FuStructSynapticsPrometheusCmdIotaFind *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->buf->data[5] = value;
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_set_offset: (skip):
 **/
void
fu_struct_synaptics_prometheus_cmd_iota_find_set_offset(FuStructSynapticsPrometheusCmdIotaFind *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->buf->data + 8, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_set_nbytes: (skip):
 **/
void
fu_struct_synaptics_prometheus_cmd_iota_find_set_nbytes(FuStructSynapticsPrometheusCmdIotaFind *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->buf->data + 12, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_synaptics_prometheus_cmd_iota_find_new: (skip):
 **/
FuStructSynapticsPrometheusCmdIotaFind *
fu_struct_synaptics_prometheus_cmd_iota_find_new(void)
{
    FuStructSynapticsPrometheusCmdIotaFind *st = fu_struct_synaptics_prometheus_cmd_iota_find_new_internal();
    st->buf = g_byte_array_sized_new(16);
    fu_byte_array_set_size(st->buf, 16, 0x0);
    return st;
}
