Rename extract_data to extract_iso_data, add extract_data for use by
other transfer types.
This commit is contained in:
19
usb/iso.c
19
usb/iso.c
@@ -64,7 +64,26 @@ void print_xfer(struct libusb_transfer *xfer) {
|
||||
}
|
||||
}
|
||||
|
||||
// extract data from a non-isochronous transfer.
|
||||
int extract_data(struct libusb_transfer *xfer, void *raw, int max, unsigned char *status) {
|
||||
int i;
|
||||
unsigned char *in = xfer->buffer;
|
||||
unsigned char *out = raw;
|
||||
|
||||
int len = xfer->actual_length;
|
||||
if (len > max) {
|
||||
len = max;
|
||||
}
|
||||
memcpy(out, in, len);
|
||||
if (xfer->status != 0 && *status == 0) {
|
||||
*status = xfer->status;
|
||||
}
|
||||
return len;
|
||||
}
|
||||
|
||||
// extract data from an isochronous transfer. Very similar to extract_data, but
|
||||
// acquires data from xfer->iso_packet_desc array instead of xfer attributes.
|
||||
int extract_iso_data(struct libusb_transfer *xfer, void *raw, int max, unsigned char *status) {
|
||||
int i;
|
||||
int copied = 0;
|
||||
unsigned char *in = xfer->buffer;
|
||||
|
Reference in New Issue
Block a user