| Top |
| #define | DFU_TYPE_FIRMWARE |
| struct | DfuFirmwareClass |
| enum | DfuFirmwareParseFlags |
| enum | DfuFirmwareFormat |
| DfuFirmware |
This object allows reading and writing firmware files either in raw, DFU or DfuSe formats.
A DfuFirmware can be made up of several DfuImages, although typically there is only one.
See also: DfuImage
DfuFirmware *
dfu_firmware_new (void);
Creates a new DFU firmware object.
Since: 0.5.4
const gchar *
dfu_firmware_format_to_string (DfuFirmwareFormat format);
Returns a string representaiton of the format.
Since: 0.5.4
DfuFirmwareFormat
dfu_firmware_format_from_string (const gchar *format);
Returns an enumerated version of the format.
Since: 0.7.3
DfuImage * dfu_firmware_get_image (DfuFirmware *firmware,guint8 alt_setting);
Gets an image from the firmware file.
Since: 0.5.4
DfuImage * dfu_firmware_get_image_by_name (DfuFirmware *firmware,const gchar *name);
Gets an image from the firmware file.
Since: 0.5.4
DfuImage *
dfu_firmware_get_image_default (DfuFirmware *firmware);
Gets the default image from the firmware file.
Since: 0.5.4
GPtrArray *
dfu_firmware_get_images (DfuFirmware *firmware);
Gets all the images contained in this firmware file.
Since: 0.5.4
guint16
dfu_firmware_get_vid (DfuFirmware *firmware);
Gets the vendor ID.
Since: 0.5.4
guint16
dfu_firmware_get_pid (DfuFirmware *firmware);
Gets the product ID.
Since: 0.5.4
guint16
dfu_firmware_get_release (DfuFirmware *firmware);
Gets the device ID.
Since: 0.5.4
guint16
dfu_firmware_get_format (DfuFirmware *firmware);
Gets the DFU version.
Since: 0.5.4
guint32
dfu_firmware_get_size (DfuFirmware *firmware);
Gets the size of all the images in the firmware.
This only returns actual data that would be sent to the device and does not include any padding.
Since: 0.5.4
DfuCipherKind
dfu_firmware_get_cipher_kind (DfuFirmware *firmware);
Returns the kind of cipher used by the firmware file.
NOTE: this value is based on a heuristic, and may not be accurate.
The value DFU_CIPHER_KIND_NONE will be returned when the cipher
is not recognised.
Since: 0.5.4
void dfu_firmware_add_image (DfuFirmware *firmware,DfuImage *image);
Adds an image to the list of images.
Since: 0.5.4
void dfu_firmware_set_vid (DfuFirmware *firmware,guint16 vid);
Sets the vendor ID.
Since: 0.5.4
void dfu_firmware_set_pid (DfuFirmware *firmware,guint16 pid);
Sets the product ID.
Since: 0.5.4
void dfu_firmware_set_release (DfuFirmware *firmware,guint16 release);
Sets the device ID.
Since: 0.5.4
void dfu_firmware_set_format (DfuFirmware *firmware,DfuFirmwareFormat format);
Sets the DFU version in BCD format.
Since: 0.5.4
void dfu_firmware_set_cipher_kind (DfuFirmware *firmware,DfuCipherKind cipher_kind);
Sets the kind of cipher used by the firmware file.
Since: 0.6.3
gboolean dfu_firmware_parse_data (DfuFirmware *firmware,GBytes *bytes,DfuFirmwareParseFlags flags,GError **error);
Parses firmware data which may have an optional DFU suffix.
firmware |
||
bytes |
raw firmware data |
|
flags |
optional flags, e.g. |
|
error |
a GError, or |
Since: 0.5.4
gboolean dfu_firmware_parse_file (DfuFirmware *firmware,GFile *file,DfuFirmwareParseFlags flags,GCancellable *cancellable,GError **error);
Parses a DFU firmware, which may contain an optional footer.
firmware |
||
file |
a GFile to load and parse |
|
flags |
optional flags, e.g. |
|
cancellable |
a GCancellable, or |
|
error |
a GError, or |
Since: 0.5.4
GBytes * dfu_firmware_write_data (DfuFirmware *firmware,GError **error);
Writes DFU data to a data blob with a DFU-specific footer.
Since: 0.5.4
gboolean dfu_firmware_write_file (DfuFirmware *firmware,GFile *file,GCancellable *cancellable,GError **error);
Writes a DFU firmware with the optional footer.
Since: 0.5.4
gchar *
dfu_firmware_to_string (DfuFirmware *firmware);
Returns a string representaiton of the object.
Since: 0.5.4
GHashTable *
dfu_firmware_get_metadata_table (DfuFirmware *firmware);
Gets all metadata from the store.
Since: 0.6.3
const gchar * dfu_firmware_get_metadata (DfuFirmware *firmware,const gchar *key);
Gets metadata from the store with a specific key.
Since: 0.5.4
void dfu_firmware_set_metadata (DfuFirmware *firmware,const gchar *key,const gchar *value);
Sets a metadata value with a specific key.
Since: 0.5.4
void dfu_firmware_remove_metadata (DfuFirmware *firmware,const gchar *key);
Removes a metadata item from the store
Since: 0.5.4