---
name: "libfwup"
section: "3"
platform: "linux"
package: "fwupdate"
version: "12-4+deb10u4"
release: "Debian 10 (Buster)"
platforms: ["linux"]
url: "https://new.carta.tech/libfwup"
---

# libfwup(3)

library to support management of system firmware updates

## NAME

libfwup - library to support management of system firmware updates

## SYNOPSIS

```
#include <fwup.h>

int fwup_supported(void);
 - test if firmware updating is supported on the running machine
typedef struct fwup_resource_s fwup_resource;
typedef struct fwup_resource_iter_s fwup_resource_iter;
int fwup_resource_iter_create(fwup_resource_iter **iter);
int fwup_resource_iter_next(fwup_resource_iter *iter,
	fwup_resource **re);
int fwup_resource_iter_destroy(fwup_resource_iter **iter);
 - iterate the list of updateable firmware images
int fwup_set_guid(fwup_resource_iter *iter, fwup_resource **re,
	const efi_guid_t *guid);
 - manually set a guid for update
int fwup_set_guid_forced(fwup_resource_iter *iter, fwup_resource **re,
	const efi_guid_t *guid, bool force);
 - manually set a guid for update (with a force option)
void fwup_resource_free(fwup_resource *re);
 - free resource allocated by fwup_set_guid_forced()
int fwup_set_up_update(fwup_resource *re, uint64_t hw_inst, int infd);
int fwup_clear_status(fwup_resource *re);
int fwup_get_guid(fwup_resource *re, efi_guid_t **guid);
int fwup_get_fw_version(fwup_resource *re, uint32_t *version);
int fwup_get_fw_type(fwup_resource *re, uint32_t *type);
int fwup_get_lowest_supported_fw_version(fwup_resource *re,
	uint32_t *version);
int fwup_get_last_attempt_info(fwup_resource *re, uint32_t *version,
	uint32_t *status, time_t *when);
 - operate on an individual firmware entry
int fwup_get_debug_log(char **utf8, size_t *size);
 - show the debug log from the last update attempt
void fwup_use_existing_media_path(int use_existing_media_path);
 - instruct fwupdate on whether to reuse old capsule filenames on the ESP.
void fwup_set_esp_mountpoint(char *path);
 - Override detection of the mountpoint for the ESP directory
const char *fwup_get_esp_mountpoint(void);
 - Get the current mountpoint for the ESP directory
int fwup_get_ux_capsule_info(uint32_t *screen_x_size,
	uint32_t *screen_y_size);
 - get the dimensions of the screen during boot
```

## DESCRIPTION

```

```

**int** fwup\_supported**(void);** Tests if the current machine supports firmware updates

**typedef struct fwup\_resource\_s** fwup\_resource**;** **typedef struct fwup\_resource\_iter\_s** fwup\_resource\_iter**;**

**int** fwup\_resource\_iter\_create**(fwup\_resource\_iter \*\****iter***);** Create a new firmware resoure iterator *iter*.

**int** fwup\_resource\_iter\_next**(fwup\_resource\_iter \****iter***,**\
 	**fwup\_resource \*\****re***);** Get the next firmware resource *re* from iterator *iter*.

**int** fwup\_resource\_iter\_destroy**(fwup\_resource\_iter \*\****iter***);** Destroy firmware resource iterator *iter*.

**int** fwup\_set\_up\_update**(fwup\_resource \****re***, uint64\_t** *hw\_inst***, int** *infd***);** Set up an update for resource *re*, hardware instance number *hw\_inst*, with the file referenced by the file descriptor *infd*.  *infd* must support read**(3)**.

**int** fwup\_clear\_status**(fwup\_resource \****re***);** Clear the status of the firmware resource *re*.  This removes any pending attempt to update it, as well as clearing any pending error report.

**int** fwup\_get\_guid**(fwup\_resource \****re***, efi\_guid\_t \*\****guid***);** Set *guid* to the GUID which uniquely identifies firmware resource *re*.

**int** fwup\_get\_fw\_version**(fwup\_resource \****re***, uint32\_t \****version***);** Set *version* to the version of the firmware resource *re*.

\#define **FWUP\_RESOURCE\_TYPE\_UNKNOWN**         0 #define **FWUP\_RESOURCE\_TYPE\_SYSTEM\_FIRMWARE** 1 #define **FWUP\_RESOURCE\_TYPE\_DEVICE\_FIRMWARE** 2 #define **FWUP\_RESOURCE\_TYPE\_UEFI\_DRIVER**     3 **int** fwup\_get\_fw\_type**(fwup\_resource \****re***, uint32\_t \****type***);** Set *type* to the type of the firmware resource *re*.

**int** fwup\_get\_lowest\_supported\_fw\_version**(fwup\_resource \****re***,**\
 	**uint32\_t \****version***);** Set *version* to the lowest firmware version resource *re* can be updated to.

**int** fwup\_get\_last\_attempt\_info**(fwup\_resource \****re***, uint32\_t \****version***,**\
 	**uint32\_t \****status***, time\_t \****when***);** Get the status for the last attempt to update firmware resource *re*.

**int** fwup\_get\_debug\_log**(char \*\****utf8***, size\_t \****size***);** Get the debug log from the last update attempt.  This allocates a buffer which the caller must free.

**void** fwup\_print\_update\_info**(void);** Print the information of firmware update status.

**void** fwup\_use\_existing\_media\_path**(int** *use\_existing\_media\_path***);** Instruct fwupdate on whether to reuse old capsule filenames on the ESP.

**void** fwup\_set\_esp\_mountpoint**(char \****path***);** Override detection of the mountpoint for the ESP directory.

**int** fwup\_get\_ux\_capsule\_info**(uint32\_t \****screen\_x\_size***,**\
 	**uint32\_t \****screen\_y\_size***);** Get the dimensions of the screen during boot.

## AUTHORS

```
Peter Jones <pjones@redhat.com>
```

## SEE ALSO

[**errno**(3)](/errno/3.md), [**strerror**(3)](/strerror/3.md), [**strerror\_r**(3)](/strerror_r/3.md)
