scan: Show serial number if available
authorAndreas Sandberg <andreas@sandberg.pp.se>
Fri, 6 Mar 2020 16:34:45 +0000 (16:34 +0000)
committerUwe Hermann <uwe@hermann-uwe.de>
Sat, 11 Apr 2020 13:47:46 +0000 (15:47 +0200)
Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
show.c

diff --git a/show.c b/show.c
index 608698723c6426977d1dd91a17c14ede1599036c..e62f69746358663190d4a8b625871efd79497119 100644 (file)
--- a/show.c
+++ b/show.c
@@ -286,12 +286,13 @@ static void print_dev_line(const struct sr_dev_inst *sdi)
        GString *s;
        GVariant *gvar;
        struct sr_dev_driver *driver;
-       const char *vendor, *model, *version;
+       const char *vendor, *model, *version, *sernum;
 
        driver = sr_dev_inst_driver_get(sdi);
        vendor = sr_dev_inst_vendor_get(sdi);
        model = sr_dev_inst_model_get(sdi);
        version = sr_dev_inst_version_get(sdi);
+       sernum = sr_dev_inst_sernum_get(sdi);
        channels = sr_dev_inst_channels_get(sdi);
 
        s = g_string_sized_new(128);
@@ -308,6 +309,8 @@ static void print_dev_line(const struct sr_dev_inst *sdi)
                g_string_append_printf(s, "%s ", model);
        if (version && version[0])
                g_string_append_printf(s, "%s ", version);
+       if (sernum && sernum[0])
+               g_string_append_printf(s, "[S/N: %s] ", sernum);
        if (channels) {
                if (g_slist_length(channels) == 1) {
                        ch = channels->data;