Merge branch 'rawread_benchmark'
This commit is contained in:
@@ -87,7 +87,7 @@ func (dt DescriptorType) String() string {
|
||||
type EndpointDirection uint8
|
||||
|
||||
const (
|
||||
ENDPOINT_NUM_MASK = 0x03
|
||||
ENDPOINT_NUM_MASK = 0x0f
|
||||
ENDPOINT_DIR_IN EndpointDirection = C.LIBUSB_ENDPOINT_IN
|
||||
ENDPOINT_DIR_OUT EndpointDirection = C.LIBUSB_ENDPOINT_OUT
|
||||
ENDPOINT_DIR_MASK EndpointDirection = 0x80
|
||||
|
||||
10
usb/iso.c
10
usb/iso.c
@@ -74,8 +74,8 @@ int extract_data(struct libusb_transfer *xfer, void *raw, int max, unsigned char
|
||||
|
||||
// Copy the data
|
||||
int len = pkt.actual_length;
|
||||
if (len > max) {
|
||||
len = max;
|
||||
if (copied + len > max) {
|
||||
len = max - copied;
|
||||
}
|
||||
memcpy(out, in, len);
|
||||
copied += len;
|
||||
@@ -84,10 +84,14 @@ int extract_data(struct libusb_transfer *xfer, void *raw, int max, unsigned char
|
||||
in += pkt.length;
|
||||
out += len;
|
||||
|
||||
if (copied == max) {
|
||||
break;
|
||||
}
|
||||
|
||||
// Extract first error
|
||||
if (pkt.status == 0 || *status != 0) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
*status = pkt.status;
|
||||
}
|
||||
return copied;
|
||||
|
||||
Reference in New Issue
Block a user