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

#include "config.h"

#include <glib.h>

#include "fu-logitech-bulkcontroller-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_logitech_bulkcontroller_device_state_to_string:
 * @val: value, e.g. %FU_LOGITECH_BULKCONTROLLER_DEVICE_STATE_OFFLINE
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 **/
const gchar *
fu_logitech_bulkcontroller_device_state_to_string(FuLogitechBulkcontrollerDeviceState val)
{
    if (val == FU_LOGITECH_BULKCONTROLLER_DEVICE_STATE_OFFLINE)
        return "offline";
    if (val == FU_LOGITECH_BULKCONTROLLER_DEVICE_STATE_ONLINE)
        return "online";
    if (val == FU_LOGITECH_BULKCONTROLLER_DEVICE_STATE_IDLE)
        return "idle";
    if (val == FU_LOGITECH_BULKCONTROLLER_DEVICE_STATE_IN_USE)
        return "in-use";
    if (val == FU_LOGITECH_BULKCONTROLLER_DEVICE_STATE_AUDIO_ONLY)
        return "audio-only";
    if (val == FU_LOGITECH_BULKCONTROLLER_DEVICE_STATE_ENUMERATING)
        return "enumerating";
    return NULL;
}

/**
 * fu_logitech_bulkcontroller_update_state_to_string:
 * @val: value, e.g. %FU_LOGITECH_BULKCONTROLLER_UPDATE_STATE_CURRENT
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 **/
const gchar *
fu_logitech_bulkcontroller_update_state_to_string(FuLogitechBulkcontrollerUpdateState val)
{
    if (val == FU_LOGITECH_BULKCONTROLLER_UPDATE_STATE_CURRENT)
        return "current";
    if (val == FU_LOGITECH_BULKCONTROLLER_UPDATE_STATE_AVAILABLE)
        return "available";
    if (val == FU_LOGITECH_BULKCONTROLLER_UPDATE_STATE_STARTING)
        return "starting";
    if (val == FU_LOGITECH_BULKCONTROLLER_UPDATE_STATE_DOWNLOADING)
        return "downloading";
    if (val == FU_LOGITECH_BULKCONTROLLER_UPDATE_STATE_READY)
        return "ready";
    if (val == FU_LOGITECH_BULKCONTROLLER_UPDATE_STATE_UPDATING)
        return "updating";
    if (val == FU_LOGITECH_BULKCONTROLLER_UPDATE_STATE_SCHEDULED)
        return "scheduled";
    if (val == FU_LOGITECH_BULKCONTROLLER_UPDATE_STATE_ERROR)
        return "error";
    return NULL;
}

/**
 * fu_logitech_bulkcontroller_cmd_to_string:
 * @val: value, e.g. %FU_LOGITECH_BULKCONTROLLER_CMD_INIT
 *
 * Converts an enumerated value to a string.
 *
 * Returns: identifier string
 **/
const gchar *
fu_logitech_bulkcontroller_cmd_to_string(FuLogitechBulkcontrollerCmd val)
{
    if (val == FU_LOGITECH_BULKCONTROLLER_CMD_CHECK_BUFFERSIZE)
        return "check-buffersize";
    if (val == FU_LOGITECH_BULKCONTROLLER_CMD_INIT)
        return "init";
    if (val == FU_LOGITECH_BULKCONTROLLER_CMD_START_TRANSFER)
        return "start-transfer";
    if (val == FU_LOGITECH_BULKCONTROLLER_CMD_DATA_TRANSFER)
        return "data-transfer";
    if (val == FU_LOGITECH_BULKCONTROLLER_CMD_END_TRANSFER)
        return "end-transfer";
    if (val == FU_LOGITECH_BULKCONTROLLER_CMD_UNINIT)
        return "uninit";
    if (val == FU_LOGITECH_BULKCONTROLLER_CMD_BUFFER_READ)
        return "buffer-read";
    if (val == FU_LOGITECH_BULKCONTROLLER_CMD_BUFFER_WRITE)
        return "buffer-write";
    if (val == FU_LOGITECH_BULKCONTROLLER_CMD_UNINIT_BUFFER)
        return "uninit-buffer";
    if (val == FU_LOGITECH_BULKCONTROLLER_CMD_ACK)
        return "ack";
    if (val == FU_LOGITECH_BULKCONTROLLER_CMD_TIMEOUT)
        return "timeout";
    if (val == FU_LOGITECH_BULKCONTROLLER_CMD_NACK)
        return "nack";
    return NULL;
}

/**
 * fu_struct_logitech_bulkcontroller_send_sync_req_ref: (skip):
 **/
FuStructLogitechBulkcontrollerSendSyncReq *
fu_struct_logitech_bulkcontroller_send_sync_req_ref(FuStructLogitechBulkcontrollerSendSyncReq *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_req_unref: (skip):
 **/
void
fu_struct_logitech_bulkcontroller_send_sync_req_unref(FuStructLogitechBulkcontrollerSendSyncReq *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructLogitechBulkcontrollerSendSyncReq refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_req_new_internal: (skip):
 **/
static FuStructLogitechBulkcontrollerSendSyncReq *
fu_struct_logitech_bulkcontroller_send_sync_req_new_internal(void)
{
    FuStructLogitechBulkcontrollerSendSyncReq *st = g_new0(FuStructLogitechBulkcontrollerSendSyncReq, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_logitech_bulkcontroller_send_sync_req_get_cmd: (skip):
 **/
FuLogitechBulkcontrollerCmd
fu_struct_logitech_bulkcontroller_send_sync_req_get_cmd(const FuStructLogitechBulkcontrollerSendSyncReq *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_req_get_payload_length: (skip):
 **/
guint32
fu_struct_logitech_bulkcontroller_send_sync_req_get_payload_length(const FuStructLogitechBulkcontrollerSendSyncReq *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 4, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_req_get_sequence_id: (skip):
 **/
guint32
fu_struct_logitech_bulkcontroller_send_sync_req_get_sequence_id(const FuStructLogitechBulkcontrollerSendSyncReq *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 8, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_logitech_bulkcontroller_send_sync_req_set_cmd: (skip):
 **/
void
fu_struct_logitech_bulkcontroller_send_sync_req_set_cmd(FuStructLogitechBulkcontrollerSendSyncReq *st, FuLogitechBulkcontrollerCmd value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->buf->data + 0, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_req_set_payload_length: (skip):
 **/
void
fu_struct_logitech_bulkcontroller_send_sync_req_set_payload_length(FuStructLogitechBulkcontrollerSendSyncReq *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->buf->data + 4, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_req_set_sequence_id: (skip):
 **/
void
fu_struct_logitech_bulkcontroller_send_sync_req_set_sequence_id(FuStructLogitechBulkcontrollerSendSyncReq *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->buf->data + 8, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_req_new: (skip):
 **/
FuStructLogitechBulkcontrollerSendSyncReq *
fu_struct_logitech_bulkcontroller_send_sync_req_new(void)
{
    FuStructLogitechBulkcontrollerSendSyncReq *st = fu_struct_logitech_bulkcontroller_send_sync_req_new_internal();
    st->buf = g_byte_array_sized_new(12);
    fu_byte_array_set_size(st->buf, 12, 0x0);
    return st;
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_req_to_string: (skip):
 **/
gchar *
fu_struct_logitech_bulkcontroller_send_sync_req_to_string(const FuStructLogitechBulkcontrollerSendSyncReq *st)
{
    g_autoptr(GString) str = g_string_new("FuStructLogitechBulkcontrollerSendSyncReq:\n");
    g_return_val_if_fail(st != NULL, NULL);
    {
        const gchar *tmp = fu_logitech_bulkcontroller_cmd_to_string(fu_struct_logitech_bulkcontroller_send_sync_req_get_cmd(st));
        if (tmp != NULL) {
            g_string_append_printf(str, "  cmd: 0x%x [%s]\n", (guint) fu_struct_logitech_bulkcontroller_send_sync_req_get_cmd(st), tmp);
        } else {
            g_string_append_printf(str, "  cmd: 0x%x\n", (guint) fu_struct_logitech_bulkcontroller_send_sync_req_get_cmd(st));
        }
    }
    g_string_append_printf(str, "  payload_length: 0x%x\n",
                           (guint) fu_struct_logitech_bulkcontroller_send_sync_req_get_payload_length(st));
    g_string_append_printf(str, "  sequence_id: 0x%x\n",
                           (guint) fu_struct_logitech_bulkcontroller_send_sync_req_get_sequence_id(st));
    if (str->len > 0)
        g_string_set_size(str, str->len - 1);
    return g_string_free(g_steal_pointer(&str), FALSE);
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_res_ref: (skip):
 **/
FuStructLogitechBulkcontrollerSendSyncRes *
fu_struct_logitech_bulkcontroller_send_sync_res_ref(FuStructLogitechBulkcontrollerSendSyncRes *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_res_unref: (skip):
 **/
void
fu_struct_logitech_bulkcontroller_send_sync_res_unref(FuStructLogitechBulkcontrollerSendSyncRes *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructLogitechBulkcontrollerSendSyncRes refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_res_new_internal: (skip):
 **/
static FuStructLogitechBulkcontrollerSendSyncRes *
fu_struct_logitech_bulkcontroller_send_sync_res_new_internal(void)
{
    FuStructLogitechBulkcontrollerSendSyncRes *st = g_new0(FuStructLogitechBulkcontrollerSendSyncRes, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_logitech_bulkcontroller_send_sync_res_get_cmd: (skip):
 **/
FuLogitechBulkcontrollerCmd
fu_struct_logitech_bulkcontroller_send_sync_res_get_cmd(const FuStructLogitechBulkcontrollerSendSyncRes *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_res_get_payload_length: (skip):
 **/
guint32
fu_struct_logitech_bulkcontroller_send_sync_res_get_payload_length(const FuStructLogitechBulkcontrollerSendSyncRes *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 4, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_logitech_bulkcontroller_send_sync_res_get_sequence_id: (skip):
 **/
guint32
fu_struct_logitech_bulkcontroller_send_sync_res_get_sequence_id(const FuStructLogitechBulkcontrollerSendSyncRes *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 8, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_logitech_bulkcontroller_send_sync_res_to_string: (skip):
 **/
static gchar *
fu_struct_logitech_bulkcontroller_send_sync_res_to_string(const FuStructLogitechBulkcontrollerSendSyncRes *st)
{
    g_autoptr(GString) str = g_string_new("FuStructLogitechBulkcontrollerSendSyncRes:\n");
    g_return_val_if_fail(st != NULL, NULL);
    {
        const gchar *tmp = fu_logitech_bulkcontroller_cmd_to_string(fu_struct_logitech_bulkcontroller_send_sync_res_get_cmd(st));
        if (tmp != NULL) {
            g_string_append_printf(str, "  cmd: 0x%x [%s]\n", (guint) fu_struct_logitech_bulkcontroller_send_sync_res_get_cmd(st), tmp);
        } else {
            g_string_append_printf(str, "  cmd: 0x%x\n", (guint) fu_struct_logitech_bulkcontroller_send_sync_res_get_cmd(st));
        }
    }
    g_string_append_printf(str, "  payload_length: 0x%x\n",
                           (guint) fu_struct_logitech_bulkcontroller_send_sync_res_get_payload_length(st));
    g_string_append_printf(str, "  sequence_id: 0x%x\n",
                           (guint) fu_struct_logitech_bulkcontroller_send_sync_res_get_sequence_id(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_logitech_bulkcontroller_send_sync_res_validate_internal(FuStructLogitechBulkcontrollerSendSyncRes *st, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    return TRUE;
}
static gboolean
fu_struct_logitech_bulkcontroller_send_sync_res_parse_internal(FuStructLogitechBulkcontrollerSendSyncRes *st, GError **error)
{
    if (g_log_get_debug_enabled()) {
        g_autofree gchar *str = fu_struct_logitech_bulkcontroller_send_sync_res_to_string(st);
        g_debug("%s", str);
    }
    if (!fu_struct_logitech_bulkcontroller_send_sync_res_validate_internal(st, error))
        return FALSE;
    return TRUE;
}

/**
 * fu_struct_logitech_bulkcontroller_send_sync_res_parse: (skip):
 **/
FuStructLogitechBulkcontrollerSendSyncRes *
fu_struct_logitech_bulkcontroller_send_sync_res_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(FuStructLogitechBulkcontrollerSendSyncRes) st = fu_struct_logitech_bulkcontroller_send_sync_res_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, 12, error)) {
        g_prefix_error_literal(error, "invalid struct FuStructLogitechBulkcontrollerSendSyncRes: ");
        return NULL;
    }
    st->buf = g_byte_array_new();
    g_byte_array_append(st->buf, buf + offset, 12);
    if (!fu_struct_logitech_bulkcontroller_send_sync_res_parse_internal(st, error))
        return NULL;
    return g_steal_pointer(&st);
}
/**
 * fu_struct_logitech_bulkcontroller_update_req_ref: (skip):
 **/
FuStructLogitechBulkcontrollerUpdateReq *
fu_struct_logitech_bulkcontroller_update_req_ref(FuStructLogitechBulkcontrollerUpdateReq *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_logitech_bulkcontroller_update_req_unref: (skip):
 **/
void
fu_struct_logitech_bulkcontroller_update_req_unref(FuStructLogitechBulkcontrollerUpdateReq *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructLogitechBulkcontrollerUpdateReq refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_logitech_bulkcontroller_update_req_new_internal: (skip):
 **/
static FuStructLogitechBulkcontrollerUpdateReq *
fu_struct_logitech_bulkcontroller_update_req_new_internal(void)
{
    FuStructLogitechBulkcontrollerUpdateReq *st = g_new0(FuStructLogitechBulkcontrollerUpdateReq, 1);
    st->refcount = 1;
    return st;
}

/* getters */

/* setters */
/**
 * fu_struct_logitech_bulkcontroller_update_req_set_cmd: (skip):
 **/
void
fu_struct_logitech_bulkcontroller_update_req_set_cmd(FuStructLogitechBulkcontrollerUpdateReq *st, FuLogitechBulkcontrollerCmd value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->buf->data + 0, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_logitech_bulkcontroller_update_req_set_payload_length: (skip):
 **/
void
fu_struct_logitech_bulkcontroller_update_req_set_payload_length(FuStructLogitechBulkcontrollerUpdateReq *st, guint32 value)
{
    g_return_if_fail(st != NULL);
    fu_memwrite_uint32(st->buf->data + 4, value, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_logitech_bulkcontroller_update_req_new: (skip):
 **/
FuStructLogitechBulkcontrollerUpdateReq *
fu_struct_logitech_bulkcontroller_update_req_new(void)
{
    FuStructLogitechBulkcontrollerUpdateReq *st = fu_struct_logitech_bulkcontroller_update_req_new_internal();
    st->buf = g_byte_array_sized_new(8);
    fu_byte_array_set_size(st->buf, 8, 0x0);
    return st;
}
/**
 * fu_struct_logitech_bulkcontroller_update_res_ref: (skip):
 **/
FuStructLogitechBulkcontrollerUpdateRes *
fu_struct_logitech_bulkcontroller_update_res_ref(FuStructLogitechBulkcontrollerUpdateRes *st)
{
    g_return_val_if_fail(st != NULL, NULL);
    st->refcount++;
    return st;
}
/**
 * fu_struct_logitech_bulkcontroller_update_res_unref: (skip):
 **/
void
fu_struct_logitech_bulkcontroller_update_res_unref(FuStructLogitechBulkcontrollerUpdateRes *st)
{
    g_return_if_fail(st != NULL);
    if (st->refcount == 0) {
        g_critical("FuStructLogitechBulkcontrollerUpdateRes refcount already zero");
        return;
    }
    if (--st->refcount > 0)
        return;
    if (st->buf != NULL)
        g_byte_array_unref(st->buf);
    g_free(st);
}
/**
 * fu_struct_logitech_bulkcontroller_update_res_new_internal: (skip):
 **/
static FuStructLogitechBulkcontrollerUpdateRes *
fu_struct_logitech_bulkcontroller_update_res_new_internal(void)
{
    FuStructLogitechBulkcontrollerUpdateRes *st = g_new0(FuStructLogitechBulkcontrollerUpdateRes, 1);
    st->refcount = 1;
    return st;
}

/* getters */
/**
 * fu_struct_logitech_bulkcontroller_update_res_get_cmd: (skip):
 **/
FuLogitechBulkcontrollerCmd
fu_struct_logitech_bulkcontroller_update_res_get_cmd(const FuStructLogitechBulkcontrollerUpdateRes *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 0, G_LITTLE_ENDIAN);
}
/**
 * fu_struct_logitech_bulkcontroller_update_res_get_cmd_req: (skip):
 **/
FuLogitechBulkcontrollerCmd
fu_struct_logitech_bulkcontroller_update_res_get_cmd_req(const FuStructLogitechBulkcontrollerUpdateRes *st)
{
    g_return_val_if_fail(st != NULL, 0x0);
    return fu_memread_uint32(st->buf->data + 8, G_LITTLE_ENDIAN);
}

/* setters */
/**
 * fu_struct_logitech_bulkcontroller_update_res_to_string: (skip):
 **/
static gchar *
fu_struct_logitech_bulkcontroller_update_res_to_string(const FuStructLogitechBulkcontrollerUpdateRes *st)
{
    g_autoptr(GString) str = g_string_new("FuStructLogitechBulkcontrollerUpdateRes:\n");
    g_return_val_if_fail(st != NULL, NULL);
    {
        const gchar *tmp = fu_logitech_bulkcontroller_cmd_to_string(fu_struct_logitech_bulkcontroller_update_res_get_cmd(st));
        if (tmp != NULL) {
            g_string_append_printf(str, "  cmd: 0x%x [%s]\n", (guint) fu_struct_logitech_bulkcontroller_update_res_get_cmd(st), tmp);
        } else {
            g_string_append_printf(str, "  cmd: 0x%x\n", (guint) fu_struct_logitech_bulkcontroller_update_res_get_cmd(st));
        }
    }
    {
        const gchar *tmp = fu_logitech_bulkcontroller_cmd_to_string(fu_struct_logitech_bulkcontroller_update_res_get_cmd_req(st));
        if (tmp != NULL) {
            g_string_append_printf(str, "  cmd_req: 0x%x [%s]\n", (guint) fu_struct_logitech_bulkcontroller_update_res_get_cmd_req(st), tmp);
        } else {
            g_string_append_printf(str, "  cmd_req: 0x%x\n", (guint) fu_struct_logitech_bulkcontroller_update_res_get_cmd_req(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_logitech_bulkcontroller_update_res_validate_internal(FuStructLogitechBulkcontrollerUpdateRes *st, GError **error)
{
    g_return_val_if_fail(st != NULL, FALSE);
    return TRUE;
}
static gboolean
fu_struct_logitech_bulkcontroller_update_res_parse_internal(FuStructLogitechBulkcontrollerUpdateRes *st, GError **error)
{
    if (g_log_get_debug_enabled()) {
        g_autofree gchar *str = fu_struct_logitech_bulkcontroller_update_res_to_string(st);
        g_debug("%s", str);
    }
    if (!fu_struct_logitech_bulkcontroller_update_res_validate_internal(st, error))
        return FALSE;
    return TRUE;
}

/**
 * fu_struct_logitech_bulkcontroller_update_res_parse: (skip):
 **/
FuStructLogitechBulkcontrollerUpdateRes *
fu_struct_logitech_bulkcontroller_update_res_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
{
    g_autoptr(FuStructLogitechBulkcontrollerUpdateRes) st = fu_struct_logitech_bulkcontroller_update_res_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, 12, error)) {
        g_prefix_error_literal(error, "invalid struct FuStructLogitechBulkcontrollerUpdateRes: ");
        return NULL;
    }
    st->buf = g_byte_array_new();
    g_byte_array_append(st->buf, buf + offset, 12);
    if (!fu_struct_logitech_bulkcontroller_update_res_parse_internal(st, error))
        return NULL;
    return g_steal_pointer(&st);
}
