From: Uwe Hermann Date: Thu, 20 Jun 2019 16:16:31 +0000 (+0200) Subject: serial_hid: Don't print empty strings, [aaaa.bbbb] VID/PID format. X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=be7c63dcf85a79d1f68d0c6b6f1483b297978bd0;p=libsigrok.git serial_hid: Don't print empty strings, [aaaa.bbbb] VID/PID format. --- diff --git a/src/serial_hid.c b/src/serial_hid.c index 0ad0e513..4a5f9bb9 100644 --- a/src/serial_hid.c +++ b/src/serial_hid.c @@ -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);