mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-16 10:06:41 +00:00
trivial: Export the CFU enum conversion functions
We need these in the CFU plugin too.
This commit is contained in:
parent
86d92f2c93
commit
35fff9684e
@ -6,10 +6,20 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "fu-elanfp-common.h"
|
#include "fu-cfu-common.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fu_cfu_device_reject_to_string:
|
||||||
|
* @val: a enumerated value, e.g. %FU_CFU_DEVICE_REJECT_OLD_FIRMWARE
|
||||||
|
*
|
||||||
|
* Converts an enumerated reject type to a string.
|
||||||
|
*
|
||||||
|
* Returns: a string, or `unknown` for invalid
|
||||||
|
*
|
||||||
|
* Since: 1.7.0
|
||||||
|
**/
|
||||||
const gchar *
|
const gchar *
|
||||||
fu_elanfp_cfu_device_reject_to_string(guint8 val)
|
fu_cfu_device_reject_to_string(guint8 val)
|
||||||
{
|
{
|
||||||
if (val == FU_CFU_DEVICE_REJECT_OLD_FIRMWARE)
|
if (val == FU_CFU_DEVICE_REJECT_OLD_FIRMWARE)
|
||||||
return "old-firmware";
|
return "old-firmware";
|
||||||
@ -28,8 +38,18 @@ fu_elanfp_cfu_device_reject_to_string(guint8 val)
|
|||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fu_cfu_device_offer_to_string:
|
||||||
|
* @val: a enumerated value, e.g. %FU_CFU_DEVICE_OFFER_ACCEPT
|
||||||
|
*
|
||||||
|
* Converts an enumerated offer type to a string.
|
||||||
|
*
|
||||||
|
* Returns: a string, or `unknown` for invalid
|
||||||
|
*
|
||||||
|
* Since: 1.7.0
|
||||||
|
**/
|
||||||
const gchar *
|
const gchar *
|
||||||
fu_elanfp_cfu_device_offer_to_string(guint8 val)
|
fu_cfu_device_offer_to_string(guint8 val)
|
||||||
{
|
{
|
||||||
if (val == FU_CFU_DEVICE_OFFER_SKIP)
|
if (val == FU_CFU_DEVICE_OFFER_SKIP)
|
||||||
return "skip";
|
return "skip";
|
||||||
@ -46,8 +66,18 @@ fu_elanfp_cfu_device_offer_to_string(guint8 val)
|
|||||||
return "unknown";
|
return "unknown";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fu_cfu_device_status_to_string:
|
||||||
|
* @val: a enumerated value, e.g. %FU_CFU_DEVICE_OFFER_ACCEPT
|
||||||
|
*
|
||||||
|
* Converts an enumerated status type to a string.
|
||||||
|
*
|
||||||
|
* Returns: a string, or `unknown` for invalid
|
||||||
|
*
|
||||||
|
* Since: 1.7.0
|
||||||
|
**/
|
||||||
const gchar *
|
const gchar *
|
||||||
fu_elanfp_cfu_device_status_to_string(guint8 val)
|
fu_cfu_device_status_to_string(guint8 val)
|
||||||
{
|
{
|
||||||
if (val == FU_CFU_DEVICE_STATUS_SUCCESS)
|
if (val == FU_CFU_DEVICE_STATUS_SUCCESS)
|
||||||
return "success";
|
return "success";
|
@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <fwupdplugin.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
#define FU_CFU_DEVICE_OFFER_SKIP 0x00
|
#define FU_CFU_DEVICE_OFFER_SKIP 0x00
|
||||||
#define FU_CFU_DEVICE_OFFER_ACCEPT 0x01
|
#define FU_CFU_DEVICE_OFFER_ACCEPT 0x01
|
||||||
@ -40,8 +40,8 @@
|
|||||||
#define FU_CFU_DEVICE_REJECT_DEBUG_SAME_VERSION 0xE2
|
#define FU_CFU_DEVICE_REJECT_DEBUG_SAME_VERSION 0xE2
|
||||||
|
|
||||||
const gchar *
|
const gchar *
|
||||||
fu_elanfp_cfu_device_reject_to_string(guint8 val);
|
fu_cfu_device_reject_to_string(guint8 val);
|
||||||
const gchar *
|
const gchar *
|
||||||
fu_elanfp_cfu_device_status_to_string(guint8 val);
|
fu_cfu_device_status_to_string(guint8 val);
|
||||||
const gchar *
|
const gchar *
|
||||||
fu_elanfp_cfu_device_offer_to_string(guint8 val);
|
fu_cfu_device_offer_to_string(guint8 val);
|
@ -11,6 +11,7 @@
|
|||||||
#include <libfwupdplugin/fu-archive.h>
|
#include <libfwupdplugin/fu-archive.h>
|
||||||
#include <libfwupdplugin/fu-backend.h>
|
#include <libfwupdplugin/fu-backend.h>
|
||||||
#include <libfwupdplugin/fu-bluez-device.h>
|
#include <libfwupdplugin/fu-bluez-device.h>
|
||||||
|
#include <libfwupdplugin/fu-cfu-common.h>
|
||||||
#include <libfwupdplugin/fu-cfu-offer.h>
|
#include <libfwupdplugin/fu-cfu-offer.h>
|
||||||
#include <libfwupdplugin/fu-cfu-payload.h>
|
#include <libfwupdplugin/fu-cfu-payload.h>
|
||||||
#include <libfwupdplugin/fu-chunk.h>
|
#include <libfwupdplugin/fu-chunk.h>
|
||||||
|
@ -861,6 +861,9 @@ LIBFWUPDPLUGIN_1.6.2 {
|
|||||||
|
|
||||||
LIBFWUPDPLUGIN_1.7.0 {
|
LIBFWUPDPLUGIN_1.7.0 {
|
||||||
global:
|
global:
|
||||||
|
fu_cfu_device_offer_to_string;
|
||||||
|
fu_cfu_device_reject_to_string;
|
||||||
|
fu_cfu_device_status_to_string;
|
||||||
fu_cfu_offer_get_bank;
|
fu_cfu_offer_get_bank;
|
||||||
fu_cfu_offer_get_component_id;
|
fu_cfu_offer_get_component_id;
|
||||||
fu_cfu_offer_get_force_ignore_version;
|
fu_cfu_offer_get_force_ignore_version;
|
||||||
|
@ -18,6 +18,7 @@ fwupdplugin_src = [
|
|||||||
'fu-device-locker.c', # fuzzing
|
'fu-device-locker.c', # fuzzing
|
||||||
'fu-device.c', # fuzzing
|
'fu-device.c', # fuzzing
|
||||||
'fu-dfu-firmware.c', # fuzzing
|
'fu-dfu-firmware.c', # fuzzing
|
||||||
|
'fu-cfu-common.c', # fuzzing
|
||||||
'fu-cfu-offer.c', # fuzzing
|
'fu-cfu-offer.c', # fuzzing
|
||||||
'fu-cfu-payload.c', # fuzzing
|
'fu-cfu-payload.c', # fuzzing
|
||||||
'fu-volume.c', # fuzzing
|
'fu-volume.c', # fuzzing
|
||||||
@ -84,6 +85,7 @@ fwupdplugin_headers = [
|
|||||||
'fu-device-metadata.h',
|
'fu-device-metadata.h',
|
||||||
'fu-device-locker.h',
|
'fu-device-locker.h',
|
||||||
'fu-dfu-firmware.h',
|
'fu-dfu-firmware.h',
|
||||||
|
'fu-cfu-common.h',
|
||||||
'fu-cfu-offer.h',
|
'fu-cfu-offer.h',
|
||||||
'fu-cfu-payload.h',
|
'fu-cfu-payload.h',
|
||||||
'fu-efi-common.h',
|
'fu-efi-common.h',
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "fu-elanfp-common.h"
|
|
||||||
#include "fu-elanfp-device.h"
|
#include "fu-elanfp-device.h"
|
||||||
#include "fu-elanfp-firmware.h"
|
#include "fu-elanfp-firmware.h"
|
||||||
|
|
||||||
@ -339,7 +338,7 @@ fu_elanfp_device_write_payload(FuElanfpDevice *self,
|
|||||||
G_IO_ERROR_INVALID_DATA,
|
G_IO_ERROR_INVALID_DATA,
|
||||||
"failed to send chunk %u: %s",
|
"failed to send chunk %u: %s",
|
||||||
i + 1,
|
i + 1,
|
||||||
fu_elanfp_cfu_device_status_to_string(recvbuf[5]));
|
fu_cfu_device_status_to_string(recvbuf[5]));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
fu_progress_step_done(progress);
|
fu_progress_step_done(progress);
|
||||||
@ -397,8 +396,8 @@ fu_elanfp_device_write_firmware(FuDevice *device,
|
|||||||
}
|
}
|
||||||
g_debug("offer-%s status:%s reject:%s",
|
g_debug("offer-%s status:%s reject:%s",
|
||||||
items[i].tag,
|
items[i].tag,
|
||||||
fu_elanfp_cfu_device_offer_to_string(recvbuf[13]),
|
fu_cfu_device_offer_to_string(recvbuf[13]),
|
||||||
fu_elanfp_cfu_device_reject_to_string(recvbuf[9]));
|
fu_cfu_device_reject_to_string(recvbuf[9]));
|
||||||
if (recvbuf[13] == FU_CFU_DEVICE_OFFER_ACCEPT)
|
if (recvbuf[13] == FU_CFU_DEVICE_OFFER_ACCEPT)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -8,7 +8,6 @@ shared_module('fu_plugin_elanfp',
|
|||||||
fu_hash,
|
fu_hash,
|
||||||
sources : [
|
sources : [
|
||||||
'fu-plugin-elanfp.c',
|
'fu-plugin-elanfp.c',
|
||||||
'fu-elanfp-common.c',
|
|
||||||
'fu-elanfp-device.c',
|
'fu-elanfp-device.c',
|
||||||
'fu-elanfp-firmware.c' # fuzzing
|
'fu-elanfp-firmware.c' # fuzzing
|
||||||
],
|
],
|
||||||
|
Loading…
Reference in New Issue
Block a user