mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 10:04:33 +00:00
Fix --ndevs/-n option.
The option should be called from within the callback, and just use printf to give the raw result, rather than using applog which prepends a timestamp.
This commit is contained in:
parent
8d25df3c72
commit
8b68dc44d4
19
main.c
19
main.c
@ -114,7 +114,6 @@ static const char *algo_names[] = {
|
|||||||
|
|
||||||
bool opt_debug = false;
|
bool opt_debug = false;
|
||||||
bool opt_protocol = false;
|
bool opt_protocol = false;
|
||||||
bool opt_ndevs = false;
|
|
||||||
bool want_longpoll = true;
|
bool want_longpoll = true;
|
||||||
bool have_longpoll = false;
|
bool have_longpoll = false;
|
||||||
bool use_syslog = false;
|
bool use_syslog = false;
|
||||||
@ -395,7 +394,13 @@ static char *load_config(const char *arg, void *unused)
|
|||||||
* so don't free config object. */
|
* so don't free config object. */
|
||||||
return parse_config(config);
|
return parse_config(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *print_ndevs_and_exit(int *ndevs)
|
||||||
|
{
|
||||||
|
printf("%i", *ndevs);
|
||||||
|
exit(*ndevs);
|
||||||
|
}
|
||||||
|
|
||||||
/* 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",
|
||||||
@ -410,6 +415,9 @@ static struct opt_table opt_cmdline_table[] = {
|
|||||||
"\nBuilt with CPU mining support only.\n\n",
|
"\nBuilt with CPU mining support only.\n\n",
|
||||||
#endif
|
#endif
|
||||||
"Print this message"),
|
"Print this message"),
|
||||||
|
OPT_WITHOUT_ARG("--ndevs|-n",
|
||||||
|
print_ndevs_and_exit, &nDevs,
|
||||||
|
"Display number of detected GPUs and exit"),
|
||||||
OPT_ENDTABLE
|
OPT_ENDTABLE
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1468,13 +1476,6 @@ int main (int argc, char *argv[])
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_OPENCL
|
|
||||||
if (opt_ndevs) {
|
|
||||||
applog(LOG_INFO, "%i", nDevs);
|
|
||||||
return nDevs;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
gpu_threads = nDevs * opt_g_threads;
|
gpu_threads = nDevs * opt_g_threads;
|
||||||
if (!gpu_threads && !forced_n_threads) {
|
if (!gpu_threads && !forced_n_threads) {
|
||||||
/* Maybe they turned GPU off; restore default CPU threads. */
|
/* Maybe they turned GPU off; restore default CPU threads. */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user