Browse Source

configure - set USE_USBUTILS when usbutils is required and use it in the code

nfactor-troky
Kano 12 years ago
parent
commit
2f6660e83f
  1. 15
      api.c
  2. 14
      cgminer.c
  3. 5
      configure.ac
  4. 6
      miner.h

15
api.c

@ -577,7 +577,7 @@ struct CODES { @@ -577,7 +577,7 @@ struct CODES {
{ SEVERITY_ERR, MSG_ZERINV, PARAM_STR, "Invalid zero parameter '%s'" },
{ SEVERITY_SUCC, MSG_ZERSUM, PARAM_STR, "Zeroed %s stats with 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" },
#endif
{ 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, __ @@ -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, "Queue", &opt_queue, false);
root = api_add_int(root, "Expiry", &opt_expiry, false);
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
if (hotplug_time == 0)
root = api_add_const(root, "Hotplug", DISABLED, false);
else
@ -1607,7 +1607,7 @@ static void pgastatus(struct io_data *io_data, int pga, bool isjson, bool precom @@ -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 Rejected", &(cgpu->diff_rejected), 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);
#endif
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 @@ -1828,7 +1828,7 @@ static void pgaenable(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char
}
#endif
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
if (cgpu->usbinfo.nodev) {
message(io_data, MSG_USBNODEV, id, NULL, isjson);
return;
@ -3185,7 +3185,7 @@ static void usbstats(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __may @@ -3185,7 +3185,7 @@ static void usbstats(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __may
{
struct api_data *root = NULL;
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
char buf[TMPBUFSIZ];
bool io_open = false;
int count = 0;
@ -3198,8 +3198,7 @@ static void usbstats(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __may @@ -3198,8 +3198,7 @@ static void usbstats(struct io_data *io_data, __maybe_unused SOCKETTYPE c, __may
return;
}
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
message(io_data, MSG_USBSTA, 0, NULL, isjson);
if (isjson)
@ -3332,7 +3331,7 @@ static void dozero(struct io_data *io_data, __maybe_unused SOCKETTYPE c, char *p @@ -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)
{
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
int value;
if (param == NULL || *param == '\0') {

14
cgminer.c

@ -157,7 +157,7 @@ static int input_thr_id; @@ -157,7 +157,7 @@ static int input_thr_id;
#endif
int gpur_thr_id;
static int api_thr_id;
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
static int hotplug_thr_id;
#endif
static int total_control_threads;
@ -987,7 +987,7 @@ static struct opt_table opt_config_table[] = { @@ -987,7 +987,7 @@ static struct opt_table opt_config_table[] = {
#endif
OPT_WITH_ARG("--hotplug",
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)"
#else
opt_hidden
@ -2038,7 +2038,7 @@ static void curses_print_devstatus(int thr_id) @@ -2038,7 +2038,7 @@ static void curses_print_devstatus(int thr_id)
suffix_string(dh64, displayed_hashes, 4);
suffix_string(dr64, displayed_rolling, 4);
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
if (cgpu->usbinfo.nodev)
wprintw(statuswin, "ZOMBIE");
else
@ -2806,7 +2806,7 @@ static void __kill_work(void) @@ -2806,7 +2806,7 @@ static void __kill_work(void)
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
* try to create any new devices */
if (!opt_scrypt) {
@ -2852,7 +2852,7 @@ static void __kill_work(void) @@ -2852,7 +2852,7 @@ static void __kill_work(void)
thr = &control_thr[api_thr_id];
thr_info_cancel(thr);
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
/* Release USB resources in case it's a restart
* and not a QUIT */
if (!opt_scrypt) {
@ -6789,7 +6789,7 @@ struct device_drv *copy_drv(struct device_drv *drv) @@ -6789,7 +6789,7 @@ struct device_drv *copy_drv(struct device_drv *drv)
return copy;
}
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
static void hotplug_process()
{
struct thr_info *thr;
@ -7405,7 +7405,7 @@ begin_bench: @@ -7405,7 +7405,7 @@ begin_bench:
if (thr_info_create(thr, NULL, api_thread, thr))
quit(1, "API thread create failed");
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
if (!opt_scrypt) {
hotplug_thr_id = 6;
thr = &control_thr[hotplug_thr_id];

5
configure.ac

@ -271,7 +271,6 @@ else @@ -271,7 +271,6 @@ else
])
fi
AM_CONDITIONAL([NEED_FPGAUTILS], [test x$icarus$bitforce$modminer$ztex != xnononono])
AM_CONDITIONAL([NEED_USBUTILS_C], [test x$bitforce$modminer != xnono])
AM_CONDITIONAL([HAVE_CURSES], [test x$curses = xyes])
@ -279,6 +278,10 @@ AM_CONDITIONAL([WANT_JANSSON], [test x$request_jansson = xtrue]) @@ -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_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
then
JANSSON_LIBS="compat/jansson/libjansson.a"

6
miner.h

@ -114,7 +114,7 @@ static inline int fsync (int fd) @@ -114,7 +114,7 @@ static inline int fsync (int fd)
#include "libztex.h"
#endif
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
#include "usbutils.h"
#endif
@ -408,14 +408,14 @@ struct cgpu_info { @@ -408,14 +408,14 @@ struct cgpu_info {
#ifdef USE_ZTEX
struct libztex_device *device_ztex;
#endif
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
struct cg_usb_device *usbdev;
#endif
#ifdef USE_ICARUS
int device_fd;
#endif
};
#if defined(USE_MODMINER) || defined(USE_BITFORCE)
#ifdef USE_USBUTILS
struct cg_usb_info usbinfo;
#endif
#ifdef USE_MODMINER

Loading…
Cancel
Save