unsigned char rxbuff[USBTMC_IN_TRANSFERSIZE];
struct usbtmc_header *res;
int bytes_read;
- unsigned int transfer_size = USBTMC_IN_TRANSFERSIZE;
+ unsigned int read_size = USBTMC_IN_TRANSFERSIZE;
unsigned int headerlen;
req = calloc(1, sizeof(struct usbtmc_header));
}
if (sc->usb.brokenRigol == 1) {
- transfer_size = sc->usb.wMaxPacketSize_in;
+ read_size = sc->usb.wMaxPacketSize_in;
}
bytes_read = 0;
req->MsgID = USBTMC_REQUEST_DEV_DEP_MSG_IN;
req->bTag = sc->usb.bTag;
req->bTagInverse = ~sc->usb.bTag;
- req->TransferSize = LE32(transfer_size);
+ req->TransferSize = LE32(USBTMC_IN_TRANSFERSIZE);
req->bmTransferAttributes = 0;
req->TermChar = 0;
}
r=usb_bulk_read(sc->usb.dev, sc->usb.ep_bulk_in,
- (char*)rxbuff, transfer_size, USB_TIMEOUT);
+ (char*)rxbuff, read_size, USB_TIMEOUT);
USB_ERROR("USBTMC_DEV_DEP_MSG_IN", r);
if (r < headerlen) {
return 0;
}
-
if (headerlen > 0) {
res = (struct usbtmc_header*)rxbuff;
}
}
- if ((sc->usb.brokenRigol == 0) || (transfer_size == USBTMC_IN_TRANSFERSIZE) ||
- ((r - sizeof(struct usbtmc_header) >= len))) {
+ if ((r - headerlen) > 0) {
memcpy(buff + bytes_read, rxbuff + headerlen, r - headerlen);
bytes_read += r - headerlen;
}
- transfer_size = USBTMC_IN_TRANSFERSIZE;
+ read_size = USBTMC_IN_TRANSFERSIZE;
} while(bytes_read < len);
free(req);