# libdfu Reference Manual

## About libdfu

libdfu is a library for updating firmware on DFU-capable devices. DFU is a standardised protocol used on many millions of devices to safely update device firmware by the user. Is is designed to be easy to implement in device bootloaders and also easy to support in native host drivers. Flashing firmware using DFU is supported in Windows, Linux and OS-X.

Updating firmware on a device is typically done using fwupd or by a session application like GNOME Software. You can also use dfu-util which may support mode device types than `dfu-tool` supplied by fwupd.

`libdfu` provides a medium-level API which is available for all languages that support GObject Introspection. It supports cancellation using `GCancellable` and erro reporting using `GError`. To download a device using the API it is as simple as getting a `GUsbDevice` and then doing something like this:

    dfu_firmware = dfu_firmware_new ();
    if (!dfu_firmware_parse_data (dfu_firmware, blob_fw,
                                  DFU_FIRMWARE_PARSE_FLAG_NONE, error))
            return FALSE;
    dfu_device = dfu_device_new (dev);
    if (!dfu_device_download (dfu_device, dfu_firmware,
                              DFU_TARGET_TRANSFER_FLAG_DETACH |
                              DFU_TARGET_TRANSFER_FLAG_VERIFY |
                              DFU_TARGET_TRANSFER_FLAG_BOOT_RUNTIME,
                              cancelleable,
                              _progress_cb, userdata,
                              error))
            return FALSE;

You can read more about DFU in the official specification.

## Object Hierarchy

## libdfu

Functionality exported by libdfu.

## API Index

## Index of deprecated API