From: Gerhard Sittig Date: Sun, 14 Aug 2022 11:33:51 +0000 (+0200) Subject: hwdriver: introduce SR_CONF_PROBE_NAMES config key (scan option) X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=0996f644344b55ee8a2cd4519ee0876d02ddb8f5;p=libsigrok.git hwdriver: introduce SR_CONF_PROBE_NAMES config key (scan option) Device drivers assign a fixed set of probe names during scan. Users can rename previously created channels in the GUI as well as in the CLI, though this is tedious, and depends on the application, as well as depends on the names which the driver initially used to assign. Manual assignment of protocol decoder inputs to device channel names is as tedious. Introduce the SR_CONF_PROBE_NAMES scan option, which assigns the user provided names to the device's probes during scan already (for those drivers which support the option). This commit declares the config key but does not affect any driver yet. --- diff --git a/include/libsigrok/libsigrok.h b/include/libsigrok/libsigrok.h index 81a831b3..42614fd0 100644 --- a/include/libsigrok/libsigrok.h +++ b/include/libsigrok/libsigrok.h @@ -784,6 +784,26 @@ enum sr_configkey { */ SR_CONF_FORCE_DETECT, + /** + * Override builtin probe names from user specs. + * + * Users may want to override the names which are assigned to + * probes during scan (these usually match the vendor's labels + * on the device). This avoids the interactive tedium of + * changing channel names after device creation and before + * protocol decoder attachment. Think of IEEE488 recorders or + * parallel computer bus loggers. The scan option eliminates + * the issue of looking up previously assigned names before + * renaming a channel (see sigrok-cli -C), which depends on + * the device as well as the application, and is undesirable. + * The scan option is limited to those drivers which implement + * support for it, but works identically across those drivers. + * + * The value is a string, either a comma separated list of + * probe names, or an alias for a typical set of names. + */ + SR_CONF_PROBE_NAMES, + /* Update sr_key_info_config[] (hwdriver.c) upon changes! */ /*--- Device (or channel group) configuration -----------------------*/ diff --git a/src/hwdriver.c b/src/hwdriver.c index 2850946f..572748ac 100644 --- a/src/hwdriver.c +++ b/src/hwdriver.c @@ -74,6 +74,8 @@ static struct sr_key_info sr_key_info_config[] = { "Modbus slave address", NULL}, {SR_CONF_FORCE_DETECT, SR_T_STRING, "force_detect", "Forced detection", NULL}, + {SR_CONF_PROBE_NAMES, SR_T_STRING, "probe_names", + "Names of device's probes", NULL}, /* Device (or channel group) configuration */ {SR_CONF_SAMPLERATE, SR_T_UINT64, "samplerate",