]> sigrok.org Git - libsigrok.git/commitdiff
serial_hid: Don't print empty strings, [aaaa.bbbb] VID/PID format.
authorUwe Hermann <redacted>
Thu, 20 Jun 2019 16:16:31 +0000 (18:16 +0200)
committerUwe Hermann <redacted>
Thu, 20 Jun 2019 16:16:31 +0000 (18:16 +0200)
src/serial_hid.c

index 0ad0e5130e8580acb1921b8c58fb4e21bdde8c1d..4a5f9bb98995324fa82c9c16158a8a7d0d68cc78 100644 (file)
@@ -199,14 +199,14 @@ static GSList *ser_hid_hidapi_list(GSList *list, sr_ser_list_append_t append)
                pid = curdev->product_id;
                desc = g_string_sized_new(128);
                g_string_append_printf(desc, "HID");
-               if (manuf)
+               if (manuf && wcslen(manuf) != 0)
                        g_string_append_printf(desc, " %ls", manuf);
-               if (prod)
+               if (prod && wcslen(prod) != 0)
                        g_string_append_printf(desc, " %ls", prod);
-               if (serno)
+               if (serno && wcslen(serno) != 0)
                        g_string_append_printf(desc, " %ls", serno);
                if (vid && pid)
-                       g_string_append_printf(desc, " %04hx.%04hx", vid, pid);
+                       g_string_append_printf(desc, " [%04hx.%04hx]", vid, pid);
                list = append(list, name, desc->str);
                g_string_free(desc, TRUE);
                g_free(name);