Show the human-readable version in the 'dfu-tool dump' output

This commit is contained in:
Richard Hughes 2016-09-01 14:49:06 +01:00
parent df7ba314b2
commit c951e3a2ff
3 changed files with 10 additions and 3 deletions

View File

@ -80,6 +80,7 @@ libdfu_la_SOURCES = \
dfu-target-private.h
libdfu_la_LIBADD = \
$(APPSTREAM_GLIB_LIBS) \
$(ELF_LIBS) \
$(GUSB_LIBS) \
$(GLIB_LIBS) \
@ -131,6 +132,7 @@ dfu_self_test_SOURCES = \
dfu_self_test_LDADD = \
$(lib_LTLIBRARIES) \
$(APPSTREAM_GLIB_LIBS) \
$(GLIB_LIBS) \
$(GUSB_LIBS)
@ -146,7 +148,7 @@ introspection_sources = \
$(libdfu_la_SOURCES)
Dfu-1.0.gir: libdfu.la
Dfu_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 GUsb-1.0
Dfu_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 GUsb-1.0 AppStreamGlib-1.0
Dfu_1_0_gir_CFLAGS = $(AM_CPPFLAGS)
Dfu_1_0_gir_SCANNERFLAGS = --identifier-prefix=Dfu \
--symbol-prefix=dfu \

View File

@ -36,6 +36,7 @@
#include <string.h>
#include <stdio.h>
#include <appstream-glib.h>
#include "dfu-common.h"
#include "dfu-error.h"
@ -678,14 +679,18 @@ dfu_firmware_to_string (DfuFirmware *firmware)
GList *l;
GString *str;
guint i;
g_autofree gchar *release_str = NULL;
g_autoptr(GList) keys = NULL;
g_return_val_if_fail (DFU_IS_FIRMWARE (firmware), NULL);
release_str = as_utils_version_from_uint16 (priv->release,
AS_VERSION_PARSE_FLAG_NONE);
str = g_string_new ("");
g_string_append_printf (str, "vid: 0x%04x\n", priv->vid);
g_string_append_printf (str, "pid: 0x%04x\n", priv->pid);
g_string_append_printf (str, "release: 0x%04x\n", priv->release);
g_string_append_printf (str, "release: 0x%04x [%s]\n",
priv->release, release_str);
g_string_append_printf (str, "format: %s [0x%04x]\n",
dfu_firmware_format_to_string (priv->format),
priv->format);

View File

@ -7,6 +7,6 @@ Name: dfu
Description: libdfu is a library for reading and writing USB device firmware
Version: @VERSION@
Requires: glib-2.0, gobject-2.0, gio-2.0
Requires.private: elf
Requires.private: elf, appstream-glib
Libs: -L${libdir} -ldfu
Cflags: -I${includedir}