Coverage Report

Created: 2025-07-11 06:31

/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 (g_getenv("FWUPD_VERBOSE") != NULL) {
499
0
        g_autofree gchar *str = fu_struct_ccgx_dmc_devx_status_to_string(st);
500
0
        g_debug("%s", str);
501
0
    }
502
0
    if (!fu_struct_ccgx_dmc_devx_status_validate_internal(st, error))
503
0
        return FALSE;
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
6.47M
{
688
6.47M
    g_return_val_if_fail(st != NULL, 0x0);
689
6.47M
    return fu_memread_uint32(st->data + 0, G_LITTLE_ENDIAN);
690
6.47M
}
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.13k
{
697
1.13k
    g_return_val_if_fail(st != NULL, 0x0);
698
1.13k
    return fu_memread_uint16(st->data + 4, G_LITTLE_ENDIAN);
699
1.13k
}
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.12k
{
769
1.12k
    g_return_val_if_fail(st != NULL, 0x0);
770
1.12k
    return fu_memread_uint32(st->data + 32, G_LITTLE_ENDIAN);
771
1.12k
}
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.05k
{
778
1.05k
    g_return_val_if_fail(st != NULL, 0x0);
779
1.05k
    return st->data[36];
780
1.05k
}
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
229
{
789
229
    g_return_if_fail(st != NULL);
790
229
    fu_memwrite_uint32(st->data + 0, value, G_LITTLE_ENDIAN);
791
229
}
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
229
{
798
229
    g_return_if_fail(st != NULL);
799
229
    fu_memwrite_uint16(st->data + 4, value, G_LITTLE_ENDIAN);
800
229
}
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
229
{
816
229
    g_return_if_fail(st != NULL);
817
229
    st->data[7] = value;
818
229
}
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
229
{
825
229
    g_return_if_fail(st != NULL);
826
229
    st->data[8] = value;
827
229
}
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
229
{
834
229
    g_return_if_fail(st != NULL);
835
229
    st->data[9] = value;
836
229
}
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
229
{
861
229
    g_return_if_fail(st != NULL);
862
229
    fu_memwrite_uint16(st->data + 14, value, G_LITTLE_ENDIAN);
863
229
}
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
229
{
870
229
    g_return_if_fail(st != NULL);
871
229
    fu_memwrite_uint32(st->data + 32, value, G_LITTLE_ENDIAN);
872
229
}
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
229
{
879
229
    g_return_if_fail(st != NULL);
880
229
    st->data[36] = value;
881
229
}
882
/**
883
 * fu_struct_ccgx_dmc_fwct_info_new: (skip):
884
 **/
885
FuStructCcgxDmcFwctInfo *
886
fu_struct_ccgx_dmc_fwct_info_new(void)
887
229
{
888
229
    FuStructCcgxDmcFwctInfo *st = g_byte_array_sized_new(40);
889
229
    fu_byte_array_set_size(st, 40, 0x0);
890
229
    fu_struct_ccgx_dmc_fwct_info_set_signature(st, 0x54435746);
891
229
    return st;
892
229
}
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
3.23M
{
928
3.23M
    g_return_val_if_fail(st != NULL, FALSE);
929
3.23M
    if (fu_struct_ccgx_dmc_fwct_info_get_signature(st) != 0x54435746) {
930
3.23M
        g_set_error(error,
931
3.23M
                    FWUPD_ERROR,
932
3.23M
                    FWUPD_ERROR_INVALID_DATA,
933
3.23M
                    "constant FuStructCcgxDmcFwctInfo.signature was not valid, "
934
3.23M
                    "expected 0x%x and got 0x%x",
935
3.23M
                    (guint) 0x54435746,
936
3.23M
                    (guint) fu_struct_ccgx_dmc_fwct_info_get_signature(st));
937
3.23M
        return FALSE;
938
3.23M
    }
939
2.27k
    return TRUE;
940
3.23M
}
941
/**
942
 * fu_struct_ccgx_dmc_fwct_info_validate_stream: (skip):
943
 **/
944
gboolean
945
fu_struct_ccgx_dmc_fwct_info_validate_stream(GInputStream *stream, gsize offset, GError **error)
946
3.24M
{
947
3.24M
    g_autoptr(GByteArray) st = NULL;
948
3.24M
    g_return_val_if_fail(G_IS_INPUT_STREAM(stream), FALSE);
949
3.24M
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
950
3.24M
    st = fu_input_stream_read_byte_array(stream, offset, 40, NULL, error);
951
3.24M
    if (st == NULL) {
952
0
        g_prefix_error(error, "FuStructCcgxDmcFwctInfo failed read of 0x%x: ", (guint) 40);
953
0
        return FALSE;
954
0
    }
955
3.24M
    if (st->len != 40) {
956
5.42k
        g_set_error(error,
957
5.42k
                    FWUPD_ERROR,
958
5.42k
                    FWUPD_ERROR_INVALID_DATA,
959
5.42k
                    "FuStructCcgxDmcFwctInfo requested 0x%x and got 0x%x",
960
5.42k
                    (guint) 40,
961
5.42k
                    (guint) st->len);
962
5.42k
        return FALSE;
963
5.42k
    }
964
3.23M
    return fu_struct_ccgx_dmc_fwct_info_validate_internal(st, error);
965
3.24M
}
966
static gboolean
967
fu_struct_ccgx_dmc_fwct_info_parse_internal(FuStructCcgxDmcFwctInfo *st, GError **error)
968
1.13k
{
969
1.13k
    if (g_getenv("FWUPD_VERBOSE") != NULL) {
970
0
        g_autofree gchar *str = fu_struct_ccgx_dmc_fwct_info_to_string(st);
971
0
        g_debug("%s", str);
972
0
    }
973
1.13k
    if (!fu_struct_ccgx_dmc_fwct_info_validate_internal(st, error))
974
0
        return FALSE;
975
1.13k
    return TRUE;
976
1.13k
}
977
/**
978
 * fu_struct_ccgx_dmc_fwct_info_parse_stream: (skip):
979
 **/
980
FuStructCcgxDmcFwctInfo *
981
fu_struct_ccgx_dmc_fwct_info_parse_stream(GInputStream *stream, gsize offset, GError **error)
982
1.13k
{
983
1.13k
    g_autoptr(GByteArray) st = NULL;
984
1.13k
    st = fu_input_stream_read_byte_array(stream, offset, 40, NULL, error);
985
1.13k
    if (st == NULL) {
986
0
        g_prefix_error(error, "FuStructCcgxDmcFwctInfo failed read of 0x%x: ", (guint) 40);
987
0
        return NULL;
988
0
    }
989
1.13k
    if (st->len != 40) {
990
0
        g_set_error(error,
991
0
                    FWUPD_ERROR,
992
0
                    FWUPD_ERROR_INVALID_DATA,
993
0
                    "FuStructCcgxDmcFwctInfo requested 0x%x and got 0x%x",
994
0
                    (guint) 40,
995
0
                    (guint) st->len);
996
0
        return NULL;
997
0
    }
998
1.13k
    if (!fu_struct_ccgx_dmc_fwct_info_parse_internal(st, error))
999
0
        return NULL;
1000
1.13k
    return g_steal_pointer(&st);
1001
1.13k
}
1002
/* getters */
1003
/**
1004
 * fu_struct_ccgx_dmc_fwct_image_info_get_device_type: (skip):
1005
 **/
1006
guint8
1007
fu_struct_ccgx_dmc_fwct_image_info_get_device_type(const FuStructCcgxDmcFwctImageInfo *st)
1008
0
{
1009
0
    g_return_val_if_fail(st != NULL, 0x0);
1010
0
    return st->data[0];
1011
0
}
1012
/**
1013
 * fu_struct_ccgx_dmc_fwct_image_info_get_img_type: (skip):
1014
 **/
1015
guint8
1016
fu_struct_ccgx_dmc_fwct_image_info_get_img_type(const FuStructCcgxDmcFwctImageInfo *st)
1017
0
{
1018
0
    g_return_val_if_fail(st != NULL, 0x0);
1019
0
    return st->data[1];
1020
0
}
1021
/**
1022
 * fu_struct_ccgx_dmc_fwct_image_info_get_comp_id: (skip):
1023
 **/
1024
guint8
1025
fu_struct_ccgx_dmc_fwct_image_info_get_comp_id(const FuStructCcgxDmcFwctImageInfo *st)
1026
0
{
1027
0
    g_return_val_if_fail(st != NULL, 0x0);
1028
0
    return st->data[2];
1029
0
}
1030
/**
1031
 * fu_struct_ccgx_dmc_fwct_image_info_get_row_size: (skip):
1032
 **/
1033
guint8
1034
fu_struct_ccgx_dmc_fwct_image_info_get_row_size(const FuStructCcgxDmcFwctImageInfo *st)
1035
2.47k
{
1036
2.47k
    g_return_val_if_fail(st != NULL, 0x0);
1037
2.47k
    return st->data[3];
1038
2.47k
}
1039
/**
1040
 * fu_struct_ccgx_dmc_fwct_image_info_get_fw_version: (skip):
1041
 **/
1042
guint32
1043
fu_struct_ccgx_dmc_fwct_image_info_get_fw_version(const FuStructCcgxDmcFwctImageInfo *st)
1044
0
{
1045
0
    g_return_val_if_fail(st != NULL, 0x0);
1046
0
    return fu_memread_uint32(st->data + 8, G_LITTLE_ENDIAN);
1047
0
}
1048
/**
1049
 * fu_struct_ccgx_dmc_fwct_image_info_get_app_version: (skip):
1050
 **/
1051
guint32
1052
fu_struct_ccgx_dmc_fwct_image_info_get_app_version(const FuStructCcgxDmcFwctImageInfo *st)
1053
0
{
1054
0
    g_return_val_if_fail(st != NULL, 0x0);
1055
0
    return fu_memread_uint32(st->data + 12, G_LITTLE_ENDIAN);
1056
0
}
1057
/**
1058
 * fu_struct_ccgx_dmc_fwct_image_info_get_img_offset: (skip):
1059
 **/
1060
guint32
1061
fu_struct_ccgx_dmc_fwct_image_info_get_img_offset(const FuStructCcgxDmcFwctImageInfo *st)
1062
2.45k
{
1063
2.45k
    g_return_val_if_fail(st != NULL, 0x0);
1064
2.45k
    return fu_memread_uint32(st->data + 16, G_LITTLE_ENDIAN);
1065
2.45k
}
1066
/**
1067
 * fu_struct_ccgx_dmc_fwct_image_info_get_img_size: (skip):
1068
 **/
1069
guint32
1070
fu_struct_ccgx_dmc_fwct_image_info_get_img_size(const FuStructCcgxDmcFwctImageInfo *st)
1071
0
{
1072
0
    g_return_val_if_fail(st != NULL, 0x0);
1073
0
    return fu_memread_uint32(st->data + 20, G_LITTLE_ENDIAN);
1074
0
}
1075
/**
1076
 * fu_struct_ccgx_dmc_fwct_image_info_get_img_digest: (skip):
1077
 **/
1078
const guint8 *
1079
fu_struct_ccgx_dmc_fwct_image_info_get_img_digest(const FuStructCcgxDmcFwctImageInfo *st, gsize *bufsz)
1080
1.99k
{
1081
1.99k
    g_return_val_if_fail(st != NULL, NULL);
1082
1.99k
    if (bufsz != NULL)
1083
1.99k
        *bufsz = 32;
1084
1.99k
    return st->data + 24;
1085
1.99k
}
1086
/**
1087
 * fu_struct_ccgx_dmc_fwct_image_info_get_num_img_segments: (skip):
1088
 **/
1089
guint8
1090
fu_struct_ccgx_dmc_fwct_image_info_get_num_img_segments(const FuStructCcgxDmcFwctImageInfo *st)
1091
2.45k
{
1092
2.45k
    g_return_val_if_fail(st != NULL, 0x0);
1093
2.45k
    return st->data[56];
1094
2.45k
}
1095
1096
/* setters */
1097
/**
1098
 * fu_struct_ccgx_dmc_fwct_image_info_set_device_type: (skip):
1099
 **/
1100
void
1101
fu_struct_ccgx_dmc_fwct_image_info_set_device_type(FuStructCcgxDmcFwctImageInfo *st, guint8 value)
1102
0
{
1103
0
    g_return_if_fail(st != NULL);
1104
0
    st->data[0] = value;
1105
0
}
1106
/**
1107
 * fu_struct_ccgx_dmc_fwct_image_info_set_img_type: (skip):
1108
 **/
1109
void
1110
fu_struct_ccgx_dmc_fwct_image_info_set_img_type(FuStructCcgxDmcFwctImageInfo *st, guint8 value)
1111
0
{
1112
0
    g_return_if_fail(st != NULL);
1113
0
    st->data[1] = value;
1114
0
}
1115
/**
1116
 * fu_struct_ccgx_dmc_fwct_image_info_set_comp_id: (skip):
1117
 **/
1118
void
1119
fu_struct_ccgx_dmc_fwct_image_info_set_comp_id(FuStructCcgxDmcFwctImageInfo *st, guint8 value)
1120
0
{
1121
0
    g_return_if_fail(st != NULL);
1122
0
    st->data[2] = value;
1123
0
}
1124
/**
1125
 * fu_struct_ccgx_dmc_fwct_image_info_set_row_size: (skip):
1126
 **/
1127
void
1128
fu_struct_ccgx_dmc_fwct_image_info_set_row_size(FuStructCcgxDmcFwctImageInfo *st, guint8 value)
1129
0
{
1130
0
    g_return_if_fail(st != NULL);
1131
0
    st->data[3] = value;
1132
0
}
1133
/**
1134
 * fu_struct_ccgx_dmc_fwct_image_info_set_fw_version: (skip):
1135
 **/
1136
void
1137
fu_struct_ccgx_dmc_fwct_image_info_set_fw_version(FuStructCcgxDmcFwctImageInfo *st, guint32 value)
1138
0
{
1139
0
    g_return_if_fail(st != NULL);
1140
0
    fu_memwrite_uint32(st->data + 8, value, G_LITTLE_ENDIAN);
1141
0
}
1142
/**
1143
 * fu_struct_ccgx_dmc_fwct_image_info_set_app_version: (skip):
1144
 **/
1145
void
1146
fu_struct_ccgx_dmc_fwct_image_info_set_app_version(FuStructCcgxDmcFwctImageInfo *st, guint32 value)
1147
0
{
1148
0
    g_return_if_fail(st != NULL);
1149
0
    fu_memwrite_uint32(st->data + 12, value, G_LITTLE_ENDIAN);
1150
0
}
1151
/**
1152
 * fu_struct_ccgx_dmc_fwct_image_info_set_img_offset: (skip):
1153
 **/
1154
void
1155
fu_struct_ccgx_dmc_fwct_image_info_set_img_offset(FuStructCcgxDmcFwctImageInfo *st, guint32 value)
1156
0
{
1157
0
    g_return_if_fail(st != NULL);
1158
0
    fu_memwrite_uint32(st->data + 16, value, G_LITTLE_ENDIAN);
1159
0
}
1160
/**
1161
 * fu_struct_ccgx_dmc_fwct_image_info_set_img_size: (skip):
1162
 **/
1163
void
1164
fu_struct_ccgx_dmc_fwct_image_info_set_img_size(FuStructCcgxDmcFwctImageInfo *st, guint32 value)
1165
0
{
1166
0
    g_return_if_fail(st != NULL);
1167
0
    fu_memwrite_uint32(st->data + 20, value, G_LITTLE_ENDIAN);
1168
0
}
1169
/**
1170
 * fu_struct_ccgx_dmc_fwct_image_info_set_img_digest: (skip):
1171
 **/
1172
gboolean
1173
fu_struct_ccgx_dmc_fwct_image_info_set_img_digest(FuStructCcgxDmcFwctImageInfo *st, const guint8 *buf, gsize bufsz, GError **error)
1174
0
{
1175
0
    g_return_val_if_fail(st != NULL, FALSE);
1176
0
    g_return_val_if_fail(buf != NULL, FALSE);
1177
0
    g_return_val_if_fail(error == NULL || *error == NULL, FALSE);
1178
0
    return fu_memcpy_safe(st->data, st->len, 24, buf, bufsz, 0x0, bufsz, error);
1179
0
}
1180
/**
1181
 * fu_struct_ccgx_dmc_fwct_image_info_set_num_img_segments: (skip):
1182
 **/
1183
void
1184
fu_struct_ccgx_dmc_fwct_image_info_set_num_img_segments(FuStructCcgxDmcFwctImageInfo *st, guint8 value)
1185
0
{
1186
0
    g_return_if_fail(st != NULL);
1187
0
    st->data[56] = value;
1188
0
}
1189
/**
1190
 * fu_struct_ccgx_dmc_fwct_image_info_new: (skip):
1191
 **/
1192
FuStructCcgxDmcFwctImageInfo *
1193
fu_struct_ccgx_dmc_fwct_image_info_new(void)
1194
0
{
1195
0
    FuStructCcgxDmcFwctImageInfo *st = g_byte_array_sized_new(60);
1196
0
    fu_byte_array_set_size(st, 60, 0x0);
1197
0
    return st;
1198
0
}
1199
/**
1200
 * fu_struct_ccgx_dmc_fwct_image_info_to_string: (skip):
1201
 **/
1202
static gchar *
1203
fu_struct_ccgx_dmc_fwct_image_info_to_string(const FuStructCcgxDmcFwctImageInfo *st)
1204
0
{
1205
0
    g_autoptr(GString) str = g_string_new("FuStructCcgxDmcFwctImageInfo:\n");
1206
0
    g_return_val_if_fail(st != NULL, NULL);
1207
0
    g_string_append_printf(str, "  device_type: 0x%x\n",
1208
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_device_type(st));
1209
0
    g_string_append_printf(str, "  img_type: 0x%x\n",
1210
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_img_type(st));
1211
0
    g_string_append_printf(str, "  comp_id: 0x%x\n",
1212
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_comp_id(st));
1213
0
    g_string_append_printf(str, "  row_size: 0x%x\n",
1214
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_row_size(st));
1215
0
    g_string_append_printf(str, "  fw_version: 0x%x\n",
1216
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_fw_version(st));
1217
0
    g_string_append_printf(str, "  app_version: 0x%x\n",
1218
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_app_version(st));
1219
0
    g_string_append_printf(str, "  img_offset: 0x%x\n",
1220
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_img_offset(st));
1221
0
    g_string_append_printf(str, "  img_size: 0x%x\n",
1222
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_img_size(st));
1223
0
    {
1224
0
        gsize bufsz = 0;
1225
0
        const guint8 *buf = fu_struct_ccgx_dmc_fwct_image_info_get_img_digest(st, &bufsz);
1226
0
        g_autoptr(GString) tmp = g_string_new(NULL);
1227
0
        for (gsize i = 0; i < bufsz; i++)
1228
0
            g_string_append_printf(tmp, "%02X", buf[i]);
1229
0
        g_string_append_printf(str, "  img_digest: 0x%s\n", tmp->str);
1230
0
    }
1231
0
    g_string_append_printf(str, "  num_img_segments: 0x%x\n",
1232
0
                           (guint) fu_struct_ccgx_dmc_fwct_image_info_get_num_img_segments(st));
1233
0
    if (str->len > 0)
1234
0
        g_string_set_size(str, str->len - 1);
1235
0
    return g_string_free(g_steal_pointer(&str), FALSE);
1236
0
}
1237
static gboolean
1238
fu_struct_ccgx_dmc_fwct_image_info_validate_internal(FuStructCcgxDmcFwctImageInfo *st, GError **error)
1239
2.47k
{
1240
2.47k
    g_return_val_if_fail(st != NULL, FALSE);
1241
2.47k
    return TRUE;
1242
2.47k
}
1243
static gboolean
1244
fu_struct_ccgx_dmc_fwct_image_info_parse_internal(FuStructCcgxDmcFwctImageInfo *st, GError **error)
1245
2.47k
{
1246
2.47k
    if (g_getenv("FWUPD_VERBOSE") != NULL) {
1247
0
        g_autofree gchar *str = fu_struct_ccgx_dmc_fwct_image_info_to_string(st);
1248
0
        g_debug("%s", str);
1249
0
    }
1250
2.47k
    if (!fu_struct_ccgx_dmc_fwct_image_info_validate_internal(st, error))
1251
0
        return FALSE;
1252
2.47k
    return TRUE;
1253
2.47k
}
1254
/**
1255
 * fu_struct_ccgx_dmc_fwct_image_info_parse_stream: (skip):
1256
 **/
1257
FuStructCcgxDmcFwctImageInfo *
1258
fu_struct_ccgx_dmc_fwct_image_info_parse_stream(GInputStream *stream, gsize offset, GError **error)
1259
2.61k
{
1260
2.61k
    g_autoptr(GByteArray) st = NULL;
1261
2.61k
    st = fu_input_stream_read_byte_array(stream, offset, 60, NULL, error);
1262
2.61k
    if (st == NULL) {
1263
96
        g_prefix_error(error, "FuStructCcgxDmcFwctImageInfo failed read of 0x%x: ", (guint) 60);
1264
96
        return NULL;
1265
96
    }
1266
2.52k
    if (st->len != 60) {
1267
45
        g_set_error(error,
1268
45
                    FWUPD_ERROR,
1269
45
                    FWUPD_ERROR_INVALID_DATA,
1270
45
                    "FuStructCcgxDmcFwctImageInfo requested 0x%x and got 0x%x",
1271
45
                    (guint) 60,
1272
45
                    (guint) st->len);
1273
45
        return NULL;
1274
45
    }
1275
2.47k
    if (!fu_struct_ccgx_dmc_fwct_image_info_parse_internal(st, error))
1276
0
        return NULL;
1277
2.47k
    return g_steal_pointer(&st);
1278
2.47k
}
1279
/* getters */
1280
/**
1281
 * fu_struct_ccgx_dmc_fwct_segmentation_info_get_img_id: (skip):
1282
 **/
1283
guint8
1284
fu_struct_ccgx_dmc_fwct_segmentation_info_get_img_id(const FuStructCcgxDmcFwctSegmentationInfo *st)
1285
0
{
1286
0
    g_return_val_if_fail(st != NULL, 0x0);
1287
0
    return st->data[0];
1288
0
}
1289
/**
1290
 * fu_struct_ccgx_dmc_fwct_segmentation_info_get_type: (skip):
1291
 **/
1292
guint8
1293
fu_struct_ccgx_dmc_fwct_segmentation_info_get_type(const FuStructCcgxDmcFwctSegmentationInfo *st)
1294
0
{
1295
0
    g_return_val_if_fail(st != NULL, 0x0);
1296
0
    return st->data[1];
1297
0
}
1298
/**
1299
 * fu_struct_ccgx_dmc_fwct_segmentation_info_get_start_row: (skip):
1300
 **/
1301
guint16
1302
fu_struct_ccgx_dmc_fwct_segmentation_info_get_start_row(const FuStructCcgxDmcFwctSegmentationInfo *st)
1303
23.5k
{
1304
23.5k
    g_return_val_if_fail(st != NULL, 0x0);
1305
23.5k
    return fu_memread_uint16(st->data + 2, G_LITTLE_ENDIAN);
1306
23.5k
}
1307
/**
1308
 * fu_struct_ccgx_dmc_fwct_segmentation_info_get_num_rows: (skip):
1309
 **/
1310
guint16
1311
fu_struct_ccgx_dmc_fwct_segmentation_info_get_num_rows(const FuStructCcgxDmcFwctSegmentationInfo *st)
1312
23.5k
{
1313
23.5k
    g_return_val_if_fail(st != NULL, 0x0);
1314
23.5k
    return fu_memread_uint16(st->data + 4, G_LITTLE_ENDIAN);
1315
23.5k
}
1316
1317
/* setters */
1318
/**
1319
 * fu_struct_ccgx_dmc_fwct_segmentation_info_set_img_id: (skip):
1320
 **/
1321
void
1322
fu_struct_ccgx_dmc_fwct_segmentation_info_set_img_id(FuStructCcgxDmcFwctSegmentationInfo *st, guint8 value)
1323
0
{
1324
0
    g_return_if_fail(st != NULL);
1325
0
    st->data[0] = value;
1326
0
}
1327
/**
1328
 * fu_struct_ccgx_dmc_fwct_segmentation_info_set_type: (skip):
1329
 **/
1330
void
1331
fu_struct_ccgx_dmc_fwct_segmentation_info_set_type(FuStructCcgxDmcFwctSegmentationInfo *st, guint8 value)
1332
0
{
1333
0
    g_return_if_fail(st != NULL);
1334
0
    st->data[1] = value;
1335
0
}
1336
/**
1337
 * fu_struct_ccgx_dmc_fwct_segmentation_info_set_start_row: (skip):
1338
 **/
1339
void
1340
fu_struct_ccgx_dmc_fwct_segmentation_info_set_start_row(FuStructCcgxDmcFwctSegmentationInfo *st, guint16 value)
1341
0
{
1342
0
    g_return_if_fail(st != NULL);
1343
0
    fu_memwrite_uint16(st->data + 2, value, G_LITTLE_ENDIAN);
1344
0
}
1345
/**
1346
 * fu_struct_ccgx_dmc_fwct_segmentation_info_set_num_rows: (skip):
1347
 **/
1348
void
1349
fu_struct_ccgx_dmc_fwct_segmentation_info_set_num_rows(FuStructCcgxDmcFwctSegmentationInfo *st, guint16 value)
1350
0
{
1351
0
    g_return_if_fail(st != NULL);
1352
0
    fu_memwrite_uint16(st->data + 4, value, G_LITTLE_ENDIAN);
1353
0
}
1354
/**
1355
 * fu_struct_ccgx_dmc_fwct_segmentation_info_new: (skip):
1356
 **/
1357
FuStructCcgxDmcFwctSegmentationInfo *
1358
fu_struct_ccgx_dmc_fwct_segmentation_info_new(void)
1359
0
{
1360
0
    FuStructCcgxDmcFwctSegmentationInfo *st = g_byte_array_sized_new(8);
1361
0
    fu_byte_array_set_size(st, 8, 0x0);
1362
0
    return st;
1363
0
}
1364
/**
1365
 * fu_struct_ccgx_dmc_fwct_segmentation_info_to_string: (skip):
1366
 **/
1367
static gchar *
1368
fu_struct_ccgx_dmc_fwct_segmentation_info_to_string(const FuStructCcgxDmcFwctSegmentationInfo *st)
1369
0
{
1370
0
    g_autoptr(GString) str = g_string_new("FuStructCcgxDmcFwctSegmentationInfo:\n");
1371
0
    g_return_val_if_fail(st != NULL, NULL);
1372
0
    g_string_append_printf(str, "  img_id: 0x%x\n",
1373
0
                           (guint) fu_struct_ccgx_dmc_fwct_segmentation_info_get_img_id(st));
1374
0
    g_string_append_printf(str, "  type: 0x%x\n",
1375
0
                           (guint) fu_struct_ccgx_dmc_fwct_segmentation_info_get_type(st));
1376
0
    g_string_append_printf(str, "  start_row: 0x%x\n",
1377
0
                           (guint) fu_struct_ccgx_dmc_fwct_segmentation_info_get_start_row(st));
1378
0
    g_string_append_printf(str, "  num_rows: 0x%x\n",
1379
0
                           (guint) fu_struct_ccgx_dmc_fwct_segmentation_info_get_num_rows(st));
1380
0
    if (str->len > 0)
1381
0
        g_string_set_size(str, str->len - 1);
1382
0
    return g_string_free(g_steal_pointer(&str), FALSE);
1383
0
}
1384
static gboolean
1385
fu_struct_ccgx_dmc_fwct_segmentation_info_validate_internal(FuStructCcgxDmcFwctSegmentationInfo *st, GError **error)
1386
23.5k
{
1387
23.5k
    g_return_val_if_fail(st != NULL, FALSE);
1388
23.5k
    return TRUE;
1389
23.5k
}
1390
static gboolean
1391
fu_struct_ccgx_dmc_fwct_segmentation_info_parse_internal(FuStructCcgxDmcFwctSegmentationInfo *st, GError **error)
1392
23.5k
{
1393
23.5k
    if (g_getenv("FWUPD_VERBOSE") != NULL) {
1394
0
        g_autofree gchar *str = fu_struct_ccgx_dmc_fwct_segmentation_info_to_string(st);
1395
0
        g_debug("%s", str);
1396
0
    }
1397
23.5k
    if (!fu_struct_ccgx_dmc_fwct_segmentation_info_validate_internal(st, error))
1398
0
        return FALSE;
1399
23.5k
    return TRUE;
1400
23.5k
}
1401
/**
1402
 * fu_struct_ccgx_dmc_fwct_segmentation_info_parse_stream: (skip):
1403
 **/
1404
FuStructCcgxDmcFwctSegmentationInfo *
1405
fu_struct_ccgx_dmc_fwct_segmentation_info_parse_stream(GInputStream *stream, gsize offset, GError **error)
1406
23.6k
{
1407
23.6k
    g_autoptr(GByteArray) st = NULL;
1408
23.6k
    st = fu_input_stream_read_byte_array(stream, offset, 8, NULL, error);
1409
23.6k
    if (st == NULL) {
1410
122
        g_prefix_error(error, "FuStructCcgxDmcFwctSegmentationInfo failed read of 0x%x: ", (guint) 8);
1411
122
        return NULL;
1412
122
    }
1413
23.5k
    if (st->len != 8) {
1414
37
        g_set_error(error,
1415
37
                    FWUPD_ERROR,
1416
37
                    FWUPD_ERROR_INVALID_DATA,
1417
37
                    "FuStructCcgxDmcFwctSegmentationInfo requested 0x%x and got 0x%x",
1418
37
                    (guint) 8,
1419
37
                    (guint) st->len);
1420
37
        return NULL;
1421
37
    }
1422
23.5k
    if (!fu_struct_ccgx_dmc_fwct_segmentation_info_parse_internal(st, error))
1423
0
        return NULL;
1424
23.5k
    return g_steal_pointer(&st);
1425
23.5k
}