klondike - debug dump structured replies
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
diff --git a/driver-klondike.c b/driver-klondike.c
index b3ffe37..44a62b2 100644
--- a/driver-klondike.c
+++ b/driver-klondike.c
@@ -82,7 +82,7 @@ typedef struct _workresult {
uint32_t nonce;
} WORKRESULT;
-typedef struct kondike_cfg {
+typedef struct klondike_cfg {
uint16_t hashclock;
uint8_t temptarget;
uint8_t tempcritical;
@@ -339,12 +339,18 @@ static void klondike_check_nonce(struct cgpu_info *klncgpu, WORKRESULT *result)
//inc_hw_errors(klncgpu->thr[0]);
}
+// Change this to LOG_WARNING if you wish to always see the replies
+#define READ_DEBUG LOG_DEBUG
+
// thread to keep looking for replies
static void *klondike_get_replies(void *userdata)
{
struct cgpu_info *klncgpu = (struct cgpu_info *)userdata;
struct klondike_info *klninfo = (struct klondike_info *)(klncgpu->device_data);
struct klondike_status *ks;
+ struct _workresult *wr;
+ struct klondike_cfg *kc;
+ struct klondike_id *ki;
char *replybuf;
int err, recd;
@@ -361,7 +367,7 @@ static void *klondike_get_replies(void *userdata)
if (!err && recd == REPLY_SIZE) {
if (opt_log_level <= LOG_DEBUG) {
char *hexdata = bin2hex((unsigned char *)(replybuf+1), recd);
- applog(LOG_DEBUG, "%s (%s) reply [%s:%s]", klncgpu->drv->dname, klncgpu->device_path, replybuf+1, hexdata);
+ applog(READ_DEBUG, "%s (%s) reply [%s:%s]", klncgpu->drv->dname, klncgpu->device_path, replybuf+1, hexdata);
free(hexdata);
}
if (++klninfo->nextreply == MAX_REPLY_COUNT)
@@ -370,7 +376,16 @@ static void *klondike_get_replies(void *userdata)
replybuf[0] = replybuf[1];
switch (replybuf[0]) {
case '=':
+ wr = (struct _workresult *)(replybuf+1);
klondike_check_nonce(klncgpu, (WORKRESULT *)replybuf);
+ applog(READ_DEBUG,
+ "%s (%s) reply: work [%c] device=%d workid=%d"
+ " nonce=0x%08x",
+ klncgpu->drv->dname, klncgpu->device_path,
+ *(replybuf+1),
+ (int)(wr->device),
+ (int)(wr->workid),
+ (unsigned int)(wr->nonce));
break;
case 'S':
case 'W':
@@ -381,6 +396,45 @@ static void *klondike_get_replies(void *userdata)
klninfo->errorcount += ks->errorcount;
klninfo->noisecount += ks->noise;
wr_unlock(&(klninfo->stat_lock));
+ applog(READ_DEBUG,
+ "%s (%s) reply: status [%c] chips=%d slaves=%d"
+ " workcq=%d workid=%d temp=%d fan=%d errors=%d"
+ " hashes=%d max=%d noise=%d",
+ klncgpu->drv->dname, klncgpu->device_path,
+ *(replybuf+1),
+ (int)(ks->chipcount),
+ (int)(ks->slavecount),
+ (int)(ks->workqc),
+ (int)(ks->workid),
+ (int)(ks->temp),
+ (int)(ks->fanspeed),
+ (int)(ks->errorcount),
+ (int)(ks->hashcount),
+ (int)(ks->maxcount),
+ (int)(ks->noise));
+ break;
+ case 'C':
+ kc = (struct klondike_cfg *)(replybuf+2);
+ applog(READ_DEBUG,
+ "%s (%s) reply: config [%c] clock=%d temptarget=%d"
+ " tempcrit=%d fan=%d",
+ klncgpu->drv->dname, klncgpu->device_path,
+ *(replybuf+1),
+ (int)(kc->hashclock),
+ (int)(kc->temptarget),
+ (int)(kc->tempcritical),
+ (int)(kc->fantarget));
+ break;
+ case 'I':
+ ki = (struct klondike_id *)(replybuf+2);
+ applog(READ_DEBUG,
+ "%s (%s) reply: info [%c] version=0x%02x prod=%.7s"
+ " serial=0x%08x",
+ klncgpu->drv->dname, klncgpu->device_path,
+ *(replybuf+1),
+ (int)(ki->version),
+ ki->product,
+ (unsigned int)(ki->serial));
break;
default:
break;