Anyway, the change relates to 3 issues, the 3rd one I haven't confirmed if it fixes it yet or not.
1) BFL doesn't display an ERR (only a DEBUG message) if it fails to open a device (so you don't know unless you have debug on)
Here had a problem with scanhash() and disabling of BFL device. Nothing to do with opening device.
LOG_ERR is used.
static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint64_t __maybe_unused max_nonce)
{
struct cgpu_info *bitforce = thr->cgpu;
int fdDev = bitforce->device_fd;
char pdevbuf[0x100];
unsigned char ob[61] = ">>>>>>>>12345678901234567890123456789012123456789012>>>>>>>>";
int i;
char *pnoncebuf;
char *s;
uint32_t nonce;
BFwrite(fdDev, "ZDX", 3);
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
if (unlikely(!pdevbuf[0])) {
applog(LOG_ERR, "Error reading from BitForce (ZDX)");
return 0;
}
if (unlikely(pdevbuf[0] != 'O' || pdevbuf[1] != 'K')) {
applog(LOG_ERR, "BitForce ZDX reports: %s", pdevbuf);
return 0;
}
memcpy(ob + 8, work->midstate, 32);
memcpy(ob + 8 + 32, work->data + 64, 12);
BFwrite(fdDev, ob, 60);
if (opt_debug) {
s = bin2hex(ob + 8, 44);
applog(LOG_DEBUG, "BitForce block data: %s", s);
free(s);
}
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
if (unlikely(!pdevbuf[0])) {
applog(LOG_ERR, "Error reading from BitForce (block data)");
return 0;
}
if (unlikely(pdevbuf[0] != 'O' || pdevbuf[1] != 'K')) {
applog(LOG_ERR, "BitForce block data reports: %s", pdevbuf);
return 0;
}
BFwrite(fdDev, "ZLX", 3);
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
if (unlikely(!pdevbuf[0])) {
applog(LOG_ERR, "Error reading from BitForce (ZKX)");
return 0;
}
if ((!strncasecmp(pdevbuf, "TEMP", 4)) && (s = strchr(pdevbuf + 4, ':'))) {
float temp = strtof(s + 1, NULL);
if (temp > 0) {
bitforce->temp = temp;
if (temp > bitforce->cutofftemp) {
applog(LOG_WARNING, "Hit thermal cutoff limit on %s %d, disabling!", bitforce->api->name, bitforce->device_id);
bitforce->deven = DEV_RECOVER;
bitforce->device_last_not_well = time(NULL);
bitforce->device_not_well_reason = REASON_DEV_THERMAL_CUTOFF;
bitforce->dev_thermal_cutoff_count++;
}
}
}
usleep(4500000);
i = 4500;
while (1) {
BFwrite(fdDev, "ZFX", 3);
BFgets(pdevbuf, sizeof(pdevbuf), fdDev);
if (unlikely(!pdevbuf[0])) {
applog(LOG_ERR, "Error reading from BitForce (ZFX)");
return 0;
}
if (pdevbuf[0] != 'B')
break;
usleep(10000);
i += 10;
}
applog(LOG_DEBUG, "BitForce waited %dms until %s\n", i, pdevbuf);
work->blk.nonce = 0xffffffff;
if (pdevbuf[2] == '-')
return 0xffffffff;
else if (strncasecmp(pdevbuf, "NONCE-FOUND", 11)) {
applog(LOG_ERR, "BitForce result reports: %s", pdevbuf);
return 0;
}
pnoncebuf = &pdevbuf[12];
while (1) {
hex2bin((void*)&nonce, pnoncebuf, 4);
#ifndef __BIG_ENDIAN__
nonce = swab32(nonce);
#endif
submit_nonce(thr, work, nonce);
if (pnoncebuf[8] != ',')
break;
pnoncebuf += 9;
}
return 0xffffffff;
}