mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 10:04:33 +00:00
usbutils extra message requirements
This commit is contained in:
parent
b3ae0f168e
commit
8dd1ed2454
29
usbutils.c
29
usbutils.c
@ -195,6 +195,8 @@ extern struct device_drv avalon_drv;
|
|||||||
|
|
||||||
#define STRBUFLEN 256
|
#define STRBUFLEN 256
|
||||||
static const char *BLANK = "";
|
static const char *BLANK = "";
|
||||||
|
static const char *space = " ";
|
||||||
|
static const char *nodatareturned = "no data returned ";
|
||||||
|
|
||||||
// For device limits by driver
|
// For device limits by driver
|
||||||
static struct driver_count {
|
static struct driver_count {
|
||||||
@ -286,6 +288,12 @@ static const char *C_PURGETX_S = "PurgeTx";
|
|||||||
static const char *C_FLASHREPLY_S = "FlashReply";
|
static const char *C_FLASHREPLY_S = "FlashReply";
|
||||||
static const char *C_REQUESTDETAILS_S = "RequestDetails";
|
static const char *C_REQUESTDETAILS_S = "RequestDetails";
|
||||||
static const char *C_GETDETAILS_S = "GetDetails";
|
static const char *C_GETDETAILS_S = "GetDetails";
|
||||||
|
static const char *C_REQUESTRESULTS_S = "RequestResults";
|
||||||
|
static const char *C_GETRESULTS_S = "GetResults";
|
||||||
|
static const char *C_REQUESTQUEJOB_S = "RequestQueJob";
|
||||||
|
static const char *C_REQUESTQUEJOBSTATUS_S = "RequestQueJobStatus";
|
||||||
|
static const char *C_QUEJOB_S = "QueJob";
|
||||||
|
static const char *C_QUEJOBSTATUS_S = "QueJobStatus";
|
||||||
|
|
||||||
#ifdef EOL
|
#ifdef EOL
|
||||||
#undef EOL
|
#undef EOL
|
||||||
@ -745,6 +753,12 @@ static void cgusb_check_init()
|
|||||||
usb_commands[C_FLASHREPLY] = C_FLASHREPLY_S;
|
usb_commands[C_FLASHREPLY] = C_FLASHREPLY_S;
|
||||||
usb_commands[C_REQUESTDETAILS] = C_REQUESTDETAILS_S;
|
usb_commands[C_REQUESTDETAILS] = C_REQUESTDETAILS_S;
|
||||||
usb_commands[C_GETDETAILS] = C_GETDETAILS_S;
|
usb_commands[C_GETDETAILS] = C_GETDETAILS_S;
|
||||||
|
usb_commands[C_REQUESTRESULTS] = C_REQUESTRESULTS_S;
|
||||||
|
usb_commands[C_GETRESULTS] = C_GETRESULTS_S;
|
||||||
|
usb_commands[C_REQUESTQUEJOB] = C_REQUESTQUEJOB_S;
|
||||||
|
usb_commands[C_REQUESTQUEJOBSTATUS] = C_REQUESTQUEJOBSTATUS_S;
|
||||||
|
usb_commands[C_QUEJOB] = C_QUEJOB_S;
|
||||||
|
usb_commands[C_QUEJOBSTATUS] = C_QUEJOBSTATUS_S;
|
||||||
|
|
||||||
stats_initialised = true;
|
stats_initialised = true;
|
||||||
}
|
}
|
||||||
@ -759,6 +773,21 @@ const char *usb_cmdname(enum usb_cmds cmd)
|
|||||||
return usb_commands[cmd];
|
return usb_commands[cmd];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void usb_applog(struct cgpu_info *cgpu, enum usb_cmds cmd, char *msg, int amount, int err)
|
||||||
|
{
|
||||||
|
if (msg && !*msg)
|
||||||
|
msg = NULL;
|
||||||
|
|
||||||
|
if (!msg && amount == 0 && err == LIBUSB_SUCCESS)
|
||||||
|
msg = (char *)nodatareturned;
|
||||||
|
|
||||||
|
applog(LOG_ERR, "%s%i: %s failed%s%s (err=%d amt%d)",
|
||||||
|
cgpu->drv->name, cgpu->device_id,
|
||||||
|
usb_cmdname(cmd),
|
||||||
|
msg ? space : BLANK, msg ? msg : BLANK,
|
||||||
|
err, amount);
|
||||||
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -125,6 +125,12 @@ enum usb_cmds {
|
|||||||
C_FLASHREPLY,
|
C_FLASHREPLY,
|
||||||
C_REQUESTDETAILS,
|
C_REQUESTDETAILS,
|
||||||
C_GETDETAILS,
|
C_GETDETAILS,
|
||||||
|
C_REQUESTRESULTS,
|
||||||
|
C_GETRESULTS,
|
||||||
|
C_REQUESTQUEJOB,
|
||||||
|
C_REQUESTQUEJOBSTATUS,
|
||||||
|
C_QUEJOB,
|
||||||
|
C_QUEJOBSTATUS,
|
||||||
C_MAX
|
C_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -133,6 +139,7 @@ struct cgpu_info;
|
|||||||
|
|
||||||
void usb_all(int level);
|
void usb_all(int level);
|
||||||
const char *usb_cmdname(enum usb_cmds cmd);
|
const char *usb_cmdname(enum usb_cmds cmd);
|
||||||
|
void usb_applog(struct cgpu_info *bflsc, enum usb_cmds cmd, char *msg, int amount, int err);
|
||||||
void usb_uninit(struct cgpu_info *cgpu);
|
void usb_uninit(struct cgpu_info *cgpu);
|
||||||
bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find_devices *found);
|
bool usb_init(struct cgpu_info *cgpu, struct libusb_device *dev, struct usb_find_devices *found);
|
||||||
void usb_detect(struct device_drv *drv, bool (*device_detect)(struct libusb_device *, struct usb_find_devices *));
|
void usb_detect(struct device_drv *drv, bool (*device_detect)(struct libusb_device *, struct usb_find_devices *));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user