|
|
@ -79,14 +79,18 @@ static void BFgets(char *buf, size_t bufLen, int fd) |
|
|
|
buf[0] = '\0'; |
|
|
|
buf[0] = '\0'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static void BFwrite(int fd, const void *buf, ssize_t bufLen) |
|
|
|
static ssize_t BFwrite2(int fd, const void *buf, ssize_t bufLen) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ssize_t ret = write(fd, buf, bufLen); |
|
|
|
return write(fd, buf, bufLen); |
|
|
|
|
|
|
|
|
|
|
|
if (unlikely(ret != bufLen)) |
|
|
|
|
|
|
|
quit(1, "BFwrite failed"); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define BFwrite(fd, buf, bufLen) do { \ |
|
|
|
|
|
|
|
if ((bufLen) != BFwrite2(fd, buf, bufLen)) { \ |
|
|
|
|
|
|
|
applog(LOG_ERR, "Error writing to BitForce (" #buf ")"); \ |
|
|
|
|
|
|
|
return 0; \ |
|
|
|
|
|
|
|
} \ |
|
|
|
|
|
|
|
} while(0) |
|
|
|
|
|
|
|
|
|
|
|
#define BFclose(fd) close(fd) |
|
|
|
#define BFclose(fd) close(fd) |
|
|
|
|
|
|
|
|
|
|
|
static bool bitforce_detect_one(const char *devpath) |
|
|
|
static bool bitforce_detect_one(const char *devpath) |
|
|
|