From: Soeren Apel Date: Thu, 16 Oct 2014 20:44:31 +0000 (+0200) Subject: Auto-set sdi->connection_id for serial devices in the getter X-Git-Tag: libsigrok-0.4.0~841 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=e8cbb22314f8a1c4aafd55b582281f54d4d35c07;p=libsigrok.git Auto-set sdi->connection_id for serial devices in the getter --- diff --git a/src/device.c b/src/device.c index ced46fa1..2b6cda03 100644 --- a/src/device.c +++ b/src/device.c @@ -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. */