Commits

Anonymous committed 5bb2e9b

Api call to change libusb debug level.

  • Participants
  • Parent commits 1ad9943

Comments (0)

Files changed (2)

File examples/fx2/cpp/fx2.cpp

 
  int rv=libusb_init(&libusb_ctx);
  assert(!rv);
+ libusb_set_debug(libusb_ctx,0);
+}
 
+void fx2::set_debug_level(int n) {
+ libusb_set_debug(libusb_ctx,n);
 }
 
 fx2::~fx2() {
  int transferred;
  int rv=libusb_bulk_transfer ( dev_handle, ep, (unsigned char*)buf, size, &transferred, timeout );
 
- if (!rv) 
- {
-  printf ( "Transfer Succeeded. (Bytes: %d)\n", transferred );
-  return true;
- }
+ if (!rv) return true; 
 
  if (rv==LIBUSB_ERROR_TIMEOUT) {
     printf ( "Transfer Timeout.  %d bytes transferred.\n", transferred );

File examples/fx2/cpp/fx2.h

         void set_interface(int interface, int alt_setting);
         bool isopen() { return dev_handle != NULL; }
         void close();
+        /**
+         * level n = 0-3
+         */
+        void set_debug_level(int n);
         int do_usb_command(char* buf, int size, unsigned char type, unsigned char request, unsigned short value, unsigned short index, unsigned short length );
         int clear_halt(char ep);
         int reset();