Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. #include <libusb.h>
  2. #include <assert.h>
  3. #include <stdio.h>
  4. #include <string.h>
  5.  
  6. int main()
  7. {
  8. libusb_init(NULL);
  9. libusb_device_handle *handle;
  10. assert(handle = libusb_open_device_with_vid_pid(NULL, 0x0483, 0x5740));
  11. assert(libusb_claim_interface(handle, 0));
  12.  
  13. char request[] = "Test", response[8];
  14. memset(response, 0, sizeof(response));
  15. int transferred;
  16.  
  17. libusb_bulk_transfer(handle, 0x01, request, sizeof(request), &transferred, 0);
  18. libusb_bulk_transfer(handle, 0x82, response, sizeof(response), &transferred, 0);
  19.  
  20. printf("Response=%s\n", response);
  21.  
  22. libusb_close(handle);
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement