mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-13 03:51:41 +00:00
dfu: Support ihex files with leading comments
Also look for the EOF in the file.
This commit is contained in:
parent
650eea91ee
commit
f6a6fe8ec5
@ -33,9 +33,17 @@ dfu_firmware_detect_ihex (GBytes *bytes)
|
|||||||
data = (guint8 *) g_bytes_get_data (bytes, &len);
|
data = (guint8 *) g_bytes_get_data (bytes, &len);
|
||||||
if (len < 12)
|
if (len < 12)
|
||||||
return DFU_FIRMWARE_FORMAT_UNKNOWN;
|
return DFU_FIRMWARE_FORMAT_UNKNOWN;
|
||||||
if (data[0] != ':')
|
|
||||||
return DFU_FIRMWARE_FORMAT_UNKNOWN;
|
/* match the first char */
|
||||||
return DFU_FIRMWARE_FORMAT_INTEL_HEX;
|
if (data[0] == ':')
|
||||||
|
return DFU_FIRMWARE_FORMAT_INTEL_HEX;
|
||||||
|
|
||||||
|
/* look for the EOF line */
|
||||||
|
if (g_strstr_len ((const gchar *) data, (gssize) len, ":000000") != NULL)
|
||||||
|
return DFU_FIRMWARE_FORMAT_INTEL_HEX;
|
||||||
|
|
||||||
|
/* failed */
|
||||||
|
return DFU_FIRMWARE_FORMAT_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define DFU_INHX32_RECORD_TYPE_DATA 0x00
|
#define DFU_INHX32_RECORD_TYPE_DATA 0x00
|
||||||
|
Loading…
Reference in New Issue
Block a user