|
|
@ -146,6 +146,7 @@ void bitforce_init(struct cgpu_info *bitforce) |
|
|
|
|
|
|
|
|
|
|
|
applog(LOG_INFO, "BFL%i: Re-initalizing", bitforce->device_id); |
|
|
|
applog(LOG_INFO, "BFL%i: Re-initalizing", bitforce->device_id); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mutex_lock(&bitforce->device_mutex); |
|
|
|
if (fdDev) { |
|
|
|
if (fdDev) { |
|
|
|
BFclose(fdDev); |
|
|
|
BFclose(fdDev); |
|
|
|
bitforce->device_fd = 0; |
|
|
|
bitforce->device_fd = 0; |
|
|
@ -154,23 +155,22 @@ void bitforce_init(struct cgpu_info *bitforce) |
|
|
|
fdDev = BFopen(devpath); |
|
|
|
fdDev = BFopen(devpath); |
|
|
|
if (unlikely(fdDev == -1)) { |
|
|
|
if (unlikely(fdDev == -1)) { |
|
|
|
applog(LOG_ERR, "BFL%i: Failed to open %s", bitforce->device_id, devpath); |
|
|
|
applog(LOG_ERR, "BFL%i: Failed to open %s", bitforce->device_id, devpath); |
|
|
|
|
|
|
|
mutex_unlock(&bitforce->device_mutex); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
bitforce->device_fd = fdDev; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mutex_lock(&bitforce->device_mutex); |
|
|
|
|
|
|
|
BFwrite(fdDev, "ZGX", 3); |
|
|
|
BFwrite(fdDev, "ZGX", 3); |
|
|
|
BFgets(pdevbuf, sizeof(pdevbuf), fdDev); |
|
|
|
BFgets(pdevbuf, sizeof(pdevbuf), fdDev); |
|
|
|
mutex_unlock(&bitforce->device_mutex); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(!pdevbuf[0])) { |
|
|
|
if (unlikely(!pdevbuf[0])) { |
|
|
|
applog(LOG_ERR, "BFL%i: Error reading (ZGX)", bitforce->device_id); |
|
|
|
applog(LOG_ERR, "BFL%i: Error reading (ZGX)", bitforce->device_id); |
|
|
|
|
|
|
|
mutex_unlock(&bitforce->device_mutex); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(!strstr(pdevbuf, "SHA256"))) { |
|
|
|
if (unlikely(!strstr(pdevbuf, "SHA256"))) { |
|
|
|
applog(LOG_ERR, "BFL%i: Didn't recognise BitForce on %s", bitforce->device_id, devpath); |
|
|
|
applog(LOG_ERR, "BFL%i: Didn't recognise BitForce on %s returned: %s", bitforce->device_id, devpath, pdevbuf); |
|
|
|
|
|
|
|
mutex_unlock(&bitforce->device_mutex); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -179,6 +179,9 @@ void bitforce_init(struct cgpu_info *bitforce) |
|
|
|
s[0] = '\0'; |
|
|
|
s[0] = '\0'; |
|
|
|
bitforce->name = strdup(pdevbuf + 7); |
|
|
|
bitforce->name = strdup(pdevbuf + 7); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bitforce->device_fd = fdDev; |
|
|
|
|
|
|
|
mutex_unlock(&bitforce->device_mutex); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static bool bitforce_get_temp(struct cgpu_info *bitforce) |
|
|
|
static bool bitforce_get_temp(struct cgpu_info *bitforce) |
|
|
@ -187,6 +190,9 @@ static bool bitforce_get_temp(struct cgpu_info *bitforce) |
|
|
|
char pdevbuf[0x100]; |
|
|
|
char pdevbuf[0x100]; |
|
|
|
char *s; |
|
|
|
char *s; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!fdDev) |
|
|
|
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
|
|
mutex_lock(&bitforce->device_mutex); |
|
|
|
mutex_lock(&bitforce->device_mutex); |
|
|
|
BFwrite(fdDev, "ZLX", 3); |
|
|
|
BFwrite(fdDev, "ZLX", 3); |
|
|
|
BFgets(pdevbuf, sizeof(pdevbuf), fdDev); |
|
|
|
BFgets(pdevbuf, sizeof(pdevbuf), fdDev); |
|
|
@ -352,23 +358,25 @@ static uint64_t bitforce_scanhash(struct thr_info *thr, struct work *work, uint6 |
|
|
|
bitforce->wait_ms = 0; |
|
|
|
bitforce->wait_ms = 0; |
|
|
|
uint64_t ret; |
|
|
|
uint64_t ret; |
|
|
|
|
|
|
|
|
|
|
|
if (ret = bitforce_send_work(thr, work)) { |
|
|
|
ret = bitforce_send_work(thr, work); |
|
|
|
if(!opt_submit_stale || !submit_old) { |
|
|
|
|
|
|
|
while (bitforce->wait_ms < bitforce->sleep_ms) { |
|
|
|
if(!opt_submit_stale || !submit_old) { |
|
|
|
usleep(WORK_CHECK_INTERVAL_MS*1000); |
|
|
|
while (bitforce->wait_ms < bitforce->sleep_ms) { |
|
|
|
bitforce->wait_ms += WORK_CHECK_INTERVAL_MS; |
|
|
|
usleep(WORK_CHECK_INTERVAL_MS*1000); |
|
|
|
if (work_restart[thr->id].restart) { |
|
|
|
bitforce->wait_ms += WORK_CHECK_INTERVAL_MS; |
|
|
|
applog(LOG_DEBUG, "BFL%i: Work restart, discarding after %dms", bitforce->device_id, bitforce->wait_ms); |
|
|
|
if (work_restart[thr->id].restart) { |
|
|
|
return 1; //we have discarded all work; equivilent to 0 hashes done.
|
|
|
|
applog(LOG_DEBUG, "BFL%i: Work restart, discarding after %dms", bitforce->device_id, bitforce->wait_ms); |
|
|
|
} |
|
|
|
return 1; //we have discarded all work; equivilent to 0 hashes done.
|
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
|
|
|
|
usleep(bitforce->sleep_ms*1000); |
|
|
|
|
|
|
|
bitforce->wait_ms = bitforce->sleep_ms; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
ret = bitforce_get_result(thr, work); |
|
|
|
} else { |
|
|
|
|
|
|
|
usleep(bitforce->sleep_ms*1000); |
|
|
|
|
|
|
|
bitforce->wait_ms = bitforce->sleep_ms; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (ret) |
|
|
|
|
|
|
|
ret = bitforce_get_result(thr, work); |
|
|
|
|
|
|
|
|
|
|
|
if (!ret) { |
|
|
|
if (!ret) { |
|
|
|
ret = 1; |
|
|
|
ret = 1; |
|
|
|
applog(LOG_ERR, "BFL%i: Comms error", bitforce->device_id); |
|
|
|
applog(LOG_ERR, "BFL%i: Comms error", bitforce->device_id); |
|
|
@ -411,3 +419,4 @@ struct device_api bitforce_api = { |
|
|
|
.thread_shutdown = bitforce_shutdown, |
|
|
|
.thread_shutdown = bitforce_shutdown, |
|
|
|
.thread_enable = biforce_thread_enable |
|
|
|
.thread_enable = biforce_thread_enable |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|