1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-29 16:04:33 +00:00

cgminer -n to include a USB device list

This commit is contained in:
Kano 2013-03-13 23:24:34 +11:00
parent 154e4f4b61
commit 1c04d14067
3 changed files with 26 additions and 6 deletions

View File

@ -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,

View File

@ -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

View File

@ -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);