]> sigrok.org Git - libsigrok.git/commitdiff
ols: make connection ID available
authorGerhard Sittig <redacted>
Thu, 20 Jun 2019 09:12:30 +0000 (11:12 +0200)
committerGerhard Sittig <redacted>
Sun, 21 Aug 2022 15:45:11 +0000 (17:45 +0200)
Implement a getter for the SR_CONF_CONN config key in the ols driver.

src/hardware/openbench-logic-sniffer/api.c

index 788d4b8098c7a1ca4c5dc8276d8adb93183c6849..67bb230d208144fe44176a33a877ba59e39ded5f 100644 (file)
@@ -32,6 +32,7 @@ static const uint32_t drvopts[] = {
 };
 
 static const uint32_t devopts[] = {
+       SR_CONF_CONN | SR_CONF_GET,
        SR_CONF_LIMIT_SAMPLES | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
        SR_CONF_SAMPLERATE | SR_CONF_GET | SR_CONF_SET | SR_CONF_LIST,
        SR_CONF_TRIGGER_MATCH | SR_CONF_LIST,
@@ -191,6 +192,7 @@ static GSList *scan(struct sr_dev_driver *di, GSList *options)
                       DEFAULT_SAMPLERATE);
        sdi->inst_type = SR_INST_SERIAL;
        sdi->conn = serial;
+       sdi->connection_id = g_strdup(serial->port);
 
        serial_close(serial);
 
@@ -211,6 +213,11 @@ static int config_get(uint32_t key, GVariant **data,
        devc = sdi->priv;
 
        switch (key) {
+       case SR_CONF_CONN:
+               if (!sdi->conn || !sdi->connection_id)
+                       return SR_ERR_NA;
+               *data = g_variant_new_string(sdi->connection_id);
+               break;
        case SR_CONF_SAMPLERATE:
                *data = g_variant_new_uint64(devc->cur_samplerate);
                break;