]> sigrok.org Git - libserialport.git/commitdiff
If present, add usb_serial to description for better identification
authorUffe Jakobsen <redacted>
Mon, 16 Feb 2015 22:07:00 +0000 (23:07 +0100)
committerUwe Hermann <redacted>
Fri, 20 Feb 2015 17:54:12 +0000 (18:54 +0100)
linux.c

diff --git a/linux.c b/linux.c
index 61446a4171ae863034b2cf75b3ff81efc2dff0e8..9ffdc91ba08189bc9bb242b2db7eb1175f227fdb 100644 (file)
--- a/linux.c
+++ b/linux.c
@@ -135,6 +135,15 @@ SP_PRIV enum sp_return get_port_details(struct sp_port *port)
                                fclose(file);
                        }
 
+                       /* If present, add serial to description for better identification. */
+                       if (port->usb_serial && strlen(port->usb_serial)) {
+                               snprintf(description, sizeof(description) - 1,
+                                       "%s - %s", port->description, port->usb_serial);
+                               if (port->description)
+                                       free(port->description);
+                               port->description = strdup(description);
+                       }
+
                        break;
                }
        } else {