Changes
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
#include "libusb_helpers.h"
|
||||
#include "../libusb/libusb/libusb.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
@@ -22,16 +23,25 @@ void get_test_device(libusb_context *usb_ctx, struct libusb_device_bundle *bundl
|
||||
|
||||
if(usb_desc.idVendor == 0x05AC && usb_desc.idProduct == 0x1227)
|
||||
{
|
||||
libusb_open(usb_device, &usb_handle);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
libusb_free_device_list(usb_device_list, usb_dev_count);
|
||||
bundle->ctx = usb_ctx;
|
||||
bundle->device = usb_device;
|
||||
bundle->handle = usb_handle;
|
||||
bundle->descriptor = usb_desc;
|
||||
}
|
||||
|
||||
void LIBUSB_CALL async_ctrl_transfer_cb(struct libusb_transfer *transfer)
|
||||
{
|
||||
printf("transfer status: %s (%i / %i)\n",
|
||||
libusb_error_name(transfer->status),
|
||||
transfer->actual_length,
|
||||
transfer->length);
|
||||
}
|
||||
|
||||
void libusb1_async_ctrl_transfer(libusb_device_handle *handle,
|
||||
unsigned char bmRequestType, unsigned char bRequest,
|
||||
unsigned short wValue, unsigned short wIndex,
|
||||
@@ -47,7 +57,7 @@ void libusb1_async_ctrl_transfer(libusb_device_handle *handle,
|
||||
struct libusb_transfer *usb_transfer = libusb_alloc_transfer(0);
|
||||
libusb_fill_control_setup(usb_transfer_buf, bmRequestType, bRequest, wValue, wIndex, data_len);
|
||||
memcpy(&usb_transfer_buf[8], data, data_len);
|
||||
libusb_fill_control_transfer(usb_transfer, handle, usb_transfer_buf, NULL, NULL, 1);
|
||||
libusb_fill_control_transfer(usb_transfer, handle, usb_transfer_buf, async_ctrl_transfer_cb, NULL, 1);
|
||||
|
||||
ret = libusb_submit_transfer(usb_transfer);
|
||||
if(ret != 0)
|
||||
@@ -70,6 +80,8 @@ void libusb1_async_ctrl_transfer(libusb_device_handle *handle,
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
printf("%i / %i\n", usb_transfer->actual_length, usb_transfer->length);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,10 +106,7 @@ void libusb1_no_error_ctrl_transfer(libusb_device_handle *handle,
|
||||
}
|
||||
|
||||
ret = libusb_control_transfer(handle, bmRequestType, bRequest, wValue, wIndex, data, data_len, timeout);
|
||||
if(ret > 0)
|
||||
{
|
||||
printf("%s\n", libusb_error_name(ret));
|
||||
}
|
||||
printf("%s\n", libusb_error_name(ret));
|
||||
}
|
||||
|
||||
void stall(libusb_device_handle *handle)
|
||||
|
||||
Reference in New Issue
Block a user