From: Bert Vermeulen Date: Mon, 11 Mar 2013 15:30:14 +0000 (+0100) Subject: support for live status of SR_CONF_DATALOG X-Git-Tag: sigrok-cli-0.4.0~29 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=8e8827f4055c22b84d507b98342c321d5bed42bc;p=sigrok-cli.git support for live status of SR_CONF_DATALOG --- diff --git a/sigrok-cli.c b/sigrok-cli.c index e58c514..231572c 100644 --- a/sigrok-cli.c +++ b/sigrok-cli.c @@ -305,7 +305,7 @@ static void show_dev_detail(void) GSList *devices; uint64_t *integers; const int *hwopts, *hwcaps; - int cap, num_devices, n, i; + int cap, num_devices, *tmp_bool, i; char *s, *title; const char *charopts, **stropts; @@ -324,6 +324,14 @@ static void show_dev_detail(void) sdi = devices->data; print_dev_line(sdi); + /* This properly opens and initializes the device, so we can get + * current settings. */ + sr_session_new(); + if (sr_session_dev_add(sdi) != SR_OK) { + g_critical("Failed to use device."); + return; + } + if (sr_config_list(sdi->driver, SR_CONF_TRIGGER_TYPE, (const void **)&charopts, sdi) == SR_OK && charopts) { printf("Supported triggers: "); @@ -474,12 +482,22 @@ static void show_dev_detail(void) for (i = 0; stropts[i]; i++) printf(" %s\n", stropts[i]); + } else if (srci->key == SR_CONF_DATALOG) { + /* Turning on/off internal data logging. */ + printf(" %s\t(on/off", srci->id); + if (sr_config_get(sdi->driver, SR_CONF_DATALOG, + (const void **)&tmp_bool, sdi) == SR_OK) { + printf(", currently %s", *tmp_bool ? "on" : "off"); + } + printf(")\n"); } else { /* Everything else */ printf(" %s\n", srci->id); } } + sr_session_destroy(); + } static void show_pd_detail(void)