Coverage Report

Created: 2025-07-01 07:09

/work/fu-ccgx-dmc-struct.c
Line
Count
Source (jump to first uncovered line)
1
/* auto-generated, do not modify */
2
#include "config.h"
3
4
#include "fu-ccgx-dmc-struct.h"
5
#include "fu-byte-array.h"
6
#include "fu-mem-private.h"
7
#include "fu-string.h"
8
9
#ifdef G_LOG_DOMAIN
10
  #undef G_LOG_DOMAIN
11
#endif
12
0
#define G_LOG_DOMAIN "FuStruct"
13
14
15
const gchar *
16
fu_ccgx_dmc_img_status_to_string(FuCcgxDmcImgStatus val)
17
0
{
18
0
    if (val == FU_CCGX_DMC_IMG_STATUS_UNKNOWN)
19
0
        return "unknown";
20
0
    if (val == FU_CCGX_DMC_IMG_STATUS_VALID)
21
0
        return "valid";
22
0
    if (val == FU_CCGX_DMC_IMG_STATUS_INVALID)
23
0
        return "invalid";
24
0
    if (val == FU_CCGX_DMC_IMG_STATUS_RECOVERY)
25
0
        return "recovery";
26
0
    if (val == FU_CCGX_DMC_IMG_STATUS_RECOVERED_FROM_SECONDARY)
27
0
        return "recovered-from-secondary";
28
0
    if (val == FU_CCGX_DMC_IMG_STATUS_NOT_SUPPORTED)
29
0
        return "not-supported";
30
0
    return NULL;
31
0
}
32
33
const gchar *
34
fu_ccgx_dmc_img_mode_to_string(FuCcgxDmcImgMode val)
35
0
{
36
0
    if (val == FU_CCGX_DMC_IMG_MODE_SINGLE_IMG)
37
0
        return "single-img";
38
0
    if (val == FU_CCGX_DMC_IMG_MODE_DUAL_IMG_SYM)
39
0
        return "dual-img-sym";
40
0
    if (val == FU_CCGX_DMC_IMG_MODE_DUAL_IMG_ASYM)
41
0
        return "dual-img-asym";
42
0
    if (val == FU_CCGX_DMC_IMG_MODE_SINGLE_IMG_WITH_RAM_IMG)
43
0
        return "single-img-with-ram-img";
44
0
    return NULL;
45
0
}
46
47
const gchar *
48
fu_ccgx_dmc_device_status_to_string(FuCcgxDmcDeviceStatus val)
49
0
{
50
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_IDLE)
51
0
        return "idle";
52
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_UPDATE_PHASE1_IN_PROGRESS)
53
0
        return "update-phase1-in-progress";
54
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_UPDATE_PHASE1_PARTIAL)
55
0
        return "update-phase1-partial";
56
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_UPDATE_COMPLETE_FULL)
57
0
        return "update-complete-full";
58
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_UPDATE_PHASE1_COMPLETE_PARTIAL)
59
0
        return "update-phase1-complete-partial";
60
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_UPDATE_PHASE1_COMPLETE_FULL_PHASE2_NOT_DONE)
61
0
        return "update-phase1-complete-full-phase2-not-done";
62
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_FW_DOWNLOADED_UPDATE_PEND)
63
0
        return "fw-downloaded-update-pend";
64
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_FW_DOWNLOADED_PARTIAL_UPDATE_PEND)
65
0
        return "fw-downloaded-partial-update-pend";
66
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_IN_PROGRESS)
67
0
        return "phase2-update-in-progress";
68
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_PARTIAL)
69
0
        return "phase2-update-partial";
70
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FACTORY_BACKUP)
71
0
        return "phase2-update-factory-backup";
72
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_COMPLETE_PARTIAL)
73
0
        return "phase2-update-complete-partial";
74
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_COMPLETE_FULL)
75
0
        return "phase2-update-complete-full";
76
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_INVALID_FWCT)
77
0
        return "phase2-update-fail-invalid-fwct";
78
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_INVALID_DOCK_IDENTITY)
79
0
        return "phase2-update-fail-invalid-dock-identity";
80
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_INVALID_COMPOSITE_VER)
81
0
        return "phase2-update-fail-invalid-composite-ver";
82
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_AUTHENTICATION_FAILED)
83
0
        return "phase2-update-fail-authentication-failed";
84
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_INVALID_ALGORITHM)
85
0
        return "phase2-update-fail-invalid-algorithm";
86
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_SPI_READ_FAILED)
87
0
        return "phase2-update-fail-spi-read-failed";
88
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_NO_VALID_KEY)
89
0
        return "phase2-update-fail-no-valid-key";
90
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_NO_VALID_SPI_PACKAGE)
91
0
        return "phase2-update-fail-no-valid-spi-package";
92
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_RAM_INIT_FAILED)
93
0
        return "phase2-update-fail-ram-init-failed";
94
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_FACTORY_BACKUP_FAILED)
95
0
        return "phase2-update-fail-factory-backup-failed";
96
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_PHASE2_UPDATE_FAIL_NO_VALID_FACTORY_PACKAGE)
97
0
        return "phase2-update-fail-no-valid-factory-package";
98
0
    if (val == FU_CCGX_DMC_DEVICE_STATUS_UPDATE_FAIL)
99
0
        return "update-fail";
100
0
    return NULL;
101
0
}
102
103
const gchar *
104
fu_ccgx_dmc_devx_device_type_to_string(FuCcgxDmcDevxDeviceType val)
105
0
{
106
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_INVALID)
107
0
        return "invalid";
108
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_CCG3)
109
0
        return "ccg3";
110
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_DMC)
111
0
        return "dmc";
112
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_CCG4)
113
0
        return "ccg4";
114
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_CCG5)
115
0
        return "ccg5";
116
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_HX3)
117
0
        return "hx3";
118
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_HX3_PD)
119
0
        return "hx3-pd";
120
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_DMC_PD)
121
0
        return "dmc-pd";
122
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_CCG6)
123
0
        return "ccg6";
124
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_PMG1S3)
125
0
        return "pmg1s3";
126
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_CCG7SC)
127
0
        return "ccg7sc";
128
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_CCG6SF)
129
0
        return "ccg6sf";
130
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_CCG8)
131
0
        return "ccg8";
132
0
    if (val == FU_CCGX_DMC_DEVX_DEVICE_TYPE_SPI)
133
0
        return "spi";
134
0
    return NULL;
135
0
}
136
137
138
const gchar *
139
fu_ccgx_dmc_int_opcode_to_string(FuCcgxDmcIntOpcode val)
140
0
{
141
0
    if (val == FU_CCGX_DMC_INT_OPCODE_FW_UPGRADE_RQT)
142
0
        return "fw-upgrade-rqt";
143
0
    if (val == FU_CCGX_DMC_INT_OPCODE_FW_UPGRADE_STATUS)
144
0
        return "fw-upgrade-status";
145
0
    if (val == FU_CCGX_DMC_INT_OPCODE_IMG_WRITE_STATUS)
146
0
        return "img-write-status";
147
0
    if (val == FU_CCGX_DMC_INT_OPCODE_REENUM)
148
0
        return "reenum";
149
0
    if (val == FU_CCGX_DMC_INT_OPCODE_FWCT_ANALYSIS_STATUS)
150
0
        return "fwct-analysis-status";
151
0
    return NULL;
152
0
}
153
154
const gchar *
155
fu_ccgx_dmc_fwct_analysis_status_to_string(FuCcgxDmcFwctAnalysisStatus val)
156
0
{
157
0
    if (val == FU_CCGX_DMC_FWCT_ANALYSIS_STATUS_INVALID_FWCT)
158
0
        return "invalid-fwct";
159
0
    if (val == FU_CCGX_DMC_FWCT_ANALYSIS_STATUS_INVALID_DOCK_IDENTITY)
160
0
        return "invalid-dock-identity";
161
0
    if (val == FU_CCGX_DMC_FWCT_ANALYSIS_STATUS_INVALID_COMPOSITE_VERSION)
162
0
        return "invalid-composite-version";
163
0
    if (val == FU_CCGX_DMC_FWCT_ANALYSIS_STATUS_AUTHENTICATION_FAILED)
164
0
        return "authentication-failed";
165
0
    if (val == FU_CCGX_DMC_FWCT_ANALYSIS_STATUS_INVALID_ALGORITHM)
166
0
        return "invalid-algorithm";
167
0
    if (val == FU_CCGX_DMC_FWCT_ANALYSIS_STATUS_INVALID_FENCE)
168
0
        return "invalid-fence";
169
0
    return NULL;
170
0
}
171
172
const gchar *
173
fu_ccgx_dmc_update_model_to_string(FuCcgxDmcUpdateModel val)
174
0
{
175
0
    if (val == FU_CCGX_DMC_UPDATE_MODEL_NONE)
176
0
        return "none";
177
0
    if (val == FU_CCGX_DMC_UPDATE_MODEL_DOWNLOAD_TRIGGER)
178
0
        return "download-trigger";
179
0
    if (val == FU_CCGX_DMC_UPDATE_MODEL_PENDING_RESET)
180
0
        return "pending-reset";
181
0
    return NULL;
182
0
}
183
/* getters */
184
/**
185
 * fu_struct_ccgx_dmc_dock_identity_get_structure_version: (skip):
186
 **/
187
guint8
188
fu_struct_ccgx_dmc_dock_identity_get_structure_version(const FuStructCcgxDmcDockIdentity *st)
189
0
{
190
0
    g_return_val_if_fail(st != NULL, 0x0);
191
0
    return st->data[0];
192
0
}
193
/**
194
 * fu_struct_ccgx_dmc_dock_identity_get_cdtt_version: (skip):
195
 **/
196
guint8
197
fu_struct_ccgx_dmc_dock_identity_get_cdtt_version(const FuStructCcgxDmcDockIdentity *st)
198
0
{
199
0
    g_return_val_if_fail(st != NULL, 0x0);
200
0
    return st->data[1];
201
0
}
202
/**
203
 * fu_struct_ccgx_dmc_dock_identity_get_vid: (skip):
204
 **/
205
guint16
206
fu_struct_ccgx_dmc_dock_identity_get_vid(const FuStructCcgxDmcDockIdentity *st)
207
0
{
208
0
    g_return_val_if_fail(st != NULL, 0x0);
209
0
    return fu_memread_uint16(st->data + 2, G_LITTLE_ENDIAN);
210
0
}
211
/**
212
 * fu_struct_ccgx_dmc_dock_identity_get_pid: (skip):
213
 **/
214
guint16
215
fu_struct_ccgx_dmc_dock_identity_get_pid(const FuStructCcgxDmcDockIdentity *st)
216
0
{
217
0
    g_return_val_if_fail(st != NULL, 0x0);
218
0
    return fu_memread_uint16(st->data + 4, G_LITTLE_ENDIAN);
219
0
}
220
/**
221
 * fu_struct_ccgx_dmc_dock_identity_get_device_id: (skip):
222
 **/
223
guint16
224
fu_struct_ccgx_dmc_dock_identity_get_device_id(const FuStructCcgxDmcDockIdentity *st)
225
0
{
226
0
    g_return_val_if_fail(st != NULL, 0x0);
227
0
    return fu_memread_uint16(st->data + 6, G_LITTLE_ENDIAN);
228
0
}
229
/**
230
 * fu_struct_ccgx_dmc_dock_identity_get_vendor_string: (skip):
231
 **/
232
gchar *
233
fu_struct_ccgx_dmc_dock_identity_get_vendor_string(const FuStructCcgxDmcDockIdentity *st)
234
0
{
235
0
    g_return_val_if_fail(st != NULL, NULL);
236
0
    return fu_memstrsafe(st->data, st->len, 8, 32, NULL);
237
0
}
238
/**
239
 * fu_struct_ccgx_dmc_dock_identity_get_product_string: (skip):
240
 **/
241
gchar *
242
fu_struct_ccgx_dmc_dock_identity_get_product_string(const FuStructCcgxDmcDockIdentity *st)
243
0
{
244
0
    g_return_val_if_fail(st != NULL, NULL);
245
0
    return fu_memstrsafe(st->data, st->len, 40, 32, NULL);
246
0
}
247
/**
248
 * fu_struct_ccgx_dmc_dock_identity_get_custom_meta_data_flag: (skip):
249
 **/
250
guint8
251
fu_struct_ccgx_dmc_dock_identity_get_custom_meta_data_flag(const FuStructCcgxDmcDockIdentity *st)
252
0
{
253
0
    g_return_val_if_fail(st != NULL, 0x0);
254
0
    return st->data[72];
255
0
}
256
/**
257
 * fu_struct_ccgx_dmc_dock_identity_get_model: (skip):
258
 **/
259
guint8
260
fu_struct_ccgx_dmc_dock_identity_get_model(const FuStructCcgxDmcDockIdentity *st)
261
0
{
262
0
    g_return_val_if_fail(st != NULL, 0x0);
263
0
    return st->data[73];
264
0
}
265
266
/* setters */
267
/**
268
 * fu_struct_ccgx_dmc_dock_identity_set_structure_version: (skip):
269
 **/
270
void
271
fu_struct_ccgx_dmc_dock_identity_set_structure_version(FuStructCcgxDmcDockIdentity *st, guint8 value)
272
0
{
273
0
    g_return_if_fail(st != NULL);
274
0
    st->data[0] = value;
275
0
}
276
/**
277
 * fu_struct_ccgx_dmc_dock_identity_set_cdtt_version: (skip):
278
 **/
279
void
280
fu_struct_ccgx_dmc_dock_identity_set_cdtt_version(FuStructCcgxDmcDockIdentity *st, guint8 value)
281
0
{
282
0
    g_return_if_fail(st != NULL);
283
0
    st->data[1] = value;
284
0
}
285
/**
286
 * fu_struct_ccgx_dmc_dock_identity_set_vid: (skip):
287
 **/
288
void
289
fu_struct_ccgx_dmc_dock_identity_set_vid(FuStructCcgxDmcDockIdentity *st, guint16 value)
290
0
{
291
0
    g_return_if_fail(st != NULL);
292
0
    fu_memwrite_uint16(st->data + 2, value, G_LITTLE_ENDIAN);
293
0
}
294
/**
295
 * fu_struct_ccgx_dmc_dock_identity_set_pid: (skip):
296
 **/
297
void
298
fu_struct_ccgx_dmc_dock_identity_set_pid(FuStructCcgxDmcDockIdentity *st, guint16 value)
299
0
{
300
0
    g_return_if_fail(st != NULL);
301
0
    fu_memwrite_uint16(st->data + 4, value, G_LITTLE_ENDIAN);
302
0
}
303
/**
304
 * fu_struct_ccgx_dmc_dock_identity_set_device_id: (skip):
305
 **/
306
void
307
fu_struct_ccgx_dmc_dock_identity_set_device_id(FuStructCcgxDmcDockIdentity *st, guint16 value)
308
0
{
309
0
    g_return_if_fail(st != NULL);
310
0
    fu_memwrite_uint16(st->data + 6, value, G_LITTLE_ENDIAN);
311
0
}
312
/**
313
 * fu_struct_ccgx_dmc_dock_identity_set_vendor_string: (skip):
314
 **/
315
gboolean
316
fu_struct_ccgx_dmc_dock_identity_set_vendor_string(FuStructCcgxDmcDockIdentity *st, const gchar *value, GError **error)
317
0
{
318
0
    gsize len;
319
0
    g_return_val_if_fail(st != NULL, FALSE);
320
0
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
321
0
    if (value == NULL) {
322
0
        memset(st->data + 8, 0x0, 32);
323
0
        return TRUE;
324
0
    }
325
0
    len = strlen(value);
326
0
    if (len > 32) {
327
0
        g_set_error(error,
328
0
                    FWUPD_ERROR,
329
0
                    FWUPD_ERROR_INVALID_DATA,
330
0
                    "string '%s' (0x%x bytes) does not fit in FuStructCcgxDmcDockIdentity.vendor_string (0x%x bytes)",
331
0
                    value, (guint) len, (guint) 32);
332
0
        return FALSE;
333
0
    }
334
0
    return fu_memcpy_safe(st->data, st->len, 8, (const guint8 *)value, len, 0x0, len, error);
335
0
}
336
/**
337
 * fu_struct_ccgx_dmc_dock_identity_set_product_string: (skip):
338
 **/
339
gboolean
340
fu_struct_ccgx_dmc_dock_identity_set_product_string(FuStructCcgxDmcDockIdentity *st, const gchar *value, GError **error)
341
0
{
342
0
    gsize len;
343
0
    g_return_val_if_fail(st != NULL, FALSE);
344
0
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
345
0
    if (value == NULL) {
346
0
        memset(st->data + 40, 0x0, 32);
347
0
        return TRUE;
348
0
    }
349
0
    len = strlen(value);
350
0
    if (len > 32) {
351
0
        g_set_error(error,
352
0
                    FWUPD_ERROR,
353
0
                    FWUPD_ERROR_INVALID_DATA,
354
0
                    "string '%s' (0x%x bytes) does not fit in FuStructCcgxDmcDockIdentity.product_string (0x%x bytes)",
355
0
                    value, (guint) len, (guint) 32);
356
0
        return FALSE;
357
0
    }
358
0
    return fu_memcpy_safe(st->data, st->len, 40, (const guint8 *)value, len, 0x0, len, error);
359
0
}
360
/**
361
 * fu_struct_ccgx_dmc_dock_identity_set_custom_meta_data_flag: (skip):
362
 **/
363
void
364
fu_struct_ccgx_dmc_dock_identity_set_custom_meta_data_flag(FuStructCcgxDmcDockIdentity *st, guint8 value)
365
0
{
366
0
    g_return_if_fail(st != NULL);
367
0
    st->data[72] = value;
368
0
}
369
/**
370
 * fu_struct_ccgx_dmc_dock_identity_set_model: (skip):
371
 **/
372
void
373
fu_struct_ccgx_dmc_dock_identity_set_model(FuStructCcgxDmcDockIdentity *st, guint8 value)
374
0
{
375
0
    g_return_if_fail(st != NULL);
376
0
    st->data[73] = value;
377
0
}
378
/**
379
 * fu_struct_ccgx_dmc_dock_identity_new: (skip):
380
 **/
381
FuStructCcgxDmcDockIdentity *
382
fu_struct_ccgx_dmc_dock_identity_new(void)
383
0
{
384
0
    FuStructCcgxDmcDockIdentity *st = g_byte_array_sized_new(74);
385
0
    fu_byte_array_set_size(st, 74, 0x0);
386
0
    return st;
387
0
}
388
/* getters */
389
/**
390
 * fu_struct_ccgx_dmc_devx_status_get_device_type: (skip):
391
 **/
392
FuCcgxDmcDevxDeviceType
393
fu_struct_ccgx_dmc_devx_status_get_device_type(const FuStructCcgxDmcDevxStatus *st)
394
0
{
395
0
    g_return_val_if_fail(st != NULL, 0x0);
396
0
    return st->data[0];
397
0
}
398
/**
399
 * fu_struct_ccgx_dmc_devx_status_get_component_id: (skip):
400
 **/
401
guint8
402
fu_struct_ccgx_dmc_devx_status_get_component_id(const FuStructCcgxDmcDevxStatus *st)
403
0
{
404
0
    g_return_val_if_fail(st != NULL, 0x0);
405
0
    return st->data[1];
406
0
}
407
/**
408
 * fu_struct_ccgx_dmc_devx_status_get_image_mode: (skip):
409
 **/
410
FuCcgxDmcImgMode
411
fu_struct_ccgx_dmc_devx_status_get_image_mode(const FuStructCcgxDmcDevxStatus *st)
412
0
{
413
0
    g_return_val_if_fail(st != NULL, 0x0);
414
0
    return st->data[2];
415
0
}
416
/**
417
 * fu_struct_ccgx_dmc_devx_status_get_current_image: (skip):
418
 **/
419
guint8
420
fu_struct_ccgx_dmc_devx_status_get_current_image(const FuStructCcgxDmcDevxStatus *st)
421
0
{
422
0
    g_return_val_if_fail(st != NULL, 0x0);
423
0
    return st->data[3];
424
0
}
425
/**
426
 * fu_struct_ccgx_dmc_devx_status_get_img_status: (skip):
427
 **/
428
guint8
429
fu_struct_ccgx_dmc_devx_status_get_img_status(const FuStructCcgxDmcDevxStatus *st)
430
0
{
431
0
    g_return_val_if_fail(st != NULL, 0x0);
432
0
    return st->data[4];
433
0
}
434
/**
435
 * fu_struct_ccgx_dmc_devx_status_get_fw_version: (skip):
436
 **/
437
const guint8 *
438
fu_struct_ccgx_dmc_devx_status_get_fw_version(const FuStructCcgxDmcDevxStatus *st, gsize *bufsz)
439
0
{
440
0
    g_return_val_if_fail(st != NULL, NULL);
441
0
    if (bufsz != NULL)
442
0
        *bufsz = 24;
443
0
    return st->data + 8;
444
0
}
445
446
/* setters */
447
/**
448
 * fu_struct_ccgx_dmc_devx_status_to_string: (skip):
449
 **/
450
static gchar *
451
fu_struct_ccgx_dmc_devx_status_to_string(const FuStructCcgxDmcDevxStatus *st)
452
0
{
453
0
    g_autoptr(GString) str = g_string_new("FuStructCcgxDmcDevxStatus:\n");
454
0
    g_return_val_if_fail(st != NULL, NULL);
455
0
    {
456
0
        const gchar *tmp = fu_ccgx_dmc_devx_device_type_to_string(fu_struct_ccgx_dmc_devx_status_get_device_type(st));
457
0
        if (tmp != NULL) {
458
0
            g_string_append_printf(str, "  device_type: 0x%x [%s]\n", (guint) fu_struct_ccgx_dmc_devx_status_get_device_type(st), tmp);
459
0
        } else {
460
0
            g_string_append_printf(str, "  device_type: 0x%x\n", (guint) fu_struct_ccgx_dmc_devx_status_get_device_type(st));
461
0
        }
462
0
    }
463
0
    g_string_append_printf(str, "  component_id: 0x%x\n",
464
0
                           (guint) fu_struct_ccgx_dmc_devx_status_get_component_id(st));
465
0
    {
466
0
        const gchar *tmp = fu_ccgx_dmc_img_mode_to_string(fu_struct_ccgx_dmc_devx_status_get_image_mode(st));
467
0
        if (tmp != NULL) {
468
0
            g_string_append_printf(str, "  image_mode: 0x%x [%s]\n", (guint) fu_struct_ccgx_dmc_devx_status_get_image_mode(st), tmp);
469
0
        } else {
470
0
            g_string_append_printf(str, "  image_mode: 0x%x\n", (guint) fu_struct_ccgx_dmc_devx_status_get_image_mode(st));
471
0
        }
472
0
    }
473
0
    g_string_append_printf(str, "  current_image: 0x%x\n",
474
0
                           (guint) fu_struct_ccgx_dmc_devx_status_get_current_image(st));
475
0
    g_string_append_printf(str, "  img_status: 0x%x\n",
476
0
                           (guint) fu_struct_ccgx_dmc_devx_status_get_img_status(st));
477
0
    {
478
0
        gsize bufsz = 0;
479
0
        const guint8 *buf = fu_struct_ccgx_dmc_devx_status_get_fw_version(st, &bufsz);
480
0
        g_autoptr(GString) tmp = g_string_new(NULL);
481
0
        for (gsize i = 0; i < bufsz; i++)
482
0
            g_string_append_printf(tmp, "%02X", buf[i]);
483
0
        g_string_append_printf(str, "  fw_version: 0x%s\n", tmp->str);
484
0
    }
485
0
    if (str->len > 0)
486
0
        g_string_set_size(str, str->len - 1);
487
0
    return g_string_free(g_steal_pointer(&str), FALSE);
488
0
}
489
static gboolean
490
fu_struct_ccgx_dmc_devx_status_validate_internal(FuStructCcgxDmcDevxStatus *st, GError **error)
491
0
{
492
0
    g_return_val_if_fail(st != NULL, FALSE);
493
0
    return TRUE;
494
0
}
495
static gboolean
496
fu_struct_ccgx_dmc_devx_status_parse_internal(FuStructCcgxDmcDevxStatus *st, GError **error)
497
0
{
498
0
    if (!fu_struct_ccgx_dmc_devx_status_validate_internal(st, error))
499
0
        return FALSE;
500
0
    if (g_getenv("FWUPD_VERBOSE") != NULL) {
501
0
        g_autofree gchar *str = fu_struct_ccgx_dmc_devx_status_to_string(st);
502
0
        g_debug("%s", str);
503
0
    }
504
0
    return TRUE;
505
0
}
506
507
/**
508
 * fu_struct_ccgx_dmc_devx_status_parse: (skip):
509
 **/
510
FuStructCcgxDmcDevxStatus *
511
fu_struct_ccgx_dmc_devx_status_parse(const guint8 *buf, gsize bufsz, gsize offset, GError **error)
512
0
{
513
0
    g_autoptr(GByteArray) st = g_byte_array_new();
514
0
    g_return_val_if_fail(buf != NULL, NULL);
515
0
    g_return_val_if_fail(error == NULL || *error == NULL, NULL);
516
0
    if (!fu_memchk_read(bufsz, offset, 32, error)) {
517
0
        g_prefix_error(error, "invalid struct FuStructCcgxDmcDevxStatus: ");
518
0
        return NULL;
519
0
    }
520
0
    g_byte_array_append(st, buf + offset, 32);
521
0
    if (!fu_struct_ccgx_dmc_devx_status_parse_internal(st, error))
522
0
        return NULL;
523
0
    return g_steal_pointer(&st);
524
0
}
525
/* getters */
526
/**
527
 * fu_struct_ccgx_dmc_dock_status_get_device_status: (skip):
528
 **/
529
FuCcgxDmcDeviceStatus
530
fu_struct_ccgx_dmc_dock_status_get_device_status(const FuStructCcgxDmcDockStatus *st)
531
0
{
532
0
    g_return_val_if_fail(st != NULL, 0x0);
533
0
    return st->data[0];
534
0
}
535
/**
536
 * fu_struct_ccgx_dmc_dock_status_get_device_count: (skip):
537
 **/
538
guint8
539
fu_struct_ccgx_dmc_dock_status_get_device_count(const FuStructCcgxDmcDockStatus *st)
540
0
{
541
0
    g_return_val_if_fail(st != NULL, 0x0);
542
0
    return st->data[1];
543
0
}
544
/**
545
 * fu_struct_ccgx_dmc_dock_status_get_status_length: (skip):
546
 **/
547
guint16
548
fu_struct_ccgx_dmc_dock_status_get_status_length(const FuStructCcgxDmcDockStatus *st)
549
0
{
550
0
    g_return_val_if_fail(st != NULL, 0x0);
551
0
    return fu_memread_uint16(st->data + 2, G_LITTLE_ENDIAN);
552
0
}
553
/**
554
 * fu_struct_ccgx_dmc_dock_status_get_composite_version: (skip):
555
 **/
556
guint32
557
fu_struct_ccgx_dmc_dock_status_get_composite_version(const FuStructCcgxDmcDockStatus *st)
558
0
{
559
0
    g_return_val_if_fail(st != NULL, 0x0);
560
0
    return fu_memread_uint32(st->data + 4, G_LITTLE_ENDIAN);
561
0
}
562
563
/* setters */
564
/**
565
 * fu_struct_ccgx_dmc_dock_status_set_device_status: (skip):
566
 **/
567
void
568
fu_struct_ccgx_dmc_dock_status_set_device_status(FuStructCcgxDmcDockStatus *st, FuCcgxDmcDeviceStatus value)
569
0
{
570
0
    g_return_if_fail(st != NULL);
571
0
    st->data[0] = value;
572
0
}
573
/**
574
 * fu_struct_ccgx_dmc_dock_status_set_device_count: (skip):
575
 **/
576
void
577
fu_struct_ccgx_dmc_dock_status_set_device_count(FuStructCcgxDmcDockStatus *st, guint8 value)
578
0
{
579
0
    g_return_if_fail(st != NULL);
580
0
    st->data[1] = value;
581
0
}
582
/**
583
 * fu_struct_ccgx_dmc_dock_status_set_status_length: (skip):
584
 **/
585
void
586
fu_struct_ccgx_dmc_dock_status_set_status_length(FuStructCcgxDmcDockStatus *st, guint16 value)
587
0
{
588
0
    g_return_if_fail(st != NULL);
589
0
    fu_memwrite_uint16(st->data + 2, value, G_LITTLE_ENDIAN);
590
0
}
591
/**
592
 * fu_struct_ccgx_dmc_dock_status_set_composite_version: (skip):
593
 **/
594
void
595
fu_struct_ccgx_dmc_dock_status_set_composite_version(FuStructCcgxDmcDockStatus *st, guint32 value)
596
0
{
597
0
    g_return_if_fail(st != NULL);
598
0
    fu_memwrite_uint32(st->data + 4, value, G_LITTLE_ENDIAN);
599
0
}
600
/**
601
 * fu_struct_ccgx_dmc_dock_status_new: (skip):
602
 **/
603
FuStructCcgxDmcDockStatus *
604
fu_struct_ccgx_dmc_dock_status_new(void)
605
0
{
606
0
    FuStructCcgxDmcDockStatus *st = g_byte_array_sized_new(8);
607
0
    fu_byte_array_set_size(st, 8, 0x0);
608
0
    return st;
609
0
}
610
/* getters */
611
/**
612
 * fu_struct_ccgx_dmc_int_rqt_get_opcode: (skip):
613
 **/
614
FuCcgxDmcIntOpcode
615
fu_struct_ccgx_dmc_int_rqt_get_opcode(const FuStructCcgxDmcIntRqt *st)
616
0
{
617
0
    g_return_val_if_fail(st != NULL, 0x0);
618
0
    return st->data[0];
619
0
}
620
/**
621
 * fu_struct_ccgx_dmc_int_rqt_get_length: (skip):
622
 **/
623
guint8
624
fu_struct_ccgx_dmc_int_rqt_get_length(const FuStructCcgxDmcIntRqt *st)
625
0
{
626
0
    g_return_val_if_fail(st != NULL, 0x0);
627
0
    return st->data[1];
628
0
}
629
/**
630
 * fu_struct_ccgx_dmc_int_rqt_get_data: (skip):
631
 **/
632
const guint8 *
633
fu_struct_ccgx_dmc_int_rqt_get_data(const FuStructCcgxDmcIntRqt *st, gsize *bufsz)
634
0
{
635
0
    g_return_val_if_fail(st != NULL, NULL);
636
0
    if (bufsz != NULL)
637
0
        *bufsz = 8;
638
0
    return st->data + 2;
639
0
}
640
641
/* setters */
642
/**
643
 * fu_struct_ccgx_dmc_int_rqt_set_opcode: (skip):
644
 **/
645
void
646
fu_struct_ccgx_dmc_int_rqt_set_opcode(FuStructCcgxDmcIntRqt *st, FuCcgxDmcIntOpcode value)
647
0
{
648
0
    g_return_if_fail(st != NULL);
649
0
    st->data[0] = value;
650
0
}
651
/**
652
 * fu_struct_ccgx_dmc_int_rqt_set_length: (skip):
653
 **/
654
void
655
fu_struct_ccgx_dmc_int_rqt_set_length(FuStructCcgxDmcIntRqt *st, guint8 value)
656
0
{
657
0
    g_return_if_fail(st != NULL);
658
0
    st->data[1] = value;
659
0
}
660
/**
661
 * fu_struct_ccgx_dmc_int_rqt_set_data: (skip):
662
 **/
663
gboolean
664
fu_struct_ccgx_dmc_int_rqt_set_data(FuStructCcgxDmcIntRqt *st, const guint8 *buf, gsize bufsz, GError **error)
665
0
{
666
0
    g_return_val_if_fail(st != NULL, FALSE);
667
0
    g_return_val_if_fail(buf != NULL, FALSE);
668
0
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
669
0
    return fu_memcpy_safe(st->data, st->len, 2, buf, bufsz, 0x0, bufsz, error);
670
0
}
671
/**
672
 * fu_struct_ccgx_dmc_int_rqt_new: (skip):
673
 **/
674
FuStructCcgxDmcIntRqt *
675
fu_struct_ccgx_dmc_int_rqt_new(void)
676
0
{
677
0
    FuStructCcgxDmcIntRqt *st = g_byte_array_sized_new(10);
678
0
    fu_byte_array_set_size(st, 10, 0x0);
679
0
    return st;
680
0
}
681
/* getters */
682
/**
683
 * fu_struct_ccgx_dmc_fwct_info_get_signature: (skip):
684
 **/
685
static guint32
686
fu_struct_ccgx_dmc_fwct_info_get_signature(const FuStructCcgxDmcFwctInfo *st)
687
7.10M
{
688
7.10M
    g_return_val_if_fail(st != NULL, 0x0);
689
7.10M
    return fu_memread_uint32(st->data + 0, G_LITTLE_ENDIAN);
690
7.10M
}
691
/**
692
 * fu_struct_ccgx_dmc_fwct_info_get_size: (skip):
693
 **/
694
guint16
695
fu_struct_ccgx_dmc_fwct_info_get_size(const FuStructCcgxDmcFwctInfo *st)
696
1.39k
{
697
1.39k
    g_return_val_if_fail(st != NULL, 0x0);
698
1.39k
    return fu_memread_uint16(st->data + 4, G_LITTLE_ENDIAN);
699
1.39k
}
700
/**
701
 * fu_struct_ccgx_dmc_fwct_info_get_checksum: (skip):
702
 **/
703
guint8
704
fu_struct_ccgx_dmc_fwct_info_get_checksum(const FuStructCcgxDmcFwctInfo *st)
705
0
{
706
0
    g_return_val_if_fail(st != NULL, 0x0);
707
0
    return st->data[6];
708
0
}
709
/**
710
 * fu_struct_ccgx_dmc_fwct_info_get_version: (skip):
711
 **/
712
guint8
713
fu_struct_ccgx_dmc_fwct_info_get_version(const FuStructCcgxDmcFwctInfo *st)
714
0
{
715
0
    g_return_val_if_fail(st != NULL, 0x0);
716
0
    return st->data[7];
717
0
}
718
/**
719
 * fu_struct_ccgx_dmc_fwct_info_get_custom_meta_type: (skip):
720
 **/
721
guint8
722
fu_struct_ccgx_dmc_fwct_info_get_custom_meta_type(const FuStructCcgxDmcFwctInfo *st)
723
0
{
724
0
    g_return_val_if_fail(st != NULL, 0x0);
725
0
    return st->data[8];
726
0
}
727
/**
728
 * fu_struct_ccgx_dmc_fwct_info_get_cdtt_version: (skip):
729
 **/
730
guint8
731
fu_struct_ccgx_dmc_fwct_info_get_cdtt_version(const FuStructCcgxDmcFwctInfo *st)
732
0
{
733
0
    g_return_val_if_fail(st != NULL, 0x0);
734
0
    return st->data[9];
735
0
}
736
/**
737
 * fu_struct_ccgx_dmc_fwct_info_get_vid: (skip):
738
 **/
739
guint16
740
fu_struct_ccgx_dmc_fwct_info_get_vid(const FuStructCcgxDmcFwctInfo *st)
741
0
{
742
0
    g_return_val_if_fail(st != NULL, 0x0);
743
0
    return fu_memread_uint16(st->data + 10, G_LITTLE_ENDIAN);
744
0
}
745
/**
746
 * fu_struct_ccgx_dmc_fwct_info_get_pid: (skip):
747
 **/
748
guint16
749
fu_struct_ccgx_dmc_fwct_info_get_pid(const FuStructCcgxDmcFwctInfo *st)
750
0
{
751
0
    g_return_val_if_fail(st != NULL, 0x0);
752
0
    return fu_memread_uint16(st->data + 12, G_LITTLE_ENDIAN);
753
0
}
754
/**
755
 * fu_struct_ccgx_dmc_fwct_info_get_device_id: (skip):
756
 **/
757
guint16
758
fu_struct_ccgx_dmc_fwct_info_get_device_id(const FuStructCcgxDmcFwctInfo *st)
759
0
{
760
0
    g_return_val_if_fail(st != NULL, 0x0);
761
0
    return fu_memread_uint16(st->data + 14, G_LITTLE_ENDIAN);
762
0
}
763
/**
764
 * fu_struct_ccgx_dmc_fwct_info_get_composite_version: (skip):
765
 **/
766
guint32
767
fu_struct_ccgx_dmc_fwct_info_get_composite_version(const FuStructCcgxDmcFwctInfo *st)
768
1.37k
{
769
1.37k
    g_return_val_if_fail(st != NULL, 0x0);
770
1.37k
    return fu_memread_uint32(st->data + 32, G_LITTLE_ENDIAN);
771
1.37k
}
772
/**
773
 * fu_struct_ccgx_dmc_fwct_info_get_image_count: (skip):
774
 **/
775
guint8
776
fu_struct_ccgx_dmc_fwct_info_get_image_count(const FuStructCcgxDmcFwctInfo *st)
777
1.20k
{
778
1.20k
    g_return_val_if_fail(st != NULL, 0x0);
779
1.20k
    return st->data[36];
780
1.20k
}
781
782
/* setters */
783
/**
784
 * fu_struct_ccgx_dmc_fwct_info_set_signature: (skip):
785
 **/
786
static void
787
fu_struct_ccgx_dmc_fwct_info_set_signature(FuStructCcgxDmcFwctInfo *st, guint32 value)
788
256
{
789
256
    g_return_if_fail(st != NULL);
790
256
    fu_memwrite_uint32(st->data + 0, value, G_LITTLE_ENDIAN);
791
256
}
792
/**
793
 * fu_struct_ccgx_dmc_fwct_info_set_size: (skip):
794
 **/
795
void
796
fu_struct_ccgx_dmc_fwct_info_set_size(FuStructCcgxDmcFwctInfo *st, guint16 value)
797
256
{
798
256
    g_return_if_fail(st != NULL);
799
256
    fu_memwrite_uint16(st->data + 4, value, G_LITTLE_ENDIAN);
800
256
}
801
/**
802
 * fu_struct_ccgx_dmc_fwct_info_set_checksum: (skip):
803
 **/
804
void
805
fu_struct_ccgx_dmc_fwct_info_set_checksum(FuStructCcgxDmcFwctInfo *st, guint8 value)
806
0
{
807
0
    g_return_if_fail(st != NULL);
808
0
    st->data[6] = value;
809
0
}
810
/**
811
 * fu_struct_ccgx_dmc_fwct_info_set_version: (skip):
812
 **/
813
void
814
fu_struct_ccgx_dmc_fwct_info_set_version(FuStructCcgxDmcFwctInfo *st, guint8 value)
815
256
{
816
256
    g_return_if_fail(st != NULL);
817
256
    st->data[7] = value;
818
256
}
819
/**
820
 * fu_struct_ccgx_dmc_fwct_info_set_custom_meta_type: (skip):
821
 **/
822
void
823
fu_struct_ccgx_dmc_fwct_info_set_custom_meta_type(FuStructCcgxDmcFwctInfo *st, guint8 value)
824
256
{
825
256
    g_return_if_fail(st != NULL);
826
256
    st->data[8] = value;
827
256
}
828
/**
829
 * fu_struct_ccgx_dmc_fwct_info_set_cdtt_version: (skip):
830
 **/
831
void
832
fu_struct_ccgx_dmc_fwct_info_set_cdtt_version(FuStructCcgxDmcFwctInfo *st, guint8 value)
833
256
{
834
256
    g_return_if_fail(st != NULL);
835
256
    st->data[9] = value;
836
256
}
837
/**
838
 * fu_struct_ccgx_dmc_fwct_info_set_vid: (skip):
839
 **/
840
void
841
fu_struct_ccgx_dmc_fwct_info_set_vid(FuStructCcgxDmcFwctInfo *st, guint16 value)
842
0
{
843
0
    g_return_if_fail(st != NULL);
844
0
    fu_memwrite_uint16(st->data + 10, value, G_LITTLE_ENDIAN);
845
0
}
846
/**
847
 * fu_struct_ccgx_dmc_fwct_info_set_pid: (skip):
848
 **/
849
void
850
fu_struct_ccgx_dmc_fwct_info_set_pid(FuStructCcgxDmcFwctInfo *st, guint16 value)
851
0
{
852
0
    g_return_if_fail(st != NULL);
853
0
    fu_memwrite_uint16(st->data + 12, value, G_LITTLE_ENDIAN);
854
0
}
855
/**
856
 * fu_struct_ccgx_dmc_fwct_info_set_device_id: (skip):
857
 **/
858
void
859
fu_struct_ccgx_dmc_fwct_info_set_device_id(FuStructCcgxDmcFwctInfo *st, guint16 value)
860
256
{
861
256
    g_return_if_fail(st != NULL);
862
256
    fu_memwrite_uint16(st->data + 14, value, G_LITTLE_ENDIAN);
863
256
}
864
/**
865
 * fu_struct_ccgx_dmc_fwct_info_set_composite_version: (skip):
866
 **/
867
void
868
fu_struct_ccgx_dmc_fwct_info_set_composite_version(FuStructCcgxDmcFwctInfo *st, guint32 value)
869
256
{
870
256
    g_return_if_fail(st != NULL);
871
256
    fu_memwrite_uint32(st->data + 32, value, G_LITTLE_ENDIAN);
872
256
}
873
/**
874
 * fu_struct_ccgx_dmc_fwct_info_set_image_count: (skip):
875
 **/
876
void
877
fu_struct_ccgx_dmc_fwct_info_set_image_count(FuStructCcgxDmcFwctInfo *st, guint8 value)
878
256
{
879
256
    g_return_if_fail(st != NULL);
880
256
    st->data[36] = value;
881
256
}
882
/**
883
 * fu_struct_ccgx_dmc_fwct_info_new: (skip):
884
 **/
885
FuStructCcgxDmcFwctInfo *
886
fu_struct_ccgx_dmc_fwct_info_new(void)
887
256
{
888
256
    FuStructCcgxDmcFwctInfo *st = g_byte_array_sized_new(40);
889
256
    fu_byte_array_set_size(st, 40, 0x0);
890
256
    fu_struct_ccgx_dmc_fwct_info_set_signature(st, 0x54435746);
891
256
    return st;
892
256
}
893
/**
894
 * fu_struct_ccgx_dmc_fwct_info_to_string: (skip):
895
 **/
896
static gchar *
897
fu_struct_ccgx_dmc_fwct_info_to_string(const FuStructCcgxDmcFwctInfo *st)
898
0
{
899
0
    g_autoptr(GString) str = g_string_new("FuStructCcgxDmcFwctInfo:\n");
900
0
    g_return_val_if_fail(st != NULL, NULL);
901
0
    g_string_append_printf(str, "  size: 0x%x\n",
902
0
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_size(st));
903
0
    g_string_append_printf(str, "  checksum: 0x%x\n",
904
0
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_checksum(st));
905
0
    g_string_append_printf(str, "  version: 0x%x\n",
906
0
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_version(st));
907
0
    g_string_append_printf(str, "  custom_meta_type: 0x%x\n",
908
0
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_custom_meta_type(st));
909
0
    g_string_append_printf(str, "  cdtt_version: 0x%x\n",
910
0
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_cdtt_version(st));
911
0
    g_string_append_printf(str, "  vid: 0x%x\n",
912
0
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_vid(st));
913
0
    g_string_append_printf(str, "  pid: 0x%x\n",
914
0
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_pid(st));
915
0
    g_string_append_printf(str, "  device_id: 0x%x\n",
916
0
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_device_id(st));
917
0
    g_string_append_printf(str, "  composite_version: 0x%x\n",
918
0
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_composite_version(st));
919
0
    g_string_append_printf(str, "  image_count: 0x%x\n",
920
0
                           (guint) fu_struct_ccgx_dmc_fwct_info_get_image_count(st));
921
0
    if (str->len > 0)
922
0
        g_string_set_size(str, str->len - 1);
923
0
    return g_string_free(g_steal_pointer(&str), FALSE);
924
0
}
925
static gboolean
926
fu_struct_ccgx_dmc_fwct_info_validate_internal(FuStructCcgxDmcFwctInfo *st, GError **error)
927
7.10M
{
928
7.10M
    g_return_val_if_fail(st != NULL, FALSE);
929
7.10M
    if (fu_struct_ccgx_dmc_fwct_info_get_signature(st) != 0x54435746) {
930
7.10M
        g_set_error_literal(error,
931
7.10M
                            FWUPD_ERROR,
932
7.10M
                            FWUPD_ERROR_INVALID_DATA,
933
7.10M
                            "constant FuStructCcgxDmcFwctInfo.signature was not valid");
934
7.10M
        return FALSE;
935
7.10M
    }
936
2.78k
    return TRUE;
937
7.10M
}
938
/**
939
 * fu_struct_ccgx_dmc_fwct_info_validate_stream: (skip):
940
 **/
941
gboolean
942
fu_struct_ccgx_dmc_fwct_info_validate_stream(GInputStream *stream, gsize offset, GError **error)
943
7.11M
{
944
7.11M
    g_autoptr(GByteArray) st = NULL;
945
7.11M
    g_return_val_if_fail(G_IS_INPUT_STREAM(stream), FALSE);
946
7.11M
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
947
7.11M
    st = fu_input_stream_read_byte_array(stream, offset, 40, NULL, error);
948
7.11M
    if (st == NULL) {
949
0
        g_prefix_error(error, "FuStructCcgxDmcFwctInfo failed read of 0x%x: ", (guint) 40);
950
0
        return FALSE;
951
0
    }
952
7.11M
    if (st->len != 40) {
953
6.28k
        g_set_error(error,
954
6.28k
                    FWUPD_ERROR,
955
6.28k
                    FWUPD_ERROR_INVALID_DATA,
956
6.28k
                    "FuStructCcgxDmcFwctInfo requested 0x%x and got 0x%x",
957
6.28k
                    (guint) 40,
958
6.28k
                    (guint) st->len);
959
6.28k
        return FALSE;
960
6.28k
    }
961
7.10M
    return fu_struct_ccgx_dmc_fwct_info_validate_internal(st, error);
962
7.11M
}
963
static gboolean
964
fu_struct_ccgx_dmc_fwct_info_parse_internal(FuStructCcgxDmcFwctInfo *st, GError **error)
965
1.39k
{
966
1.39k
    if (!fu_struct_ccgx_dmc_fwct_info_validate_internal(st, error))
967
0
        return FALSE;
968
1.39k
    if (g_getenv("FWUPD_VERBOSE") != NULL) {
969
0
        g_autofree gchar *str = fu_struct_ccgx_dmc_fwct_info_to_string(st);
970
0
        g_debug("%s", str);
971
0
    }
972
1.39k
    return TRUE;
973
1.39k
}
974
/**
975
 * fu_struct_ccgx_dmc_fwct_info_parse_stream: (skip):
976
 **/
977
FuStructCcgxDmcFwctInfo *
978
fu_struct_ccgx_dmc_fwct_info_parse_stream(GInputStream *stream, gsize offset, GError **error)
979
1.39k
{
980
1.39k
    g_autoptr(GByteArray) st = NULL;
981
1.39k
    st = fu_input_stream_read_byte_array(stream, offset, 40, NULL, error);
982
1.39k
    if (st == NULL) {
983
0
        g_prefix_error(error, "FuStructCcgxDmcFwctInfo failed read of 0x%x: ", (guint) 40);
984
0
        return NULL;
985
0
    }
986
1.39k
    if (st->len != 40) {
987
0
        g_set_error(error,
988
0
                    FWUPD_ERROR,
989
0
                    FWUPD_ERROR_INVALID_DATA,
990
0
                    "FuStructCcgxDmcFwctInfo requested 0x%x and got 0x%x",
991
0
                    (guint) 40,
992
0
                    (guint) st->len);
993
0
        return NULL;
994
0
    }
995
1.39k
    if (!fu_struct_ccgx_dmc_fwct_info_parse_internal(st, error))
996
0
        return NULL;
997
1.39k
    return g_steal_pointer(&st);
998
1.39k
}
999
/* getters */
1000
/**
1001
 * fu_struct_ccgx_dmc_fwct_image_info_get_device_type: (skip):
1002
 **/
1003
guint8
1004
fu_struct_ccgx_dmc_fwct_image_info_get_device_type(const FuStructCcgxDmcFwctImageInfo *st)
1005
0
{
1006
0
    g_return_val_if_fail(st != NULL, 0x0);
1007
0
    return st->data[0];
1008
0
}
1009
/**
1010
 * fu_struct_ccgx_dmc_fwct_image_info_get_img_type: (skip):
1011
 **/
1012
guint8
1013
fu_struct_ccgx_dmc_fwct_image_info_get_img_type(const FuStructCcgxDmcFwctImageInfo *st)
1014
0
{
1015
0
    g_return_val_if_fail(st != NULL, 0x0);
1016
0
    return st->data[1];
1017
0
}
1018
/**
1019
 * fu_struct_ccgx_dmc_fwct_image_info_get_comp_id: (skip):
1020
 **/
1021
guint8
1022
fu_struct_ccgx_dmc_fwct_image_info_get_comp_id(const FuStructCcgxDmcFwctImageInfo *st)
1023
0
{
1024
0
    g_return_val_if_fail(st != NULL, 0x0);
1025
0
    return st->data[2];
1026
0
}
1027
/**
1028
 * fu_struct_ccgx_dmc_fwct_image_info_get_row_size: (skip):
1029
 **/
1030
guint8
1031
fu_struct_ccgx_dmc_fwct_image_info_get_row_size(const FuStructCcgxDmcFwctImageInfo *st)
1032
2.49k
{
1033
2.49k
    g_return_val_if_fail(st != NULL, 0x0);
1034
2.49k
    return st->data[3];
1035
2.49k
}
1036
/**
1037
 * fu_struct_ccgx_dmc_fwct_image_info_get_fw_version: (skip):
1038
 **/
1039
guint32
1040
fu_struct_ccgx_dmc_fwct_image_info_get_fw_version(const FuStructCcgxDmcFwctImageInfo *st)
1041
0
{
1042
0
    g_return_val_if_fail(st != NULL, 0x0);
1043
0
    return fu_memread_uint32(st->data + 8, G_LITTLE_ENDIAN);
1044
0
}
1045
/**
1046
 * fu_struct_ccgx_dmc_fwct_image_info_get_app_version: (skip):
1047
 **/
1048
guint32
1049
fu_struct_ccgx_dmc_fwct_image_info_get_app_version(const FuStructCcgxDmcFwctImageInfo *st)
1050
0
{
1051
0
    g_return_val_if_fail(st != NULL, 0x0);
1052
0
    return fu_memread_uint32(st->data + 12, G_LITTLE_ENDIAN);
1053
0
}
1054
/**
1055
 * fu_struct_ccgx_dmc_fwct_image_info_get_img_offset: (skip):
1056
 **/
1057
guint32
1058
fu_struct_ccgx_dmc_fwct_image_info_get_img_offset(const FuStructCcgxDmcFwctImageInfo *st)
1059
2.47k
{
1060
2.47k
    g_return_val_if_fail(st != NULL, 0x0);
1061
2.47k
    return fu_memread_uint32(st->data + 16, G_LITTLE_ENDIAN);
1062
2.47k
}
1063
/**
1064
 * fu_struct_ccgx_dmc_fwct_image_info_get_img_size: (skip):
1065
 **/
1066
guint32
1067
fu_struct_ccgx_dmc_fwct_image_info_get_img_size(const FuStructCcgxDmcFwctImageInfo *st)
1068
0
{
1069
0
    g_return_val_if_fail(st != NULL, 0x0);
1070
0
    return fu_memread_uint32(st->data + 20, G_LITTLE_ENDIAN);
1071
0
}
1072
/**
1073
 * fu_struct_ccgx_dmc_fwct_image_info_get_img_digest: (skip):
1074
 **/
1075
const guint8 *
1076
fu_struct_ccgx_dmc_fwct_image_info_get_img_digest(const FuStructCcgxDmcFwctImageInfo *st, gsize *bufsz)
1077
1.99k
{
1078
1.99k
    g_return_val_if_fail(st != NULL, NULL);
1079
1.99k
    if (bufsz != NULL)
1080
1.99k
        *bufsz = 32;
1081
1.99k
    return st->data + 24;
1082
1.99k
}
1083
/**
1084
 * fu_struct_ccgx_dmc_fwct_image_info_get_num_img_segments: (skip):
1085
 **/
1086
guint8
1087
fu_struct_ccgx_dmc_fwct_image_info_get_num_img_segments(const FuStructCcgxDmcFwctImageInfo *st)
1088
2.47k
{
1089
2.47k
    g_return_val_if_fail(st != NULL, 0x0);
1090
2.47k
    return st->data[56];
1091
2.47k
}
1092
1093
/* setters */
1094
/**
1095
 * fu_struct_ccgx_dmc_fwct_image_info_set_device_type: (skip):
1096
 **/
1097
void
1098
fu_struct_ccgx_dmc_fwct_image_info_set_device_type(FuStructCcgxDmcFwctImageInfo *st, guint8 value)
1099
0
{
1100
0
    g_return_if_fail(st != NULL);
1101
0
    st->data[0] = value;
1102
0
}
1103
/**
1104
 * fu_struct_ccgx_dmc_fwct_image_info_set_img_type: (skip):
1105
 **/
1106
void
1107
fu_struct_ccgx_dmc_fwct_image_info_set_img_type(FuStructCcgxDmcFwctImageInfo *st, guint8 value)
1108
0
{
1109
0
    g_return_if_fail(st != NULL);
1110
0
    st->data[1] = value;
1111
0
}
1112
/**
1113
 * fu_struct_ccgx_dmc_fwct_image_info_set_comp_id: (skip):
1114
 **/
1115
void
1116
fu_struct_ccgx_dmc_fwct_image_info_set_comp_id(FuStructCcgxDmcFwctImageInfo *st, guint8 value)
1117
0
{
1118
0
    g_return_if_fail(st != NULL);
1119
0
    st->data[2] = value;
1120
0
}
1121
/**
1122
 * fu_struct_ccgx_dmc_fwct_image_info_set_row_size: (skip):
1123
 **/
1124
void
1125
fu_struct_ccgx_dmc_fwct_image_info_set_row_size(FuStructCcgxDmcFwctImageInfo *st, guint8 value)
1126
0
{
1127
0
    g_return_if_fail(st != NULL);
1128
0
    st->data[3] = value;
1129
0
}
1130
/**
1131
 * fu_struct_ccgx_dmc_fwct_image_info_set_fw_version: (skip):
1132
 **/
1133
void
1134
fu_struct_ccgx_dmc_fwct_image_info_set_fw_version(FuStructCcgxDmcFwctImageInfo *st, guint32 value)
1135
0
{
1136
0
    g_return_if_fail(st != NULL);
1137
0
    fu_memwrite_uint32(st->data + 8, value, G_LITTLE_ENDIAN);
1138
0
}
1139
/**
1140
 * fu_struct_ccgx_dmc_fwct_image_info_set_app_version: (skip):
1141
 **/
1142
void
1143
fu_struct_ccgx_dmc_fwct_image_info_set_app_version(FuStructCcgxDmcFwctImageInfo *st, guint32 value)
1144
0
{
1145
0
    g_return_if_fail(st != NULL);
1146
0
    fu_memwrite_uint32(st->data + 12, value, G_LITTLE_ENDIAN);
1147
0
}
1148
/**
1149
 * fu_struct_ccgx_dmc_fwct_image_info_set_img_offset: (skip):
1150
 **/
1151
void
1152
fu_struct_ccgx_dmc_fwct_image_info_set_img_offset(FuStructCcgxDmcFwctImageInfo *st, guint32 value)
1153
0
{
1154
0
    g_return_if_fail(st != NULL);
1155
0
    fu_memwrite_uint32(st->data + 16, value, G_LITTLE_ENDIAN);
1156
0
}
1157
/**
1158
 * fu_struct_ccgx_dmc_fwct_image_info_set_img_size: (skip):
1159
 **/
1160
void
1161
fu_struct_ccgx_dmc_fwct_image_info_set_img_size(FuStructCcgxDmcFwctImageInfo *st, guint32 value)
1162
0
{
1163
0
    g_return_if_fail(st != NULL);
1164
0
    fu_memwrite_uint32(st->data + 20, value, G_LITTLE_ENDIAN);
1165
0
}
1166
/**
1167
 * fu_struct_ccgx_dmc_fwct_image_info_set_img_digest: (skip):
1168
 **/
1169
gboolean
1170
fu_struct_ccgx_dmc_fwct_image_info_set_img_digest(FuStructCcgxDmcFwctImageInfo *st, const guint8 *buf, gsize bufsz, GError **error)
1171
0
{
1172
0
    g_return_val_if_fail(st != NULL, FALSE);
1173
0
    g_return_val_if_fail(buf != NULL, FALSE);
1174
0
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
1175
0
    return fu_memcpy_safe(st->data, st->len, 24, buf, bufsz, 0x0, bufsz, error);
1176
0
}
1177
/**
1178
 * fu_struct_ccgx_dmc_fwct_image_info_set_num_img_segments: (skip):
1179
 **/
1180
void
1181
fu_struct_ccgx_dmc_fwct_image_info_set_num_img_segments(FuStructCcgxDmcFwctImageInfo *st, guint8 value)
1182
0
{
1183
0
    g_return_if_fail(st != NULL);
1184
0
    st->data[56] = value;
1185
0
}
1186
/**
1187
 * fu_struct_ccgx_dmc_fwct_image_info_new: (skip):
1188
 **/
1189
FuStructCcgxDmcFwctImageInfo *
1190
fu_struct_ccgx_dmc_fwct_image_info_new(void)
1191
0
{
1192
0
    FuStructCcgxDmcFwctImageInfo *st = g_byte_array_sized_new(60);
1193
0
    fu_byte_array_set_size(st, 60, 0x0);
1194
0
    return st;
1195
0
}
1196
/**
1197
 * fu_struct_ccgx_dmc_fwct_image_info_to_string: (skip):
1198
 **/
1199
static gchar *
1200
fu_struct_ccgx_dmc_fwct_image_info_to_string(const FuStructCcgxDmcFwctImageInfo *st)
1201
0
{
1202
0
    g_autoptr(GString) str = g_string_new("FuStructCcgxDmcFwctImageInfo:\n");
1203
0
    g_return_val_if_fail(st != NULL, NULL);
1204
0
    g_string_append_printf(str, "  device_type: 0x%x\n",
1205
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_device_type(st));
1206
0
    g_string_append_printf(str, "  img_type: 0x%x\n",
1207
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_img_type(st));
1208
0
    g_string_append_printf(str, "  comp_id: 0x%x\n",
1209
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_comp_id(st));
1210
0
    g_string_append_printf(str, "  row_size: 0x%x\n",
1211
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_row_size(st));
1212
0
    g_string_append_printf(str, "  fw_version: 0x%x\n",
1213
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_fw_version(st));
1214
0
    g_string_append_printf(str, "  app_version: 0x%x\n",
1215
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_app_version(st));
1216
0
    g_string_append_printf(str, "  img_offset: 0x%x\n",
1217
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_img_offset(st));
1218
0
    g_string_append_printf(str, "  img_size: 0x%x\n",
1219
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_img_size(st));
1220
0
    {
1221
0
        gsize bufsz = 0;
1222
0
        const guint8 *buf = fu_struct_ccgx_dmc_fwct_image_info_get_img_digest(st, &bufsz);
1223
0
        g_autoptr(GString) tmp = g_string_new(NULL);
1224
0
        for (gsize i = 0; i < bufsz; i++)
1225
0
            g_string_append_printf(tmp, "%02X", buf[i]);
1226
0
        g_string_append_printf(str, "  img_digest: 0x%s\n", tmp->str);
1227
0
    }
1228
0
    g_string_append_printf(str, "  num_img_segments: 0x%x\n",
1229
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_num_img_segments(st));
1230
0
    if (str->len > 0)
1231
0
        g_string_set_size(str, str->len - 1);
1232
0
    return g_string_free(g_steal_pointer(&str), FALSE);
1233
0
}
1234
static gboolean
1235
fu_struct_ccgx_dmc_fwct_image_info_validate_internal(FuStructCcgxDmcFwctImageInfo *st, GError **error)
1236
2.49k
{
1237
2.49k
    g_return_val_if_fail(st != NULL, FALSE);
1238
2.49k
    return TRUE;
1239
2.49k
}
1240
static gboolean
1241
fu_struct_ccgx_dmc_fwct_image_info_parse_internal(FuStructCcgxDmcFwctImageInfo *st, GError **error)
1242
2.49k
{
1243
2.49k
    if (!fu_struct_ccgx_dmc_fwct_image_info_validate_internal(st, error))
1244
0
        return FALSE;
1245
2.49k
    if (g_getenv("FWUPD_VERBOSE") != NULL) {
1246
0
        g_autofree gchar *str = fu_struct_ccgx_dmc_fwct_image_info_to_string(st);
1247
0
        g_debug("%s", str);
1248
0
    }
1249
2.49k
    return TRUE;
1250
2.49k
}
1251
/**
1252
 * fu_struct_ccgx_dmc_fwct_image_info_parse_stream: (skip):
1253
 **/
1254
FuStructCcgxDmcFwctImageInfo *
1255
fu_struct_ccgx_dmc_fwct_image_info_parse_stream(GInputStream *stream, gsize offset, GError **error)
1256
2.66k
{
1257
2.66k
    g_autoptr(GByteArray) st = NULL;
1258
2.66k
    st = fu_input_stream_read_byte_array(stream, offset, 60, NULL, error);
1259
2.66k
    if (st == NULL) {
1260
121
        g_prefix_error(error, "FuStructCcgxDmcFwctImageInfo failed read of 0x%x: ", (guint) 60);
1261
121
        return NULL;
1262
121
    }
1263
2.54k
    if (st->len != 60) {
1264
50
        g_set_error(error,
1265
50
                    FWUPD_ERROR,
1266
50
                    FWUPD_ERROR_INVALID_DATA,
1267
50
                    "FuStructCcgxDmcFwctImageInfo requested 0x%x and got 0x%x",
1268
50
                    (guint) 60,
1269
50
                    (guint) st->len);
1270
50
        return NULL;
1271
50
    }
1272
2.49k
    if (!fu_struct_ccgx_dmc_fwct_image_info_parse_internal(st, error))
1273
0
        return NULL;
1274
2.49k
    return g_steal_pointer(&st);
1275
2.49k
}
1276
/* getters */
1277
/**
1278
 * fu_struct_ccgx_dmc_fwct_segmentation_info_get_img_id: (skip):
1279
 **/
1280
guint8
1281
fu_struct_ccgx_dmc_fwct_segmentation_info_get_img_id(const FuStructCcgxDmcFwctSegmentationInfo *st)
1282
0
{
1283
0
    g_return_val_if_fail(st != NULL, 0x0);
1284
0
    return st->data[0];
1285
0
}
1286
/**
1287
 * fu_struct_ccgx_dmc_fwct_segmentation_info_get_type: (skip):
1288
 **/
1289
guint8
1290
fu_struct_ccgx_dmc_fwct_segmentation_info_get_type(const FuStructCcgxDmcFwctSegmentationInfo *st)
1291
0
{
1292
0
    g_return_val_if_fail(st != NULL, 0x0);
1293
0
    return st->data[1];
1294
0
}
1295
/**
1296
 * fu_struct_ccgx_dmc_fwct_segmentation_info_get_start_row: (skip):
1297
 **/
1298
guint16
1299
fu_struct_ccgx_dmc_fwct_segmentation_info_get_start_row(const FuStructCcgxDmcFwctSegmentationInfo *st)
1300
24.0k
{
1301
24.0k
    g_return_val_if_fail(st != NULL, 0x0);
1302
24.0k
    return fu_memread_uint16(st->data + 2, G_LITTLE_ENDIAN);
1303
24.0k
}
1304
/**
1305
 * fu_struct_ccgx_dmc_fwct_segmentation_info_get_num_rows: (skip):
1306
 **/
1307
guint16
1308
fu_struct_ccgx_dmc_fwct_segmentation_info_get_num_rows(const FuStructCcgxDmcFwctSegmentationInfo *st)
1309
24.0k
{
1310
24.0k
    g_return_val_if_fail(st != NULL, 0x0);
1311
24.0k
    return fu_memread_uint16(st->data + 4, G_LITTLE_ENDIAN);
1312
24.0k
}
1313
1314
/* setters */
1315
/**
1316
 * fu_struct_ccgx_dmc_fwct_segmentation_info_set_img_id: (skip):
1317
 **/
1318
void
1319
fu_struct_ccgx_dmc_fwct_segmentation_info_set_img_id(FuStructCcgxDmcFwctSegmentationInfo *st, guint8 value)
1320
0
{
1321
0
    g_return_if_fail(st != NULL);
1322
0
    st->data[0] = value;
1323
0
}
1324
/**
1325
 * fu_struct_ccgx_dmc_fwct_segmentation_info_set_type: (skip):
1326
 **/
1327
void
1328
fu_struct_ccgx_dmc_fwct_segmentation_info_set_type(FuStructCcgxDmcFwctSegmentationInfo *st, guint8 value)
1329
0
{
1330
0
    g_return_if_fail(st != NULL);
1331
0
    st->data[1] = value;
1332
0
}
1333
/**
1334
 * fu_struct_ccgx_dmc_fwct_segmentation_info_set_start_row: (skip):
1335
 **/
1336
void
1337
fu_struct_ccgx_dmc_fwct_segmentation_info_set_start_row(FuStructCcgxDmcFwctSegmentationInfo *st, guint16 value)
1338
0
{
1339
0
    g_return_if_fail(st != NULL);
1340
0
    fu_memwrite_uint16(st->data + 2, value, G_LITTLE_ENDIAN);
1341
0
}
1342
/**
1343
 * fu_struct_ccgx_dmc_fwct_segmentation_info_set_num_rows: (skip):
1344
 **/
1345
void
1346
fu_struct_ccgx_dmc_fwct_segmentation_info_set_num_rows(FuStructCcgxDmcFwctSegmentationInfo *st, guint16 value)
1347
0
{
1348
0
    g_return_if_fail(st != NULL);
1349
0
    fu_memwrite_uint16(st->data + 4, value, G_LITTLE_ENDIAN);
1350
0
}
1351
/**
1352
 * fu_struct_ccgx_dmc_fwct_segmentation_info_new: (skip):
1353
 **/
1354
FuStructCcgxDmcFwctSegmentationInfo *
1355
fu_struct_ccgx_dmc_fwct_segmentation_info_new(void)
1356
0
{
1357
0
    FuStructCcgxDmcFwctSegmentationInfo *st = g_byte_array_sized_new(8);
1358
0
    fu_byte_array_set_size(st, 8, 0x0);
1359
0
    return st;
1360
0
}
1361
/**
1362
 * fu_struct_ccgx_dmc_fwct_segmentation_info_to_string: (skip):
1363
 **/
1364
static gchar *
1365
fu_struct_ccgx_dmc_fwct_segmentation_info_to_string(const FuStructCcgxDmcFwctSegmentationInfo *st)
1366
0
{
1367
0
    g_autoptr(GString) str = g_string_new("FuStructCcgxDmcFwctSegmentationInfo:\n");
1368
0
    g_return_val_if_fail(st != NULL, NULL);
1369
0
    g_string_append_printf(str, "  img_id: 0x%x\n",
1370
0
                           (guint) fu_struct_ccgx_dmc_fwct_segmentation_info_get_img_id(st));
1371
0
    g_string_append_printf(str, "  type: 0x%x\n",
1372
0
                           (guint) fu_struct_ccgx_dmc_fwct_segmentation_info_get_type(st));
1373
0
    g_string_append_printf(str, "  start_row: 0x%x\n",
1374
0
                           (guint) fu_struct_ccgx_dmc_fwct_segmentation_info_get_start_row(st));
1375
0
    g_string_append_printf(str, "  num_rows: 0x%x\n",
1376
0
                           (guint) fu_struct_ccgx_dmc_fwct_segmentation_info_get_num_rows(st));
1377
0
    if (str->len > 0)
1378
0
        g_string_set_size(str, str->len - 1);
1379
0
    return g_string_free(g_steal_pointer(&str), FALSE);
1380
0
}
1381
static gboolean
1382
fu_struct_ccgx_dmc_fwct_segmentation_info_validate_internal(FuStructCcgxDmcFwctSegmentationInfo *st, GError **error)
1383
24.0k
{
1384
24.0k
    g_return_val_if_fail(st != NULL, FALSE);
1385
24.0k
    return TRUE;
1386
24.0k
}
1387
static gboolean
1388
fu_struct_ccgx_dmc_fwct_segmentation_info_parse_internal(FuStructCcgxDmcFwctSegmentationInfo *st, GError **error)
1389
24.0k
{
1390
24.0k
    if (!fu_struct_ccgx_dmc_fwct_segmentation_info_validate_internal(st, error))
1391
0
        return FALSE;
1392
24.0k
    if (g_getenv("FWUPD_VERBOSE") != NULL) {
1393
0
        g_autofree gchar *str = fu_struct_ccgx_dmc_fwct_segmentation_info_to_string(st);
1394
0
        g_debug("%s", str);
1395
0
    }
1396
24.0k
    return TRUE;
1397
24.0k
}
1398
/**
1399
 * fu_struct_ccgx_dmc_fwct_segmentation_info_parse_stream: (skip):
1400
 **/
1401
FuStructCcgxDmcFwctSegmentationInfo *
1402
fu_struct_ccgx_dmc_fwct_segmentation_info_parse_stream(GInputStream *stream, gsize offset, GError **error)
1403
24.2k
{
1404
24.2k
    g_autoptr(GByteArray) st = NULL;
1405
24.2k
    st = fu_input_stream_read_byte_array(stream, offset, 8, NULL, error);
1406
24.2k
    if (st == NULL) {
1407
158
        g_prefix_error(error, "FuStructCcgxDmcFwctSegmentationInfo failed read of 0x%x: ", (guint) 8);
1408
158
        return NULL;
1409
158
    }
1410
24.0k
    if (st->len != 8) {
1411
35
        g_set_error(error,
1412
35
                    FWUPD_ERROR,
1413
35
                    FWUPD_ERROR_INVALID_DATA,
1414
35
                    "FuStructCcgxDmcFwctSegmentationInfo requested 0x%x and got 0x%x",
1415
35
                    (guint) 8,
1416
35
                    (guint) st->len);
1417
35
        return NULL;
1418
35
    }
1419
24.0k
    if (!fu_struct_ccgx_dmc_fwct_segmentation_info_parse_internal(st, error))
1420
0
        return NULL;
1421
24.0k
    return g_steal_pointer(&st);
1422
24.0k
}