File fwupdate-list-firmware-types.patch of Package fwupdate.16146
From 2ddfb331280ddcb8e42ed74d3640eac509427548 Mon Sep 17 00:00:00 2001
From: Ivan Hu <ivan.hu@canonical.com>
Date: Thu, 22 Jun 2017 13:16:40 +0800
Subject: [PATCH] show type on listing suppored firmware updates
Also show type when list supported firmware updates, help users to distinguish
which GUID they would like to use.
Signed-off-by: Ivan Hu <ivan.hu@canonical.com>
---
linux/fwupdate.c | 24 ++++++++++++++++++++++--
1 file changed, 22 insertions(+), 2 deletions(-)
diff --git a/linux/fwupdate.c b/linux/fwupdate.c
index eaf07be..1df0acd 100644
--- a/linux/fwupdate.c
+++ b/linux/fwupdate.c
@@ -50,6 +50,8 @@ print_system_resources(void)
char *id_guid = NULL;
uint32_t vers;
uint32_t lowest;
+ uint32_t type;
+ char *str_type;
fwup_get_guid(re, &guid);
rc = efi_guid_to_id_guid(guid, &id_guid);
@@ -60,9 +62,27 @@ print_system_resources(void)
fwup_get_fw_version(re, &vers);
fwup_get_lowest_supported_fw_version(re, &lowest);
+ fwup_get_fw_type(re, &type);
+ switch (type) {
+ case FWUP_RESOURCE_TYPE_UNKNOWN:
+ str_type = "Unknown";
+ break;
+ case FWUP_RESOURCE_TYPE_SYSTEM_FIRMWARE:
+ str_type = "System Firmware";
+ break;
+ case FWUP_RESOURCE_TYPE_DEVICE_FIRMWARE:
+ str_type = "Device Firmware";
+ break;
+ case FWUP_RESOURCE_TYPE_UEFI_DRIVER:
+ str_type = "UEFI Driver";
+ break;
+ default:
+ str_type = "";
+ break;
+ }
- printf(_("%s version %d can be updated to any version above %d\n"),
- id_guid, vers, lowest-1);
+ printf(_("%s type, %s version %d can be updated to any version above %d\n"),
+ str_type , id_guid, vers, lowest-1);
free(id_guid);
}
--
2.14.1