/* auto-generated, do not modify */
#include "config.h"

#include "fu-vli-struct.h"
#include "fu-byte-array.h"
#include "fu-mem-private.h"
#include "fu-string.h"

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

const gchar *
fu_vli_device_kind_to_string(FuVliDeviceKind val)
{
    if (val == FU_VLI_DEVICE_KIND_UNKNOWN)
        return "unknown";
    if (val == FU_VLI_DEVICE_KIND_VL100)
        return "vl100";
    if (val == FU_VLI_DEVICE_KIND_VL101)
        return "vl101";
    if (val == FU_VLI_DEVICE_KIND_VL102)
        return "vl102";
    if (val == FU_VLI_DEVICE_KIND_VL103)
        return "vl103";
    if (val == FU_VLI_DEVICE_KIND_VL104)
        return "vl104";
    if (val == FU_VLI_DEVICE_KIND_VL105)
        return "vl105";
    if (val == FU_VLI_DEVICE_KIND_VL106)
        return "vl106";
    if (val == FU_VLI_DEVICE_KIND_VL107)
        return "vl107";
    if (val == FU_VLI_DEVICE_KIND_VL108)
        return "vl108";
    if (val == FU_VLI_DEVICE_KIND_VL109)
        return "vl109";
    if (val == FU_VLI_DEVICE_KIND_VL120)
        return "vl120";
    if (val == FU_VLI_DEVICE_KIND_VL122)
        return "vl122";
    if (val == FU_VLI_DEVICE_KIND_VL210)
        return "vl210";
    if (val == FU_VLI_DEVICE_KIND_VL211)
        return "vl211";
    if (val == FU_VLI_DEVICE_KIND_VL212)
        return "vl212";
    if (val == FU_VLI_DEVICE_KIND_VL650)
        return "vl650";
    if (val == FU_VLI_DEVICE_KIND_VL810)
        return "vl810";
    if (val == FU_VLI_DEVICE_KIND_VL811)
        return "vl811";
    if (val == FU_VLI_DEVICE_KIND_VL811PB0)
        return "vl811pb0";
    if (val == FU_VLI_DEVICE_KIND_VL811PB3)
        return "vl811pb3";
    if (val == FU_VLI_DEVICE_KIND_VL812B0)
        return "vl812b0";
    if (val == FU_VLI_DEVICE_KIND_VL812B3)
        return "vl812b3";
    if (val == FU_VLI_DEVICE_KIND_VL812Q4S)
        return "vl812q4s";
    if (val == FU_VLI_DEVICE_KIND_VL813)
        return "vl813";
    if (val == FU_VLI_DEVICE_KIND_VL815)
        return "vl815";
    if (val == FU_VLI_DEVICE_KIND_VL817)
        return "vl817";
    if (val == FU_VLI_DEVICE_KIND_VL817S)
        return "vl817s";
    if (val == FU_VLI_DEVICE_KIND_VL819Q7)
        return "vl819q7";
    if (val == FU_VLI_DEVICE_KIND_VL819Q8)
        return "vl819q8";
    if (val == FU_VLI_DEVICE_KIND_VL820Q7)
        return "vl820q7";
    if (val == FU_VLI_DEVICE_KIND_VL820Q8)
        return "vl820q8";
    if (val == FU_VLI_DEVICE_KIND_VL821Q7)
        return "vl821q7";
    if (val == FU_VLI_DEVICE_KIND_VL821Q8)
        return "vl821q8";
    if (val == FU_VLI_DEVICE_KIND_VL822Q5)
        return "vl822q5";
    if (val == FU_VLI_DEVICE_KIND_VL822Q7)
        return "vl822q7";
    if (val == FU_VLI_DEVICE_KIND_VL822Q8)
        return "vl822q8";
    if (val == FU_VLI_DEVICE_KIND_VL822T)
        return "vl822t";
    if (val == FU_VLI_DEVICE_KIND_VL822C0)
        return "vl822c0";
    if (val == FU_VLI_DEVICE_KIND_VL830)
        return "vl830";
    if (val == FU_VLI_DEVICE_KIND_VL832)
        return "vl832";
    if (val == FU_VLI_DEVICE_KIND_MSP430)
        return "msp430";
    if (val == FU_VLI_DEVICE_KIND_PS186)
        return "ps186";
    if (val == FU_VLI_DEVICE_KIND_RTD21XX)
        return "rtd21xx";
    return NULL;
}
FuVliDeviceKind
fu_vli_device_kind_from_string(const gchar *val)
{
    if (g_strcmp0(val, "unknown") == 0)
        return FU_VLI_DEVICE_KIND_UNKNOWN;
    if (g_strcmp0(val, "vl100") == 0)
        return FU_VLI_DEVICE_KIND_VL100;
    if (g_strcmp0(val, "vl101") == 0)
        return FU_VLI_DEVICE_KIND_VL101;
    if (g_strcmp0(val, "vl102") == 0)
        return FU_VLI_DEVICE_KIND_VL102;
    if (g_strcmp0(val, "vl103") == 0)
        return FU_VLI_DEVICE_KIND_VL103;
    if (g_strcmp0(val, "vl104") == 0)
        return FU_VLI_DEVICE_KIND_VL104;
    if (g_strcmp0(val, "vl105") == 0)
        return FU_VLI_DEVICE_KIND_VL105;
    if (g_strcmp0(val, "vl106") == 0)
        return FU_VLI_DEVICE_KIND_VL106;
    if (g_strcmp0(val, "vl107") == 0)
        return FU_VLI_DEVICE_KIND_VL107;
    if (g_strcmp0(val, "vl108") == 0)
        return FU_VLI_DEVICE_KIND_VL108;
    if (g_strcmp0(val, "vl109") == 0)
        return FU_VLI_DEVICE_KIND_VL109;
    if (g_strcmp0(val, "vl120") == 0)
        return FU_VLI_DEVICE_KIND_VL120;
    if (g_strcmp0(val, "vl122") == 0)
        return FU_VLI_DEVICE_KIND_VL122;
    if (g_strcmp0(val, "vl210") == 0)
        return FU_VLI_DEVICE_KIND_VL210;
    if (g_strcmp0(val, "vl211") == 0)
        return FU_VLI_DEVICE_KIND_VL211;
    if (g_strcmp0(val, "vl212") == 0)
        return FU_VLI_DEVICE_KIND_VL212;
    if (g_strcmp0(val, "vl650") == 0)
        return FU_VLI_DEVICE_KIND_VL650;
    if (g_strcmp0(val, "vl810") == 0)
        return FU_VLI_DEVICE_KIND_VL810;
    if (g_strcmp0(val, "vl811") == 0)
        return FU_VLI_DEVICE_KIND_VL811;
    if (g_strcmp0(val, "vl811pb0") == 0)
        return FU_VLI_DEVICE_KIND_VL811PB0;
    if (g_strcmp0(val, "vl811pb3") == 0)
        return FU_VLI_DEVICE_KIND_VL811PB3;
    if (g_strcmp0(val, "vl812b0") == 0)
        return FU_VLI_DEVICE_KIND_VL812B0;
    if (g_strcmp0(val, "vl812b3") == 0)
        return FU_VLI_DEVICE_KIND_VL812B3;
    if (g_strcmp0(val, "vl812q4s") == 0)
        return FU_VLI_DEVICE_KIND_VL812Q4S;
    if (g_strcmp0(val, "vl813") == 0)
        return FU_VLI_DEVICE_KIND_VL813;
    if (g_strcmp0(val, "vl815") == 0)
        return FU_VLI_DEVICE_KIND_VL815;
    if (g_strcmp0(val, "vl817") == 0)
        return FU_VLI_DEVICE_KIND_VL817;
    if (g_strcmp0(val, "vl817s") == 0)
        return FU_VLI_DEVICE_KIND_VL817S;
    if (g_strcmp0(val, "vl819q7") == 0)
        return FU_VLI_DEVICE_KIND_VL819Q7;
    if (g_strcmp0(val, "vl819q8") == 0)
        return FU_VLI_DEVICE_KIND_VL819Q8;
    if (g_strcmp0(val, "vl820q7") == 0)
        return FU_VLI_DEVICE_KIND_VL820Q7;
    if (g_strcmp0(val, "vl820q8") == 0)
        return FU_VLI_DEVICE_KIND_VL820Q8;
    if (g_strcmp0(val, "vl821q7") == 0)
        return FU_VLI_DEVICE_KIND_VL821Q7;
    if (g_strcmp0(val, "vl821q8") == 0)
        return FU_VLI_DEVICE_KIND_VL821Q8;
    if (g_strcmp0(val, "vl822q5") == 0)
        return FU_VLI_DEVICE_KIND_VL822Q5;
    if (g_strcmp0(val, "vl822q7") == 0)
        return FU_VLI_DEVICE_KIND_VL822Q7;
    if (g_strcmp0(val, "vl822q8") == 0)
        return FU_VLI_DEVICE_KIND_VL822Q8;
    if (g_strcmp0(val, "vl822t") == 0)
        return FU_VLI_DEVICE_KIND_VL822T;
    if (g_strcmp0(val, "vl822c0") == 0)
        return FU_VLI_DEVICE_KIND_VL822C0;
    if (g_strcmp0(val, "vl830") == 0)
        return FU_VLI_DEVICE_KIND_VL830;
    if (g_strcmp0(val, "vl832") == 0)
        return FU_VLI_DEVICE_KIND_VL832;
    if (g_strcmp0(val, "msp430") == 0)
        return FU_VLI_DEVICE_KIND_MSP430;
    if (g_strcmp0(val, "ps186") == 0)
        return FU_VLI_DEVICE_KIND_PS186;
    if (g_strcmp0(val, "rtd21xx") == 0)
        return FU_VLI_DEVICE_KIND_RTD21XX;
    return FU_VLI_DEVICE_KIND_UNKNOWN;
}
/* getters */
/**
 * fu_struct_vli_pd_hdr_get_fwver: (skip):
 **/
guint32
fu_struct_vli_pd_hdr_get_fwver(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->data + 0, G_BIG_ENDIAN);
}
/**
 * fu_struct_vli_pd_hdr_get_vid: (skip):
 **/
guint16
fu_struct_vli_pd_hdr_get_vid(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 4, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_vli_pd_hdr_get_pid: (skip):
 **/
guint16
fu_struct_vli_pd_hdr_get_pid(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 6, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_vli_pd_hdr_to_string: (skip):
 **/
static gchar *
fu_struct_vli_pd_hdr_to_string(const GByteArray *st)
{
    g_autoptr(GString) str = g_string_new("VliPdHdr:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  fwver: 0x%x\n",
                           (guint) fu_struct_vli_pd_hdr_get_fwver(st));
    g_string_append_printf(str, "  vid: 0x%x\n",
                           (guint) fu_struct_vli_pd_hdr_get_vid(st));
    g_string_append_printf(str, "  pid: 0x%x\n",
                           (guint) fu_struct_vli_pd_hdr_get_pid(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
/**
 * fu_struct_vli_pd_hdr_parse: (skip):
 **/
GByteArray *
fu_struct_vli_pd_hdr_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(GByteArray) st = g_byte_array_new();
    g_autofree gchar *str = NULL;
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 8, error)) {
        g_prefix_error(error, "invalid struct VliPdHdr: ");
        return NULL;
    }
    g_byte_array_append(st, buf + offset, 8);
    str = fu_struct_vli_pd_hdr_to_string(st);
    g_debug("%s", str);
    return g_steal_pointer(&st);
}
/* getters */
/**
 * fu_struct_vli_usbhub_hdr_get_dev_id: (skip):
 **/
guint16
fu_struct_vli_usbhub_hdr_get_dev_id(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 0, G_BIG_ENDIAN);
}
/**
 * fu_struct_vli_usbhub_hdr_get_strapping1: (skip):
 **/
guint8
fu_struct_vli_usbhub_hdr_get_strapping1(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[2];
}
/**
 * fu_struct_vli_usbhub_hdr_get_strapping2: (skip):
 **/
guint8
fu_struct_vli_usbhub_hdr_get_strapping2(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[3];
}
/**
 * fu_struct_vli_usbhub_hdr_get_usb3_fw_addr: (skip):
 **/
guint16
fu_struct_vli_usbhub_hdr_get_usb3_fw_addr(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 4, G_BIG_ENDIAN);
}
/**
 * fu_struct_vli_usbhub_hdr_get_usb3_fw_sz: (skip):
 **/
guint16
fu_struct_vli_usbhub_hdr_get_usb3_fw_sz(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 6, G_BIG_ENDIAN);
}
/**
 * fu_struct_vli_usbhub_hdr_get_usb2_fw_addr: (skip):
 **/
guint16
fu_struct_vli_usbhub_hdr_get_usb2_fw_addr(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 8, G_BIG_ENDIAN);
}
/**
 * fu_struct_vli_usbhub_hdr_get_usb2_fw_sz: (skip):
 **/
guint16
fu_struct_vli_usbhub_hdr_get_usb2_fw_sz(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint16(st->data + 10, G_BIG_ENDIAN);
}
/**
 * fu_struct_vli_usbhub_hdr_get_usb3_fw_addr_high: (skip):
 **/
guint8
fu_struct_vli_usbhub_hdr_get_usb3_fw_addr_high(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[12];
}
/**
 * fu_struct_vli_usbhub_hdr_get_usb3_fw_sz_high: (skip):
 **/
guint8
fu_struct_vli_usbhub_hdr_get_usb3_fw_sz_high(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[13];
}
/**
 * fu_struct_vli_usbhub_hdr_get_usb2_fw_addr_high: (skip):
 **/
guint8
fu_struct_vli_usbhub_hdr_get_usb2_fw_addr_high(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[16];
}
/**
 * fu_struct_vli_usbhub_hdr_get_inverse_pe41: (skip):
 **/
guint8
fu_struct_vli_usbhub_hdr_get_inverse_pe41(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[27];
}
/**
 * fu_struct_vli_usbhub_hdr_get_prev_ptr: (skip):
 **/
guint8
fu_struct_vli_usbhub_hdr_get_prev_ptr(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[28];
}
/**
 * fu_struct_vli_usbhub_hdr_get_next_ptr: (skip):
 **/
guint8
fu_struct_vli_usbhub_hdr_get_next_ptr(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[29];
}
/**
 * fu_struct_vli_usbhub_hdr_get_variant: (skip):
 **/
guint8
fu_struct_vli_usbhub_hdr_get_variant(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[30];
}
/**
 * fu_struct_vli_usbhub_hdr_get_checksum: (skip):
 **/
guint8
fu_struct_vli_usbhub_hdr_get_checksum(const GByteArray *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return st->data[31];
}

/* setters */
/**
 * fu_struct_vli_usbhub_hdr_set_dev_id: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_dev_id(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 0, value, G_BIG_ENDIAN);
}
/**
 * fu_struct_vli_usbhub_hdr_set_strapping1: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_strapping1(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[2] = value;
}
/**
 * fu_struct_vli_usbhub_hdr_set_strapping2: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_strapping2(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[3] = value;
}
/**
 * fu_struct_vli_usbhub_hdr_set_usb3_fw_addr: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_usb3_fw_addr(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 4, value, G_BIG_ENDIAN);
}
/**
 * fu_struct_vli_usbhub_hdr_set_usb3_fw_sz: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_usb3_fw_sz(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 6, value, G_BIG_ENDIAN);
}
/**
 * fu_struct_vli_usbhub_hdr_set_usb2_fw_addr: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_usb2_fw_addr(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 8, value, G_BIG_ENDIAN);
}
/**
 * fu_struct_vli_usbhub_hdr_set_usb2_fw_sz: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_usb2_fw_sz(GByteArray *st, guint16 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint16(st->data + 10, value, G_BIG_ENDIAN);
}
/**
 * fu_struct_vli_usbhub_hdr_set_usb3_fw_addr_high: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_usb3_fw_addr_high(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[12] = value;
}
/**
 * fu_struct_vli_usbhub_hdr_set_usb3_fw_sz_high: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_usb3_fw_sz_high(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[13] = value;
}
/**
 * fu_struct_vli_usbhub_hdr_set_usb2_fw_addr_high: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_usb2_fw_addr_high(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[16] = value;
}
/**
 * fu_struct_vli_usbhub_hdr_set_inverse_pe41: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_inverse_pe41(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[27] = value;
}
/**
 * fu_struct_vli_usbhub_hdr_set_prev_ptr: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_prev_ptr(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[28] = value;
}
/**
 * fu_struct_vli_usbhub_hdr_set_next_ptr: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_next_ptr(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[29] = value;
}
/**
 * fu_struct_vli_usbhub_hdr_set_variant: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_variant(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[30] = value;
}
/**
 * fu_struct_vli_usbhub_hdr_set_checksum: (skip):
 **/
void
fu_struct_vli_usbhub_hdr_set_checksum(GByteArray *st, guint8 value)
{
    g_return_if_fail(st != NULL);
    st->data[31] = value;
}
/**
 * fu_struct_vli_usbhub_hdr_new: (skip):
 **/
GByteArray *
fu_struct_vli_usbhub_hdr_new(void)
{
    GByteArray *st = g_byte_array_sized_new(32);
    fu_byte_array_set_size(st, 32, 0x0);
    return st;
}
/**
 * fu_struct_vli_usbhub_hdr_to_string: (skip):
 **/
gchar *
fu_struct_vli_usbhub_hdr_to_string(const GByteArray *st)
{
    g_autoptr(GString) str = g_string_new("VliUsbhubHdr:\n");
    g_return_val_if_fail(st != NULL, NULL);
    g_string_append_printf(str, "  dev_id: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_dev_id(st));
    g_string_append_printf(str, "  strapping1: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_strapping1(st));
    g_string_append_printf(str, "  strapping2: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_strapping2(st));
    g_string_append_printf(str, "  usb3_fw_addr: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_usb3_fw_addr(st));
    g_string_append_printf(str, "  usb3_fw_sz: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_usb3_fw_sz(st));
    g_string_append_printf(str, "  usb2_fw_addr: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_usb2_fw_addr(st));
    g_string_append_printf(str, "  usb2_fw_sz: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_usb2_fw_sz(st));
    g_string_append_printf(str, "  usb3_fw_addr_high: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_usb3_fw_addr_high(st));
    g_string_append_printf(str, "  usb3_fw_sz_high: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_usb3_fw_sz_high(st));
    g_string_append_printf(str, "  usb2_fw_addr_high: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_usb2_fw_addr_high(st));
    g_string_append_printf(str, "  inverse_pe41: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_inverse_pe41(st));
    g_string_append_printf(str, "  prev_ptr: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_prev_ptr(st));
    g_string_append_printf(str, "  next_ptr: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_next_ptr(st));
    g_string_append_printf(str, "  variant: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_variant(st));
    g_string_append_printf(str, "  checksum: 0x%x\n",
                           (guint) fu_struct_vli_usbhub_hdr_get_checksum(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
/**
 * fu_struct_vli_usbhub_hdr_parse: (skip):
 **/
GByteArray *
fu_struct_vli_usbhub_hdr_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(GByteArray) st = g_byte_array_new();
    g_autofree gchar *str = NULL;
    g_return_val_if_fail(buf != NULL, NULL);
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
    if (!fu_memchk_read(bufsz, offset, 32, error)) {
        g_prefix_error(error, "invalid struct VliUsbhubHdr: ");
        return NULL;
    }
    g_byte_array_append(st, buf + offset, 32);
    str = fu_struct_vli_usbhub_hdr_to_string(st);
    g_debug("%s", str);
    return g_steal_pointer(&st);
}
