]> sigrok.org Git - libsigrok.git/commitdiff
Auto-set sdi->connection_id for serial devices in the getter
authorSoeren Apel <redacted>
Thu, 16 Oct 2014 20:44:31 +0000 (22:44 +0200)
committerBert Vermeulen <redacted>
Fri, 17 Oct 2014 01:02:52 +0000 (03:02 +0200)
src/device.c

index ced46fa120fc665d58e672be109227c8b6c02ca0..2b6cda03bd9812a9969535c7792489d1bbe242e6 100644 (file)
@@ -570,6 +570,18 @@ SR_API const char *sr_dev_inst_connid_get(struct sr_dev_inst *sdi)
        if (!sdi)
                return NULL;
 
+       #ifdef HAVE_LIBSERIALPORT
+       struct sr_serial_dev_inst *serial;
+
+       if ((!sdi->connection_id) && (sdi->inst_type == SR_INST_SERIAL)) {
+               /* connection_id isn't populated, let's do that here. */
+
+               serial = sdi->conn;
+               sdi->connection_id = g_strdup(serial->port);
+       }
+       #endif
+
+
        if ((!sdi->connection_id) && (sdi->inst_type == SR_INST_USB)) {
                /* connection_id isn't populated, let's do that here. */