### Method

# FwupdPlugin Device prepare_firmware

since: 1.1.2

#### Declaration [src]

    FuFirmware*
    fu_device_prepare_firmware (
      FuDevice* self,
      GInputStream* stream,
      FuProgress* progress,
      FuFirmwareParseFlags flags,
      GError** error
    )

#### Description [src]

Prepares the firmware by calling an optional device-specific vfunc for the device, which can do things like decompressing or parsing of the firmware data.

For all firmware, this checks the size of the firmware if limits have been set using fu_device_set_firmware_size_min(), `fu_device_set_firmware_size_max()` or using a quirk entry.

Available since: 1.1.2

#### Parameters

`stream`

  Type: `GInputStream`

  A `GInputStream`.

  The data is owned by the caller of the method.

`progress`

  Type: `FuProgress`

  No description available.

  The data is owned by the caller of the method.

`flags`

  Type: `FuFirmwareParseFlags`

  `FuFirmwareParseFlags`, e.g. `FWUPD_INSTALL_FLAG_FORCE`.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `FuFirmware`

A new `GBytes`, or `NULL` for error.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.