cgminer -n to include a USB device list
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
diff --git a/cgminer.c b/cgminer.c
index 5a9b8c9..1ff06e6 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -1363,6 +1363,20 @@ static char *opt_verusage_and_exit(const char *extra)
exit(0);
}
+#if defined(HAVE_OPENCL) || defined(USE_USBUTILS)
+char *display_devs(int *ndevs)
+{
+ *ndevs = 0;
+#ifdef HAVE_OPENCL
+ print_ndevs(ndevs);
+#endif
+#ifdef USE_USBUTILS
+ usb_all(0);
+#endif
+ exit(*ndevs);
+}
+#endif
+
/* These options are available from commandline only */
static struct opt_table opt_cmdline_table[] = {
OPT_WITH_ARG("--config|-c",
@@ -1376,10 +1390,17 @@ static struct opt_table opt_cmdline_table[] = {
OPT_WITHOUT_ARG("--help|-h",
opt_verusage_and_exit, NULL,
"Print this message"),
-#ifdef HAVE_OPENCL
+#if defined(HAVE_OPENCL) || defined(USE_USBUTILS)
OPT_WITHOUT_ARG("--ndevs|-n",
- print_ndevs_and_exit, &nDevs,
- "Display number of detected GPUs, OpenCL platform information, and exit"),
+ display_devs, &nDevs,
+ "Display "
+#ifdef HAVE_OPENCL
+ "number of detected GPUs, OpenCL platform information, "
+#endif
+#ifdef USE_USBUTILS
+ "all USB devices, "
+#endif
+ "and exit"),
#endif
OPT_WITHOUT_ARG("--version|-V",
opt_version_and_exit, packagename,
diff --git a/driver-opencl.c b/driver-opencl.c
index 8580b22..5b83349 100644
--- a/driver-opencl.c
+++ b/driver-opencl.c
@@ -592,13 +592,12 @@ char *set_intensity(char *arg)
return NULL;
}
-char *print_ndevs_and_exit(int *ndevs)
+void print_ndevs(int *ndevs)
{
opt_log_output = true;
opencl_drv.drv_detect();
clear_adl(*ndevs);
applog(LOG_INFO, "%i GPU devices max detected", *ndevs);
- exit(*ndevs);
}
#endif
diff --git a/driver-opencl.h b/driver-opencl.h
index 22bd9ec..1cb8807 100644
--- a/driver-opencl.h
+++ b/driver-opencl.h
@@ -4,7 +4,7 @@
#include "miner.h"
-extern char *print_ndevs_and_exit(int *ndevs);
+extern void print_ndevs(int *ndevs);
extern void *reinit_gpu(void *userdata);
extern char *set_gpu_map(char *arg);
extern char *set_gpu_engine(char *arg);