Auto-set sdi->connection_id for serial devices in the getter

This commit is contained in:
Soeren Apel 2014-10-16 22:44:31 +02:00 committed by Bert Vermeulen
parent d1314831e4
commit e8cbb22314
1 changed files with 12 additions and 0 deletions

View 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. */