]> sigrok.org Git - libserialport.git/blobdiff - linux.c
If present, add usb_serial to description for better identification
[libserialport.git] / 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 {