Auto-set sdi->connection_id for serial devices in the getter
This commit is contained in:
parent
d1314831e4
commit
e8cbb22314
12
src/device.c
12
src/device.c
|
@ -570,6 +570,18 @@ SR_API const char *sr_dev_inst_connid_get(struct sr_dev_inst *sdi)
|
||||||
if (!sdi)
|
if (!sdi)
|
||||||
return NULL;
|
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)) {
|
if ((!sdi->connection_id) && (sdi->inst_type == SR_INST_USB)) {
|
||||||
/* connection_id isn't populated, let's do that here. */
|
/* connection_id isn't populated, let's do that here. */
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue