mirror of
https://git.proxmox.com/git/fwupd
synced 2025-07-26 06:19:55 +00:00
Add dfu_firmware_format_from_string()
This commit is contained in:
parent
3667ee7b22
commit
8e7f50056f
@ -738,6 +738,32 @@ dfu_firmware_format_to_string (DfuFirmwareFormat format)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* dfu_firmware_format_from_string:
|
||||||
|
* @format: a format string, e.g. `dfuse`
|
||||||
|
*
|
||||||
|
* Returns an enumerated version of the format.
|
||||||
|
*
|
||||||
|
* Return value: a #DfuFirmwareFormat, e.g. %DFU_FIRMWARE_FORMAT_DFUSE
|
||||||
|
*
|
||||||
|
* Since: 0.7.3
|
||||||
|
**/
|
||||||
|
DfuFirmwareFormat
|
||||||
|
dfu_firmware_format_from_string (const gchar *format)
|
||||||
|
{
|
||||||
|
if (g_strcmp0 (format, "raw") == 0)
|
||||||
|
return DFU_FIRMWARE_FORMAT_RAW;
|
||||||
|
if (g_strcmp0 (format, "dfu") == 0)
|
||||||
|
return DFU_FIRMWARE_FORMAT_DFU_1_0;
|
||||||
|
if (g_strcmp0 (format, "dfuse") == 0)
|
||||||
|
return DFU_FIRMWARE_FORMAT_DFUSE;
|
||||||
|
if (g_strcmp0 (format, "ihex") == 0)
|
||||||
|
return DFU_FIRMWARE_FORMAT_INTEL_HEX;
|
||||||
|
if (g_strcmp0 (format, "elf") == 0)
|
||||||
|
return DFU_FIRMWARE_FORMAT_ELF;
|
||||||
|
return DFU_FIRMWARE_FORMAT_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* dfu_firmware_get_cipher_kind:
|
* dfu_firmware_get_cipher_kind:
|
||||||
* @firmware: a #DfuFirmware
|
* @firmware: a #DfuFirmware
|
||||||
|
@ -92,6 +92,7 @@ typedef enum {
|
|||||||
DfuFirmware *dfu_firmware_new (void);
|
DfuFirmware *dfu_firmware_new (void);
|
||||||
|
|
||||||
const gchar *dfu_firmware_format_to_string (DfuFirmwareFormat format);
|
const gchar *dfu_firmware_format_to_string (DfuFirmwareFormat format);
|
||||||
|
DfuFirmwareFormat dfu_firmware_format_from_string(const gchar *format);
|
||||||
|
|
||||||
DfuImage *dfu_firmware_get_image (DfuFirmware *firmware,
|
DfuImage *dfu_firmware_get_image (DfuFirmware *firmware,
|
||||||
guint8 alt_setting);
|
guint8 alt_setting);
|
||||||
|
Loading…
Reference in New Issue
Block a user