mirror of
https://github.com/GOSTSec/sgminer
synced 2025-02-02 10:04:33 +00:00
Add tiny delay after writing to BFL
Change BFL errors to something more human readable Send work busy re-tries after 10ms delay
This commit is contained in:
parent
efaa7398fb
commit
a11a322ba6
@ -43,8 +43,10 @@ static ssize_t BFwrite(int fd, const void *buf, ssize_t bufLen)
|
|||||||
if ((bufLen) != write(fd, buf, bufLen)) {
|
if ((bufLen) != write(fd, buf, bufLen)) {
|
||||||
applog(LOG_ERR, "BFL: Error writing: %s", buf);
|
applog(LOG_ERR, "BFL: Error writing: %s", buf);
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else {
|
||||||
|
usleep(100);
|
||||||
return bufLen;
|
return bufLen;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define BFclose(fd) close(fd)
|
#define BFclose(fd) close(fd)
|
||||||
@ -214,7 +216,7 @@ static bool bitforce_get_temp(struct cgpu_info *bitforce)
|
|||||||
mutex_unlock(&bitforce->device_mutex);
|
mutex_unlock(&bitforce->device_mutex);
|
||||||
|
|
||||||
if (unlikely(!pdevbuf[0])) {
|
if (unlikely(!pdevbuf[0])) {
|
||||||
applog(LOG_ERR, "BFL%i: Error reading (ZLX)", bitforce->device_id);
|
applog(LOG_ERR, "BFL%i: Error: Get temp returned empty string", bitforce->device_id);
|
||||||
bitforce->temp = 0;
|
bitforce->temp = 0;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -245,22 +247,21 @@ static bool bitforce_send_work(struct thr_info *thr, struct work *work)
|
|||||||
|
|
||||||
if (!fdDev)
|
if (!fdDev)
|
||||||
return false;
|
return false;
|
||||||
|
re_send:
|
||||||
mutex_lock(&bitforce->device_mutex);
|
mutex_lock(&bitforce->device_mutex);
|
||||||
BFwrite(fdDev, "ZDX", 3);
|
BFwrite(fdDev, "ZDX", 3);
|
||||||
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
|
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
|
||||||
if (unlikely(!pdevbuf[0])) {
|
if (unlikely(!pdevbuf[0])) {
|
||||||
applog(LOG_ERR, "BFL%i: Error reading (ZDX)", bitforce->device_id);
|
applog(LOG_ERR, "BFL%i: Error: Send work returned empty string", bitforce->device_id);
|
||||||
mutex_unlock(&bitforce->device_mutex);
|
mutex_unlock(&bitforce->device_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
} else if (pdevbuf[0] == 'B'){
|
||||||
if (pdevbuf[0] == 'B'){
|
applog(LOG_DEBUG, "BFL%i: Busy", bitforce->device_id);
|
||||||
applog(LOG_WARNING, "BFL%i: Throttling", bitforce->device_id);
|
|
||||||
mutex_unlock(&bitforce->device_mutex);
|
mutex_unlock(&bitforce->device_mutex);
|
||||||
return true;
|
usleep(BITFORCE_CHECK_INTERVAL_MS*1000);
|
||||||
}
|
goto re_send;
|
||||||
else if (unlikely(pdevbuf[0] != 'O' || pdevbuf[1] != 'K')) {
|
} else if (unlikely(pdevbuf[0] != 'O' || pdevbuf[1] != 'K')) {
|
||||||
applog(LOG_ERR, "BFL%i: ZDX reports: %s", bitforce->device_id, pdevbuf);
|
applog(LOG_ERR, "BFL%i: Error: Send work reports: %s", bitforce->device_id, pdevbuf);
|
||||||
mutex_unlock(&bitforce->device_mutex);
|
mutex_unlock(&bitforce->device_mutex);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -276,11 +277,11 @@ static bool bitforce_send_work(struct thr_info *thr, struct work *work)
|
|||||||
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
|
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
|
||||||
mutex_unlock(&bitforce->device_mutex);
|
mutex_unlock(&bitforce->device_mutex);
|
||||||
if (unlikely(!pdevbuf[0])) {
|
if (unlikely(!pdevbuf[0])) {
|
||||||
applog(LOG_ERR, "BFL%i: Error reading (block data)", bitforce->device_id);
|
applog(LOG_ERR, "BFL%i: Error: Send block data returned empty string", bitforce->device_id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (unlikely(pdevbuf[0] != 'O' || pdevbuf[1] != 'K')) {
|
if (unlikely(pdevbuf[0] != 'O' || pdevbuf[1] != 'K')) {
|
||||||
applog(LOG_ERR, "BFL%i: block data reports: %s", bitforce->device_id, pdevbuf);
|
applog(LOG_ERR, "BFL%i: Error: Send block data reports: %s", bitforce->device_id, pdevbuf);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@ -304,7 +305,7 @@ static uint64_t bitforce_get_result(struct thr_info *thr, struct work *work)
|
|||||||
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
|
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
|
||||||
mutex_unlock(&bitforce->device_mutex);
|
mutex_unlock(&bitforce->device_mutex);
|
||||||
if (unlikely(!pdevbuf[0])) {
|
if (unlikely(!pdevbuf[0])) {
|
||||||
applog(LOG_ERR, "BFL%i: Error reading (ZFX)", bitforce->device_id);
|
applog(LOG_ERR, "BFL%i: Error: Get result returned empty string", bitforce->device_id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (pdevbuf[0] != 'B')
|
if (pdevbuf[0] != 'B')
|
||||||
@ -333,7 +334,7 @@ static uint64_t bitforce_get_result(struct thr_info *thr, struct work *work)
|
|||||||
else if (pdevbuf[0] == 'I')
|
else if (pdevbuf[0] == 'I')
|
||||||
return 1; /* Device idle */
|
return 1; /* Device idle */
|
||||||
else if (strncasecmp(pdevbuf, "NONCE-FOUND", 11)) {
|
else if (strncasecmp(pdevbuf, "NONCE-FOUND", 11)) {
|
||||||
applog(LOG_WARNING, "BFL%i: result reports: %s", bitforce->device_id, pdevbuf);
|
applog(LOG_WARNING, "BFL%i: Error: Get result reports: %s", bitforce->device_id, pdevbuf);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user