Browse Source

Only enable curses on failure if curses is desired.

nfactor-troky
ckolivas 13 years ago
parent
commit
cda798d91b
  1. 21
      cgminer.c
  2. 11
      device-gpu.c
  3. 32
      main.c

21
cgminer.c

@ -4217,12 +4217,11 @@ int main (int argc, char *argv[])
use_curses = false; use_curses = false;
if (!total_pools) { if (!total_pools) {
enable_curses(); if (use_curses)
enable_curses();
applog(LOG_WARNING, "Need to specify at least one pool server."); applog(LOG_WARNING, "Need to specify at least one pool server.");
if (!input_pool(false)) if (!use_curses || (use_curses && !input_pool(false)))
quit(1, "Pool setup failed"); quit(1, "Pool setup failed");
if (!use_curses)
disable_curses();
} }
for (i = 0; i < total_pools; i++) { for (i = 0; i < total_pools; i++) {
@ -4326,7 +4325,8 @@ retry_pools:
} }
if (!pools_active) { if (!pools_active) {
enable_curses(); if (use_curses)
enable_curses();
applog(LOG_ERR, "No servers were found that could be used to get work from."); applog(LOG_ERR, "No servers were found that could be used to get work from.");
applog(LOG_ERR, "Please check the details from the list below of the servers you have input"); applog(LOG_ERR, "Please check the details from the list below of the servers you have input");
applog(LOG_ERR, "Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers"); applog(LOG_ERR, "Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers");
@ -4337,11 +4337,14 @@ retry_pools:
applog(LOG_WARNING, "Pool: %d URL: %s User: %s Password: %s", applog(LOG_WARNING, "Pool: %d URL: %s User: %s Password: %s",
i, pool->rpc_url, pool->rpc_user, pool->rpc_pass); i, pool->rpc_url, pool->rpc_user, pool->rpc_pass);
} }
halfdelay(150); if (use_curses) {
applog(LOG_ERR, "Press any key to exit, or cgminer will try again in 15s."); halfdelay(150);
if (getch() != ERR) applog(LOG_ERR, "Press any key to exit, or cgminer will try again in 15s.");
if (getch() != ERR)
quit(0, "No servers could be used! Exiting.");
nocbreak();
} else
quit(0, "No servers could be used! Exiting."); quit(0, "No servers could be used! Exiting.");
nocbreak();
goto retry_pools; goto retry_pools;
} }

11
device-gpu.c

@ -993,7 +993,8 @@ static bool opencl_thread_prepare(struct thr_info *thr)
applog(LOG_INFO, "Init GPU thread %i GPU %i virtual GPU %i", i, gpu, virtual_gpu); applog(LOG_INFO, "Init GPU thread %i GPU %i virtual GPU %i", i, gpu, virtual_gpu);
clStates[i] = initCl(virtual_gpu, name, sizeof(name)); clStates[i] = initCl(virtual_gpu, name, sizeof(name));
if (!clStates[i]) { if (!clStates[i]) {
enable_curses(); if (use_curses)
enable_curses();
applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu); applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu);
if (!failmessage) { if (!failmessage) {
char *buf; char *buf;
@ -1001,9 +1002,11 @@ static bool opencl_thread_prepare(struct thr_info *thr)
applog(LOG_ERR, "Restarting the GPU from the menu will not fix this."); applog(LOG_ERR, "Restarting the GPU from the menu will not fix this.");
applog(LOG_ERR, "Try restarting cgminer."); applog(LOG_ERR, "Try restarting cgminer.");
failmessage = true; failmessage = true;
buf = curses_input("Press enter to continue"); if (use_curses) {
if (buf) buf = curses_input("Press enter to continue");
free(buf); if (buf)
free(buf);
}
} }
cgpu->enabled = false; cgpu->enabled = false;
cgpu->status = LIFE_NOSTART; cgpu->status = LIFE_NOSTART;

32
main.c

@ -5664,7 +5664,8 @@ static bool opencl_thread_prepare(struct thr_info *thr)
applog(LOG_INFO, "Init GPU thread %i GPU %i virtual GPU %i", i, gpu, virtual_gpu); applog(LOG_INFO, "Init GPU thread %i GPU %i virtual GPU %i", i, gpu, virtual_gpu);
clStates[i] = initCl(virtual_gpu, name, sizeof(name)); clStates[i] = initCl(virtual_gpu, name, sizeof(name));
if (!clStates[i]) { if (!clStates[i]) {
enable_curses(); if (use_curses)
enable_curses();
applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu); applog(LOG_ERR, "Failed to init GPU thread %d, disabling device %d", i, gpu);
if (!failmessage) { if (!failmessage) {
char *buf; char *buf;
@ -5672,9 +5673,11 @@ static bool opencl_thread_prepare(struct thr_info *thr)
applog(LOG_ERR, "Restarting the GPU from the menu will not fix this."); applog(LOG_ERR, "Restarting the GPU from the menu will not fix this.");
applog(LOG_ERR, "Try restarting cgminer."); applog(LOG_ERR, "Try restarting cgminer.");
failmessage = true; failmessage = true;
buf = curses_input("Press enter to continue"); if (use_curses) {
if (buf) buf = curses_input("Press enter to continue");
free(buf); if (buf)
free(buf);
}
} }
cgpu->enabled = false; cgpu->enabled = false;
cgpu->status = LIFE_NOSTART; cgpu->status = LIFE_NOSTART;
@ -6071,12 +6074,11 @@ int main (int argc, char *argv[])
use_curses = false; use_curses = false;
if (!total_pools) { if (!total_pools) {
enable_curses(); if (use_curses)
enable_curses();
applog(LOG_WARNING, "Need to specify at least one pool server."); applog(LOG_WARNING, "Need to specify at least one pool server.");
if (!input_pool(false)) if (!use_curses || (use_curses && !input_pool(false)))
quit(1, "Pool setup failed"); quit(1, "Pool setup failed");
if (!use_curses)
disable_curses();
} }
for (i = 0; i < total_pools; i++) { for (i = 0; i < total_pools; i++) {
@ -6180,7 +6182,8 @@ retry_pools:
} }
if (!pools_active) { if (!pools_active) {
enable_curses(); if (use_curses)
enable_curses();
applog(LOG_ERR, "No servers were found that could be used to get work from."); applog(LOG_ERR, "No servers were found that could be used to get work from.");
applog(LOG_ERR, "Please check the details from the list below of the servers you have input"); applog(LOG_ERR, "Please check the details from the list below of the servers you have input");
applog(LOG_ERR, "Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers"); applog(LOG_ERR, "Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers");
@ -6191,11 +6194,14 @@ retry_pools:
applog(LOG_WARNING, "Pool: %d URL: %s User: %s Password: %s", applog(LOG_WARNING, "Pool: %d URL: %s User: %s Password: %s",
i, pool->rpc_url, pool->rpc_user, pool->rpc_pass); i, pool->rpc_url, pool->rpc_user, pool->rpc_pass);
} }
halfdelay(150); if (use_curses) {
applog(LOG_ERR, "Press any key to exit, or cgminer will try again in 15s."); halfdelay(150);
if (getch() != ERR) applog(LOG_ERR, "Press any key to exit, or cgminer will try again in 15s.");
if (getch() != ERR)
quit(0, "No servers could be used! Exiting.");
nocbreak();
} else
quit(0, "No servers could be used! Exiting."); quit(0, "No servers could be used! Exiting.");
nocbreak();
goto retry_pools; goto retry_pools;
} }

Loading…
Cancel
Save