BFL allow a 2nd init attempt if the 1st reply is unknown
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
diff --git a/driver-bitforce.c b/driver-bitforce.c
index fbc9872..f97bcda 100644
--- a/driver-bitforce.c
+++ b/driver-bitforce.c
@@ -167,6 +167,7 @@ static bool bitforce_detect_one(struct libusb_device *dev, struct usb_find_devic
char *s;
struct timeval init_start, init_now;
int init_sleep, init_count;
+ bool ident_first;
struct cgpu_info *bitforce = NULL;
bitforce = calloc(1, sizeof(*bitforce));
@@ -187,13 +188,14 @@ static bool bitforce_detect_one(struct libusb_device *dev, struct usb_find_devic
(int)(bitforce->usbdev->device_address));
+ // Allow 2 complete attempts if the 1st time returns an unrecognised reply
+ ident_first = true;
+retry:
init_count = 0;
init_sleep = REINIT_TIME_FIRST_MS;
gettimeofday(&init_start, NULL);
reinit:
-
bitforce_initialise(bitforce, false);
-
if ((err = usb_write(bitforce, BITFORCE_IDENTIFY, BITFORCE_IDENTIFY_LEN, &amount, C_REQUESTIDENTIFY)) < 0 || amount != BITFORCE_IDENTIFY_LEN) {
applog(LOG_ERR, "%s detect (%s) send identify request failed (%d:%d)",
bitforce->drv->dname, devpath, amount, err);
@@ -231,7 +233,13 @@ reinit:
buf[amount] = '\0';
if (unlikely(!strstr(buf, "SHA256"))) {
- applog(LOG_ERR, "%s detect (%s) didn't recognise '%s'",
+ if (ident_first) {
+ applog(LOG_WARNING, "%s detect (%s) didn't recognise '%s' trying again ...",
+ bitforce->drv->dname, devpath, buf);
+ ident_first = false;
+ goto retry;
+ }
+ applog(LOG_ERR, "%s detect (%s) didn't recognise '%s' on 2nd attempt",
bitforce->drv->dname, devpath, buf);
goto unshin;
}