mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-06 03:54:25 +00:00
configure - set USE_USBUTILS when usbutils is required and use it in the code
This commit is contained in:
parent
2fe415f42e
commit
2f6660e83f
15
api.c
15
api.c
@ -577,7 +577,7 @@ struct CODES {
|
|||||||
{ SEVERITY_ERR, MSG_ZERINV, PARAM_STR, "Invalid zero parameter '%s'" },
|
{ SEVERITY_ERR, MSG_ZERINV, PARAM_STR, "Invalid zero parameter '%s'" },
|
||||||
{ SEVERITY_SUCC, MSG_ZERSUM, PARAM_STR, "Zeroed %s stats with summary" },
|
{ SEVERITY_SUCC, MSG_ZERSUM, PARAM_STR, "Zeroed %s stats with summary" },
|
||||||
{ SEVERITY_SUCC, MSG_ZERNOSUM, PARAM_STR, "Zeroed %s stats without summary" },
|
{ SEVERITY_SUCC, MSG_ZERNOSUM, PARAM_STR, "Zeroed %s stats without summary" },
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
{ SEVERITY_ERR, MSG_USBNODEV, PARAM_PGA, "PGA%d has no device" },
|
{ SEVERITY_ERR, MSG_USBNODEV, PARAM_PGA, "PGA%d has no device" },
|
||||||
#endif
|
#endif
|
||||||
{ SEVERITY_ERR, MSG_INVHPLG, PARAM_STR, "Invalid value for hotplug (%s) must be 0..9999" },
|
{ SEVERITY_ERR, MSG_INVHPLG, PARAM_STR, "Invalid value for hotplug (%s) must be 0..9999" },
|
||||||
@ -1440,7 +1440,7 @@ static void minerconfig(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __
|
|||||||
root = api_add_int(root, "ScanTime", &opt_scantime, false);
|
root = api_add_int(root, "ScanTime", &opt_scantime, false);
|
||||||
root = api_add_int(root, "Queue", &opt_queue, false);
|
root = api_add_int(root, "Queue", &opt_queue, false);
|
||||||
root = api_add_int(root, "Expiry", &opt_expiry, false);
|
root = api_add_int(root, "Expiry", &opt_expiry, false);
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
if (hotplug_time == 0)
|
if (hotplug_time == 0)
|
||||||
root = api_add_const(root, "Hotplug", DISABLED, false);
|
root = api_add_const(root, "Hotplug", DISABLED, false);
|
||||||
else
|
else
|
||||||
@ -1607,7 +1607,7 @@ static void pgastatus(struct io_data *io_data, int pga, bool isjson, bool precom
|
|||||||
root = api_add_diff(root, "Difficulty Accepted", &(cgpu->diff_accepted), false);
|
root = api_add_diff(root, "Difficulty Accepted", &(cgpu->diff_accepted), false);
|
||||||
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
|
root = api_add_diff(root, "Difficulty Rejected", &(cgpu->diff_rejected), false);
|
||||||
root = api_add_diff(root, "Last Share Difficulty", &(cgpu->last_share_diff), false);
|
root = api_add_diff(root, "Last Share Difficulty", &(cgpu->last_share_diff), false);
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
root = api_add_bool(root, "No Device", &(cgpu->usbinfo.nodev), false);
|
root = api_add_bool(root, "No Device", &(cgpu->usbinfo.nodev), false);
|
||||||
#endif
|
#endif
|
||||||
root = api_add_time(root, "Last Valid Work", &(cgpu->last_device_valid_work), false);
|
root = api_add_time(root, "Last Valid Work", &(cgpu->last_device_valid_work), false);
|
||||||
@ -1828,7 +1828,7 @@ static void pgaenable(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
if (cgpu->usbinfo.nodev) {
|
if (cgpu->usbinfo.nodev) {
|
||||||
message(io_data, MSG_USBNODEV, id, NULL, isjson);
|
message(io_data, MSG_USBNODEV, id, NULL, isjson);
|
||||||
return;
|
return;
|
||||||
@ -3185,7 +3185,7 @@ static void usbstats(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __may
|
|||||||
{
|
{
|
||||||
struct api_data *root = NULL;
|
struct api_data *root = NULL;
|
||||||
|
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
char buf[TMPBUFSIZ];
|
char buf[TMPBUFSIZ];
|
||||||
bool io_open = false;
|
bool io_open = false;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@ -3198,8 +3198,7 @@ static void usbstats(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __may
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
|
|
||||||
message(io_data, MSG_USBSTA, 0, NULL, isjson);
|
message(io_data, MSG_USBSTA, 0, NULL, isjson);
|
||||||
|
|
||||||
if (isjson)
|
if (isjson)
|
||||||
@ -3332,7 +3331,7 @@ static void dozero(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *p
|
|||||||
|
|
||||||
static void dohotplug(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson, __maybe_unused char group)
|
static void dohotplug(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __maybe_unused char *param, bool isjson, __maybe_unused char group)
|
||||||
{
|
{
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
int value;
|
int value;
|
||||||
|
|
||||||
if (param == NULL || *param == '\0') {
|
if (param == NULL || *param == '\0') {
|
||||||
|
14
cgminer.c
14
cgminer.c
@ -157,7 +157,7 @@ static int input_thr_id;
|
|||||||
#endif
|
#endif
|
||||||
int gpur_thr_id;
|
int gpur_thr_id;
|
||||||
static int api_thr_id;
|
static int api_thr_id;
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
static int hotplug_thr_id;
|
static int hotplug_thr_id;
|
||||||
#endif
|
#endif
|
||||||
static int total_control_threads;
|
static int total_control_threads;
|
||||||
@ -987,7 +987,7 @@ static struct opt_table opt_config_table[] = {
|
|||||||
#endif
|
#endif
|
||||||
OPT_WITH_ARG("--hotplug",
|
OPT_WITH_ARG("--hotplug",
|
||||||
set_int_0_to_9999, NULL, &hotplug_time,
|
set_int_0_to_9999, NULL, &hotplug_time,
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
"Seconds between hotplug checks (0 means never check)"
|
"Seconds between hotplug checks (0 means never check)"
|
||||||
#else
|
#else
|
||||||
opt_hidden
|
opt_hidden
|
||||||
@ -2038,7 +2038,7 @@ static void curses_print_devstatus(int thr_id)
|
|||||||
suffix_string(dh64, displayed_hashes, 4);
|
suffix_string(dh64, displayed_hashes, 4);
|
||||||
suffix_string(dr64, displayed_rolling, 4);
|
suffix_string(dr64, displayed_rolling, 4);
|
||||||
|
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
if (cgpu->usbinfo.nodev)
|
if (cgpu->usbinfo.nodev)
|
||||||
wprintw(statuswin, "ZOMBIE");
|
wprintw(statuswin, "ZOMBIE");
|
||||||
else
|
else
|
||||||
@ -2806,7 +2806,7 @@ static void __kill_work(void)
|
|||||||
|
|
||||||
applog(LOG_INFO, "Received kill message");
|
applog(LOG_INFO, "Received kill message");
|
||||||
|
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
/* Best to get rid of it first so it doesn't
|
/* Best to get rid of it first so it doesn't
|
||||||
* try to create any new devices */
|
* try to create any new devices */
|
||||||
if (!opt_scrypt) {
|
if (!opt_scrypt) {
|
||||||
@ -2852,7 +2852,7 @@ static void __kill_work(void)
|
|||||||
thr = &control_thr[api_thr_id];
|
thr = &control_thr[api_thr_id];
|
||||||
thr_info_cancel(thr);
|
thr_info_cancel(thr);
|
||||||
|
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
/* Release USB resources in case it's a restart
|
/* Release USB resources in case it's a restart
|
||||||
* and not a QUIT */
|
* and not a QUIT */
|
||||||
if (!opt_scrypt) {
|
if (!opt_scrypt) {
|
||||||
@ -6789,7 +6789,7 @@ struct device_drv *copy_drv(struct device_drv *drv)
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
static void hotplug_process()
|
static void hotplug_process()
|
||||||
{
|
{
|
||||||
struct thr_info *thr;
|
struct thr_info *thr;
|
||||||
@ -7405,7 +7405,7 @@ begin_bench:
|
|||||||
if (thr_info_create(thr, NULL, api_thread, thr))
|
if (thr_info_create(thr, NULL, api_thread, thr))
|
||||||
quit(1, "API thread create failed");
|
quit(1, "API thread create failed");
|
||||||
|
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
if (!opt_scrypt) {
|
if (!opt_scrypt) {
|
||||||
hotplug_thr_id = 6;
|
hotplug_thr_id = 6;
|
||||||
thr = &control_thr[hotplug_thr_id];
|
thr = &control_thr[hotplug_thr_id];
|
||||||
|
@ -271,7 +271,6 @@ else
|
|||||||
])
|
])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
AM_CONDITIONAL([NEED_FPGAUTILS], [test x$icarus$bitforce$modminer$ztex != xnononono])
|
AM_CONDITIONAL([NEED_FPGAUTILS], [test x$icarus$bitforce$modminer$ztex != xnononono])
|
||||||
AM_CONDITIONAL([NEED_USBUTILS_C], [test x$bitforce$modminer != xnono])
|
AM_CONDITIONAL([NEED_USBUTILS_C], [test x$bitforce$modminer != xnono])
|
||||||
AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
|
AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
|
||||||
@ -279,6 +278,10 @@ AM_CONDITIONAL([WANT_JANSSON], [test x$request_jansson = xtrue])
|
|||||||
AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
|
AM_CONDITIONAL([HAVE_WINDOWS], [test x$have_win32 = xtrue])
|
||||||
AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
|
AM_CONDITIONAL([HAVE_x86_64], [test x$have_x86_64 = xtrue])
|
||||||
|
|
||||||
|
if test "x$bitforce$modminer" != xnono; then
|
||||||
|
AC_DEFINE([USE_USBUTILS], [1], [Defined to 1 if usbutils support required])
|
||||||
|
fi
|
||||||
|
|
||||||
if test x$request_jansson = xtrue
|
if test x$request_jansson = xtrue
|
||||||
then
|
then
|
||||||
JANSSON_LIBS="compat/jansson/libjansson.a"
|
JANSSON_LIBS="compat/jansson/libjansson.a"
|
||||||
|
6
miner.h
6
miner.h
@ -114,7 +114,7 @@ static inline int fsync (int fd)
|
|||||||
#include "libztex.h"
|
#include "libztex.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
#include "usbutils.h"
|
#include "usbutils.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -408,14 +408,14 @@ struct cgpu_info {
|
|||||||
#ifdef USE_ZTEX
|
#ifdef USE_ZTEX
|
||||||
struct libztex_device *device_ztex;
|
struct libztex_device *device_ztex;
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
struct cg_usb_device *usbdev;
|
struct cg_usb_device *usbdev;
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_ICARUS
|
#ifdef USE_ICARUS
|
||||||
int device_fd;
|
int device_fd;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
|
#ifdef USE_USBUTILS
|
||||||
struct cg_usb_info usbinfo;
|
struct cg_usb_info usbinfo;
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_MODMINER
|
#ifdef USE_MODMINER
|
||||||
|
Loading…
x
Reference in New Issue
Block a user