mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-10 14:04:16 +00:00
Make curses display visible right from the beginning and fix the window sizes so the initial messages don't get lost once the status window is drawn.
This commit is contained in:
parent
c531f1bd04
commit
e259a994f1
47
cgminer.c
47
cgminer.c
@ -1269,6 +1269,21 @@ static inline bool change_logwinsize(void)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void check_winsizes(void)
|
||||||
|
{
|
||||||
|
if (!use_curses)
|
||||||
|
return;
|
||||||
|
if (curses_active_locked()) {
|
||||||
|
int __maybe_unused y, x;
|
||||||
|
|
||||||
|
getmaxyx(statuswin, y, x);
|
||||||
|
wresize(statuswin, logstart, x);
|
||||||
|
change_logwinsize();
|
||||||
|
doupdate();
|
||||||
|
unlock_curses();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* For mandatory printing when mutex is already locked */
|
/* For mandatory printing when mutex is already locked */
|
||||||
void wlog(const char *f, ...)
|
void wlog(const char *f, ...)
|
||||||
{
|
{
|
||||||
@ -1295,13 +1310,20 @@ void wlogprint(const char *f, ...)
|
|||||||
|
|
||||||
void log_curses(int prio, const char *f, va_list ap)
|
void log_curses(int prio, const char *f, va_list ap)
|
||||||
{
|
{
|
||||||
|
bool high_prio;
|
||||||
|
|
||||||
if (opt_quiet && prio != LOG_ERR)
|
if (opt_quiet && prio != LOG_ERR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
high_prio = (prio == LOG_WARNING || prio == LOG_ERR);
|
||||||
|
|
||||||
if (curses_active_locked()) {
|
if (curses_active_locked()) {
|
||||||
if (!opt_loginput || prio == LOG_ERR || prio == LOG_WARNING) {
|
if (!opt_loginput || high_prio) {
|
||||||
vw_printw(logwin, f, ap);
|
vw_printw(logwin, f, ap);
|
||||||
wrefresh(logwin);
|
if (high_prio)
|
||||||
|
refresh();
|
||||||
|
else
|
||||||
|
wrefresh(logwin);
|
||||||
}
|
}
|
||||||
unlock_curses();
|
unlock_curses();
|
||||||
} else
|
} else
|
||||||
@ -3654,7 +3676,7 @@ static void *watchdog_thread(void __maybe_unused *userdata)
|
|||||||
curses_print_status();
|
curses_print_status();
|
||||||
for (i = 0; i < mining_threads; i++)
|
for (i = 0; i < mining_threads; i++)
|
||||||
curses_print_devstatus(i);
|
curses_print_devstatus(i);
|
||||||
clearok(statuswin, true);
|
clearok(curscr, true);
|
||||||
doupdate();
|
doupdate();
|
||||||
unlock_curses();
|
unlock_curses();
|
||||||
}
|
}
|
||||||
@ -4152,6 +4174,10 @@ int main (int argc, char *argv[])
|
|||||||
#endif // defined(WIN32)
|
#endif // defined(WIN32)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
devcursor = 8;
|
||||||
|
logstart = devcursor + 1;
|
||||||
|
logcursor = logstart + 1;
|
||||||
|
|
||||||
block = calloc(sizeof(struct block), 1);
|
block = calloc(sizeof(struct block), 1);
|
||||||
if (unlikely(!block))
|
if (unlikely(!block))
|
||||||
quit (1, "main OOM");
|
quit (1, "main OOM");
|
||||||
@ -4181,6 +4207,9 @@ int main (int argc, char *argv[])
|
|||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
quit(1, "Unexpected extra commandline arguments");
|
quit(1, "Unexpected extra commandline arguments");
|
||||||
|
|
||||||
|
if (use_curses)
|
||||||
|
enable_curses();
|
||||||
|
|
||||||
applog(LOG_WARNING, "Started %s", packagename);
|
applog(LOG_WARNING, "Started %s", packagename);
|
||||||
|
|
||||||
strcat(opt_kernel_path, "/");
|
strcat(opt_kernel_path, "/");
|
||||||
@ -4276,16 +4305,15 @@ int main (int argc, char *argv[])
|
|||||||
|
|
||||||
load_temp_cutoffs();
|
load_temp_cutoffs();
|
||||||
|
|
||||||
devcursor = 8;
|
logstart += total_devices;
|
||||||
logstart = devcursor + total_devices + 1;
|
|
||||||
logcursor = logstart + 1;
|
logcursor = logstart + 1;
|
||||||
|
|
||||||
|
check_winsizes();
|
||||||
|
|
||||||
if (opt_realquiet)
|
if (opt_realquiet)
|
||||||
use_curses = false;
|
use_curses = false;
|
||||||
|
|
||||||
if (!total_pools) {
|
if (!total_pools) {
|
||||||
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 (!use_curses || (use_curses && !input_pool(false)))
|
if (!use_curses || (use_curses && !input_pool(false)))
|
||||||
quit(1, "Pool setup failed");
|
quit(1, "Pool setup failed");
|
||||||
@ -4396,8 +4424,6 @@ int main (int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!pools_active) {
|
if (!pools_active) {
|
||||||
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");
|
||||||
@ -4476,9 +4502,6 @@ int main (int argc, char *argv[])
|
|||||||
algo_names[opt_algo]);
|
algo_names[opt_algo]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (use_curses)
|
|
||||||
enable_curses();
|
|
||||||
|
|
||||||
watchpool_thr_id = mining_threads + 3;
|
watchpool_thr_id = mining_threads + 3;
|
||||||
thr = &thr_info[watchpool_thr_id];
|
thr = &thr_info[watchpool_thr_id];
|
||||||
/* start watchpool thread */
|
/* start watchpool thread */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user