mirror of
https://github.com/GOSTSec/sgminer
synced 2025-01-11 23:37:54 +00:00
Merge branch 'master' of github.com:ckolivas/cgminer
This commit is contained in:
commit
85b9746277
18
API-README
18
API-README
@ -122,7 +122,9 @@ The list of requests - a (*) means it requires privileged access - and replies a
|
|||||||
ADL in use=X, <- Y or N if any GPU has ADL
|
ADL in use=X, <- Y or N if any GPU has ADL
|
||||||
Strategy=Name, <- the current pool strategy
|
Strategy=Name, <- the current pool strategy
|
||||||
Log Interval=N, <- log interval (--log N)
|
Log Interval=N, <- log interval (--log N)
|
||||||
Device Code=GPU ICA | <- spaced list of compiled devices
|
Device Code=GPU ICA , <- spaced list of compiled devices
|
||||||
|
OS=Linux/Apple/..., <- operating System
|
||||||
|
Failover-Only=true/false | <- failover-only setting
|
||||||
|
|
||||||
summary SUMMARY The status summary of the miner
|
summary SUMMARY The status summary of the miner
|
||||||
e.g. Elapsed=NNN,Found Blocks=N,Getworks=N,...|
|
e.g. Elapsed=NNN,Found Blocks=N,Getworks=N,...|
|
||||||
@ -275,6 +277,10 @@ The list of requests - a (*) means it requires privileged access - and replies a
|
|||||||
check|cmd COMMAND Exists=Y/N, <- 'cmd' exists in this version
|
check|cmd COMMAND Exists=Y/N, <- 'cmd' exists in this version
|
||||||
Access=Y/N| <- you have access to use 'cmd'
|
Access=Y/N| <- you have access to use 'cmd'
|
||||||
|
|
||||||
|
failover-only|true/false (*)
|
||||||
|
none There is no reply section just the STATUS section
|
||||||
|
stating what failover-only was set to
|
||||||
|
|
||||||
When you enable, disable or restart a GPU or PGA, you will also get Thread messages
|
When you enable, disable or restart a GPU or PGA, you will also get Thread messages
|
||||||
in the cgminer status window
|
in the cgminer status window
|
||||||
|
|
||||||
@ -327,6 +333,16 @@ miner.php - an example web page to access the API
|
|||||||
Feature Changelog for external applications using the API:
|
Feature Changelog for external applications using the API:
|
||||||
|
|
||||||
|
|
||||||
|
API V1.16
|
||||||
|
|
||||||
|
Added API commands:
|
||||||
|
'failover-only'
|
||||||
|
|
||||||
|
Modified API commands:
|
||||||
|
'config' - include failover-only state
|
||||||
|
|
||||||
|
----------
|
||||||
|
|
||||||
API V1.15 (cgminer v2.6.1)
|
API V1.15 (cgminer v2.6.1)
|
||||||
|
|
||||||
Added API commands:
|
Added API commands:
|
||||||
|
43
api.c
43
api.c
@ -166,7 +166,7 @@ static const char SEPARATOR = '|';
|
|||||||
#define SEPSTR "|"
|
#define SEPSTR "|"
|
||||||
static const char GPUSEP = ',';
|
static const char GPUSEP = ',';
|
||||||
|
|
||||||
static const char *APIVERSION = "1.15";
|
static const char *APIVERSION = "1.16";
|
||||||
static const char *DEAD = "Dead";
|
static const char *DEAD = "Dead";
|
||||||
static const char *SICK = "Sick";
|
static const char *SICK = "Sick";
|
||||||
static const char *NOSTART = "NoStart";
|
static const char *NOSTART = "NoStart";
|
||||||
@ -184,6 +184,9 @@ static const char *YES = "Y";
|
|||||||
static const char *NO = "N";
|
static const char *NO = "N";
|
||||||
static const char *NULLSTR = "(null)";
|
static const char *NULLSTR = "(null)";
|
||||||
|
|
||||||
|
static const char *TRUESTR = "true";
|
||||||
|
static const char *FALSESTR = "false";
|
||||||
|
|
||||||
static const char *DEVICECODE = ""
|
static const char *DEVICECODE = ""
|
||||||
#ifdef HAVE_OPENCL
|
#ifdef HAVE_OPENCL
|
||||||
"GPU "
|
"GPU "
|
||||||
@ -376,6 +379,9 @@ static const char *JSON_PARAMETER = "parameter";
|
|||||||
#define MSG_CHECK 72
|
#define MSG_CHECK 72
|
||||||
#define MSG_POOLPRIO 73
|
#define MSG_POOLPRIO 73
|
||||||
#define MSG_DUPPID 74
|
#define MSG_DUPPID 74
|
||||||
|
#define MSG_MISBOOL 75
|
||||||
|
#define MSG_INVBOOL 76
|
||||||
|
#define MSG_FOO 77
|
||||||
|
|
||||||
enum code_severity {
|
enum code_severity {
|
||||||
SEVERITY_ERR,
|
SEVERITY_ERR,
|
||||||
@ -403,6 +409,7 @@ enum code_parameters {
|
|||||||
PARAM_POOL,
|
PARAM_POOL,
|
||||||
PARAM_STR,
|
PARAM_STR,
|
||||||
PARAM_BOTH,
|
PARAM_BOTH,
|
||||||
|
PARAM_BOOL,
|
||||||
PARAM_NONE
|
PARAM_NONE
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -524,6 +531,9 @@ struct CODES {
|
|||||||
{ SEVERITY_SUCC, MSG_MINESTATS,PARAM_NONE, "CGMiner stats" },
|
{ SEVERITY_SUCC, MSG_MINESTATS,PARAM_NONE, "CGMiner stats" },
|
||||||
{ SEVERITY_ERR, MSG_MISCHK, PARAM_NONE, "Missing check cmd" },
|
{ SEVERITY_ERR, MSG_MISCHK, PARAM_NONE, "Missing check cmd" },
|
||||||
{ SEVERITY_SUCC, MSG_CHECK, PARAM_NONE, "Check command" },
|
{ SEVERITY_SUCC, MSG_CHECK, PARAM_NONE, "Check command" },
|
||||||
|
{ SEVERITY_ERR, MSG_MISBOOL, PARAM_NONE, "Missing parameter: true/false" },
|
||||||
|
{ SEVERITY_ERR, MSG_INVBOOL, PARAM_NONE, "Invalid parameter should be true or false" },
|
||||||
|
{ SEVERITY_SUCC, MSG_FOO, PARAM_BOOL, "Failover-Only set to %s" },
|
||||||
{ SEVERITY_FAIL, 0, 0, NULL }
|
{ SEVERITY_FAIL, 0, 0, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -928,7 +938,7 @@ static struct api_data *print_data(struct api_data *root, char *buf, bool isjson
|
|||||||
sprintf(buf, "%.15f", *((double *)(root->data)));
|
sprintf(buf, "%.15f", *((double *)(root->data)));
|
||||||
break;
|
break;
|
||||||
case API_BOOL:
|
case API_BOOL:
|
||||||
sprintf(buf, "%s", *((bool *)(root->data)) ? "true" : "false");
|
sprintf(buf, "%s", *((bool *)(root->data)) ? TRUESTR : FALSESTR);
|
||||||
break;
|
break;
|
||||||
case API_TIMEVAL:
|
case API_TIMEVAL:
|
||||||
sprintf(buf, "%ld.%06ld",
|
sprintf(buf, "%ld.%06ld",
|
||||||
@ -1133,6 +1143,9 @@ static char *message(int messageid, int paramid, char *param2, bool isjson)
|
|||||||
case PARAM_BOTH:
|
case PARAM_BOTH:
|
||||||
sprintf(buf, codes[i].description, paramid, param2);
|
sprintf(buf, codes[i].description, paramid, param2);
|
||||||
break;
|
break;
|
||||||
|
case PARAM_BOOL:
|
||||||
|
sprintf(buf, codes[i].description, paramid ? TRUESTR : FALSESTR);
|
||||||
|
break;
|
||||||
case PARAM_NONE:
|
case PARAM_NONE:
|
||||||
default:
|
default:
|
||||||
strcpy(buf, codes[i].description);
|
strcpy(buf, codes[i].description);
|
||||||
@ -1233,6 +1246,7 @@ static void minerconfig(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
|
|||||||
root = api_add_int(root, "Log Interval", &opt_log_interval, false);
|
root = api_add_int(root, "Log Interval", &opt_log_interval, false);
|
||||||
root = api_add_const(root, "Device Code", DEVICECODE, false);
|
root = api_add_const(root, "Device Code", DEVICECODE, false);
|
||||||
root = api_add_const(root, "OS", OSINFO, false);
|
root = api_add_const(root, "OS", OSINFO, false);
|
||||||
|
root = api_add_bool(root, "Failover-Only", &opt_fail_only, false);
|
||||||
|
|
||||||
root = print_data(root, buf, isjson);
|
root = print_data(root, buf, isjson);
|
||||||
if (isjson)
|
if (isjson)
|
||||||
@ -1240,8 +1254,7 @@ static void minerconfig(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
|
|||||||
strcat(io_buffer, buf);
|
strcat(io_buffer, buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char*
|
static const char *status2str(enum alive status)
|
||||||
status2str(enum alive status)
|
|
||||||
{
|
{
|
||||||
switch (status) {
|
switch (status) {
|
||||||
case LIFE_WELL:
|
case LIFE_WELL:
|
||||||
@ -2704,6 +2717,27 @@ static void minerstats(__maybe_unused SOCKETTYPE c, __maybe_unused char *param,
|
|||||||
strcat(io_buffer, JSON_CLOSE);
|
strcat(io_buffer, JSON_CLOSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void failoveronly(__maybe_unused SOCKETTYPE c, char *param, bool isjson, __maybe_unused char group)
|
||||||
|
{
|
||||||
|
if (param == NULL || *param == '\0') {
|
||||||
|
strcpy(io_buffer, message(MSG_MISBOOL, 0, NULL, isjson));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
*param = tolower(*param);
|
||||||
|
|
||||||
|
if (*param != 't' && *param != 'f') {
|
||||||
|
strcpy(io_buffer, message(MSG_INVBOOL, 0, NULL, isjson));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool tf = (*param == 't');
|
||||||
|
|
||||||
|
opt_fail_only = tf;
|
||||||
|
|
||||||
|
strcpy(io_buffer, message(MSG_FOO, tf, NULL, isjson));
|
||||||
|
}
|
||||||
|
|
||||||
static void checkcommand(__maybe_unused SOCKETTYPE c, char *param, bool isjson, char group);
|
static void checkcommand(__maybe_unused SOCKETTYPE c, char *param, bool isjson, char group);
|
||||||
|
|
||||||
struct CMDS {
|
struct CMDS {
|
||||||
@ -2754,6 +2788,7 @@ struct CMDS {
|
|||||||
{ "restart", dorestart, true },
|
{ "restart", dorestart, true },
|
||||||
{ "stats", minerstats, false },
|
{ "stats", minerstats, false },
|
||||||
{ "check", checkcommand, false },
|
{ "check", checkcommand, false },
|
||||||
|
{ "failover-only", failoveronly, true },
|
||||||
{ NULL, NULL, false }
|
{ NULL, NULL, false }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ bool use_curses;
|
|||||||
#endif
|
#endif
|
||||||
static bool opt_submit_stale = true;
|
static bool opt_submit_stale = true;
|
||||||
static int opt_shares;
|
static int opt_shares;
|
||||||
static bool opt_fail_only;
|
bool opt_fail_only;
|
||||||
bool opt_autofan;
|
bool opt_autofan;
|
||||||
bool opt_autoengine;
|
bool opt_autoengine;
|
||||||
bool opt_noadl;
|
bool opt_noadl;
|
||||||
|
1
miner.h
1
miner.h
@ -551,6 +551,7 @@ extern bool opt_protocol;
|
|||||||
extern char *opt_kernel_path;
|
extern char *opt_kernel_path;
|
||||||
extern char *opt_socks_proxy;
|
extern char *opt_socks_proxy;
|
||||||
extern char *cgminer_path;
|
extern char *cgminer_path;
|
||||||
|
extern bool opt_fail_only;
|
||||||
extern bool opt_autofan;
|
extern bool opt_autofan;
|
||||||
extern bool opt_autoengine;
|
extern bool opt_autoengine;
|
||||||
extern bool use_curses;
|
extern bool use_curses;
|
||||||
|
Loading…
Reference in New Issue
Block a user