mirror of
https://github.com/GOSTSec/sgminer
synced 2025-09-09 12:42:05 +00:00
Iterate over spare bytes in the avalon result returned from a reset request trying to find the beginning of the reset.
This commit is contained in:
parent
467d149785
commit
1f493d6462
@ -269,8 +269,8 @@ static int avalon_reset(struct cgpu_info *avalon, int fd)
|
|||||||
{
|
{
|
||||||
struct avalon_result ar;
|
struct avalon_result ar;
|
||||||
struct avalon_task at;
|
struct avalon_task at;
|
||||||
uint8_t *buf;
|
uint8_t *buf, *tmp;
|
||||||
int ret, i = 0;
|
int ret, i, spare;
|
||||||
struct timespec p;
|
struct timespec p;
|
||||||
|
|
||||||
/* Send reset, then check for result */
|
/* Send reset, then check for result */
|
||||||
@ -294,12 +294,17 @@ static int avalon_reset(struct cgpu_info *avalon, int fd)
|
|||||||
p.tv_nsec = AVALON_RESET_PITCH;
|
p.tv_nsec = AVALON_RESET_PITCH;
|
||||||
nanosleep(&p, NULL);
|
nanosleep(&p, NULL);
|
||||||
|
|
||||||
buf = (uint8_t *)&ar;
|
/* Look for the first occurrence of 0xAA, the reset response should be:
|
||||||
/* We may also get 0x00 and 0x18 first */
|
* AA 55 AA 55 00 00 00 00 00 00 */
|
||||||
if (buf[0] != 0xAA)
|
spare = AVALON_READ_SIZE - 10;
|
||||||
buf = &buf[1];
|
tmp = (uint8_t *)&ar;
|
||||||
if (buf[0] != 0xAA)
|
for (i = 0; i <= spare; i++) {
|
||||||
buf = &buf[1];
|
buf = &tmp[i];
|
||||||
|
if (buf[0] == 0xAA)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
i = 0;
|
||||||
|
|
||||||
if (buf[0] == 0xAA && buf[1] == 0x55 &&
|
if (buf[0] == 0xAA && buf[1] == 0x55 &&
|
||||||
buf[2] == 0xAA && buf[3] == 0x55) {
|
buf[2] == 0xAA && buf[3] == 0x55) {
|
||||||
for (i = 4; i < 11; i++)
|
for (i = 4; i < 11; i++)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user