I am using libusb to interact with pen drive. We have to use the function
int libusb_bulk_transfer(struct libusb_device_handle * dev_handle, unsigned char endpoint,
unsigned char * data,int length,int * transferred,unsigned int timeout)
But here we specify only the end point
So my question is that Is it actually possible to read write files(text or images) to pen drive. Or is it just for understanding?
Please help!
Code::
r = libusb_bulk_transfer(dev_handle, (2 | LIBUSB_ENDPOINT_OUT), data, 4, &actual, 0);
//my device's out endpoint was 2, found with trial- the device had 2 endpoints: 2 and 129
if(r == 0 && actual == 4) //we wrote the 4 bytes successfully
cout<<"Writing Successful!"<<endl;
else
cout<<"Write Error"<<endl;