Introduce the -D or --dont-scan command line option. This avoids
automatic driver scans, and exclusively uses what -d specifies.
Some device drivers use non-standard protocol features since their
supported devices don't support the corresponding standard mechanisms.
Which can confuse conforming devices. In these situations it can be
desirable to not scan automatically for available devices, instead do
nothing until callers will specify the -d option.
This change is motivated by but does not resolve bugs #1155 and #1373.
+ /* Caller specified driver. Use it. Only this one. */
if (!parse_driver(opt_drv, &driver, &drvopts))
return NULL;
devices = sr_driver_scan(driver, drvopts);
g_slist_free_full(drvopts, (GDestroyNotify)free_drvopts);
if (!parse_driver(opt_drv, &driver, &drvopts))
return NULL;
devices = sr_driver_scan(driver, drvopts);
g_slist_free_full(drvopts, (GDestroyNotify)free_drvopts);
+ } else if (opt_dont_scan) {
+ /* No -d choice, and -D "don't scan" requested. Do nothing. */
+ devices = NULL;
- /* No driver specified, let them all scan on their own. */
+ /* No driver specified. Scan all available drivers. */
devices = NULL;
drivers = sr_driver_list(sr_ctx);
for (i = 0; drivers[i]; i++) {
devices = NULL;
drivers = sr_driver_list(sr_ctx);
for (i = 0; drivers[i]; i++) {
.sp
.RB " $ " "sigrok\-cli \-\-driver=uni\-t\-ut61e:conn=4.6" " [...]"
.TP
.sp
.RB " $ " "sigrok\-cli \-\-driver=uni\-t\-ut61e:conn=4.6" " [...]"
.TP
+.B "\-D, \-\-dont\-scan"
+Do not automatically scan for device drivers in the absence of a
+.BR "\-d " ( "\-\-driver" )
+specification.
+.TP
.BR "\-c, \-\-config " <deviceoption>
A colon-separated list of device options, where each option takes the form
.BR key=value .
.BR "\-c, \-\-config " <deviceoption>
A colon-separated list of device options, where each option takes the form
.BR key=value .
gboolean opt_list_supported_wiki = FALSE;
gint opt_loglevel = SR_LOG_WARN; /* Show errors+warnings by default. */
gboolean opt_scan_devs = FALSE;
gboolean opt_list_supported_wiki = FALSE;
gint opt_loglevel = SR_LOG_WARN; /* Show errors+warnings by default. */
gboolean opt_scan_devs = FALSE;
+gboolean opt_dont_scan = FALSE;
gboolean opt_wait_trigger = FALSE;
gchar *opt_input_file = NULL;
gchar *opt_output_file = NULL;
gboolean opt_wait_trigger = FALSE;
gchar *opt_input_file = NULL;
gchar *opt_output_file = NULL;
#endif
{"scan", 0, 0, G_OPTION_ARG_NONE, &opt_scan_devs,
"Scan for devices", NULL},
#endif
{"scan", 0, 0, G_OPTION_ARG_NONE, &opt_scan_devs,
"Scan for devices", NULL},
+ {"dont-scan", 'D', 0, G_OPTION_ARG_NONE, &opt_dont_scan,
+ "Don't auto-scan (use -d spec only)", NULL},
{"show", 0, 0, G_OPTION_ARG_NONE, &opt_show,
"Show device/format/decoder details", NULL},
{"time", 0, 0, G_OPTION_ARG_CALLBACK, &check_opt_time,
{"show", 0, 0, G_OPTION_ARG_NONE, &opt_show,
"Show device/format/decoder details", NULL},
{"time", 0, 0, G_OPTION_ARG_CALLBACK, &check_opt_time,
extern gboolean opt_list_supported_wiki;
extern gint opt_loglevel;
extern gboolean opt_scan_devs;
extern gboolean opt_list_supported_wiki;
extern gint opt_loglevel;
extern gboolean opt_scan_devs;
+extern gboolean opt_dont_scan;
extern gboolean opt_wait_trigger;
extern gchar *opt_input_file;
extern gchar *opt_output_file;
extern gboolean opt_wait_trigger;
extern gchar *opt_input_file;
extern gchar *opt_output_file;