Browse Source

cgminer -n to include a USB device list

nfactor-troky
Kano 12 years ago
parent
commit
1c04d14067
  1. 27
      cgminer.c
  2. 3
      driver-opencl.c
  3. 2
      driver-opencl.h

27
cgminer.c

@ -1363,6 +1363,20 @@ static char *opt_verusage_and_exit(const char *extra)
exit(0); 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 */ /* These options are available from commandline only */
static struct opt_table opt_cmdline_table[] = { static struct opt_table opt_cmdline_table[] = {
OPT_WITH_ARG("--config|-c", OPT_WITH_ARG("--config|-c",
@ -1376,10 +1390,17 @@ static struct opt_table opt_cmdline_table[] = {
OPT_WITHOUT_ARG("--help|-h", OPT_WITHOUT_ARG("--help|-h",
opt_verusage_and_exit, NULL, opt_verusage_and_exit, NULL,
"Print this message"), "Print this message"),
#ifdef HAVE_OPENCL #if defined(HAVE_OPENCL) || defined(USE_USBUTILS)
OPT_WITHOUT_ARG("--ndevs|-n", OPT_WITHOUT_ARG("--ndevs|-n",
print_ndevs_and_exit, &nDevs, display_devs, &nDevs,
"Display number of detected GPUs, OpenCL platform information, and exit"), "Display "
#ifdef HAVE_OPENCL
"number of detected GPUs, OpenCL platform information, "
#endif
#ifdef USE_USBUTILS
"all USB devices, "
#endif
"and exit"),
#endif #endif
OPT_WITHOUT_ARG("--version|-V", OPT_WITHOUT_ARG("--version|-V",
opt_version_and_exit, packagename, opt_version_and_exit, packagename,

3
driver-opencl.c

@ -592,13 +592,12 @@ char *set_intensity(char *arg)
return NULL; return NULL;
} }
char *print_ndevs_and_exit(int *ndevs) void print_ndevs(int *ndevs)
{ {
opt_log_output = true; opt_log_output = true;
opencl_drv.drv_detect(); opencl_drv.drv_detect();
clear_adl(*ndevs); clear_adl(*ndevs);
applog(LOG_INFO, "%i GPU devices max detected", *ndevs); applog(LOG_INFO, "%i GPU devices max detected", *ndevs);
exit(*ndevs);
} }
#endif #endif

2
driver-opencl.h

@ -4,7 +4,7 @@
#include "miner.h" #include "miner.h"
extern char *print_ndevs_and_exit(int *ndevs); extern void print_ndevs(int *ndevs);
extern void *reinit_gpu(void *userdata); extern void *reinit_gpu(void *userdata);
extern char *set_gpu_map(char *arg); extern char *set_gpu_map(char *arg);
extern char *set_gpu_engine(char *arg); extern char *set_gpu_engine(char *arg);

Loading…
Cancel
Save