fwupd/plugins/synaptics-prometheus/fu-synaprom-device.h
Richard Hughes 40cd18fa97 Allow using a per-device global percentage completion
It's actually quite hard to build a front-end for fwupd at the moment
as you're never sure when the progress bar is going to zip back to 0%
and start all over again. Some plugins go 0..100% for write, others
go 0..100% for erase, then again for write, then *again* for verify.

By creating a helper object we can easily split up the progress of the
specific task, e.g. write_firmware().

We can encode at the plugin level "the erase takes 50% of the time, the
write takes 40% and the read takes 10%". This means we can have a
progressbar which goes up just once at a consistent speed.
2021-09-13 14:28:15 +01:00

49 lines
1.3 KiB
C

/*
* Copyright (C) 2019 Richard Hughes <richard@hughsie.com>
* Copyright (C) 2019 Synaptics Inc
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#pragma once
#include <fwupdplugin.h>
#define FU_TYPE_SYNAPROM_DEVICE (fu_synaprom_device_get_type())
G_DECLARE_FINAL_TYPE(FuSynapromDevice, fu_synaprom_device, FU, SYNAPROM_DEVICE, FuUsbDevice)
#define FU_SYNAPROM_PRODUCT_PROMETHEUS 65 /* Prometheus (b1422) */
#define FU_SYNAPROM_PRODUCT_PROMETHEUSPBL 66
#define FU_SYNAPROM_PRODUCT_PROMETHEUSMSBL 67
#define FU_SYNAPROM_CMD_GET_VERSION 0x01
#define FU_SYNAPROM_CMD_BOOTLDR_PATCH 0x7d
#define FU_SYNAPROM_CMD_IOTA_FIND 0x8e
FuSynapromDevice *
fu_synaprom_device_new(FuUsbDevice *device);
gboolean
fu_synaprom_device_cmd_send(FuSynapromDevice *device,
GByteArray *request,
GByteArray *reply,
FuProgress *progress,
guint timeout_ms,
GError **error);
gboolean
fu_synaprom_device_write_fw(FuSynapromDevice *self,
GBytes *fw,
FuProgress *progress,
GError **error);
/* for self tests */
void
fu_synaprom_device_set_version(FuSynapromDevice *self,
guint8 vmajor,
guint8 vminor,
guint32 buildnum);
FuFirmware *
fu_synaprom_device_prepare_fw(FuDevice *device,
GBytes *fw,
FwupdInstallFlags flags,
GError **error);