From d643e6bc3942d7b7149a53b3091034d64eac0ad3 Mon Sep 17 00:00:00 2001 From: Gerhard Sittig Date: Sat, 1 Aug 2020 17:12:50 +0200 Subject: [PATCH] hwdriver: introduce SR_CONF_FORCE_DETECT config key (scan option) Often previously unsupported models might be covered by existing code, but would not match against a builtin list of known devices. Introduce a config key which provides a scan option for users to force the use of a driver with an unsupported device. This increases the probability of requests for support of an additional model which are associated with a successful use of that very device, and eliminates the necessity to build from source for the trivial cases. It's up to individual drivers whether they support forced detection, and how they interpret the value of the scan option. --- include/libsigrok/libsigrok.h | 10 ++++++++++ src/hwdriver.c | 2 ++ 2 files changed, 12 insertions(+) diff --git a/include/libsigrok/libsigrok.h b/include/libsigrok/libsigrok.h index 2779490d..070107ee 100644 --- a/include/libsigrok/libsigrok.h +++ b/include/libsigrok/libsigrok.h @@ -753,6 +753,16 @@ enum sr_configkey { */ SR_CONF_MODBUSADDR, + /** + * User specified forced driver attachment to unknown devices. + * + * By design the interpretation of the string depends on the + * specific driver. It typically would be either a replacement + * '*IDN?' response value, or a sub-driver name. But could also + * be anything else and totally arbitrary. + */ + SR_CONF_FORCE_DETECT, + /* 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 1016507e..03d268e1 100644 --- a/src/hwdriver.c +++ b/src/hwdriver.c @@ -71,6 +71,8 @@ static struct sr_key_info sr_key_info_config[] = { "Serial communication", NULL}, {SR_CONF_MODBUSADDR, SR_T_UINT64, "modbusaddr", "Modbus slave address", NULL}, + {SR_CONF_FORCE_DETECT, SR_T_STRING, "force_detect", + "Forced detection", NULL}, /* Device (or channel group) configuration */ {SR_CONF_SAMPLERATE, SR_T_UINT64, "samplerate",