Ejemplo n.º 1
0
int bulk_read(int endpoint, unsigned char *buf, int length) {
	int ret, n;
	if ((ret = libusb_bulk_transfer(device_handle, LIBUSB_ENDPOINT_IN
			| endpoint, buf, length, &n, TIMEOUT)) < 0)
		bulk_transfer_error(ret);
	return n;
}
Ejemplo n.º 2
0
int bulk_write(int endpoint, unsigned char *buf, int length) {
    int ret, n;
    if((ret = libusb_bulk_transfer(device_handle,
                    LIBUSB_ENDPOINT_OUT | endpoint,
                    buf, length, &n, TIMEOUT)) < 0)
        bulk_transfer_error(ret);
    if(n) fprintf(stderr, "Sent %d bytes\n", n);
    return n;
}