/** Tests that the default context (used for various things including * logging) works correctly when the first context created in a * process is destroyed. */ static libusb_testlib_result test_default_context_change(libusb_testlib_ctx * tctx) { libusb_context * ctx = NULL; int r, i; for (i = 0; i < 100; ++i) { /* First create a new context */ r = libusb_init(&ctx); if (r != LIBUSB_SUCCESS) { libusb_testlib_logf(tctx, "Failed to init libusb: %d", r); return TEST_STATUS_FAILURE; } /* Enable debug output, to be sure to use the context */ libusb_set_debug(NULL, LIBUSB_LOG_LEVEL_DEBUG); libusb_set_debug(ctx, LIBUSB_LOG_LEVEL_DEBUG); /* Now create a reference to the default context */ r = libusb_init(NULL); if (r != LIBUSB_SUCCESS) { libusb_testlib_logf(tctx, "Failed to init libusb: %d", r); return TEST_STATUS_FAILURE; } /* Destroy the first context */ libusb_exit(ctx); /* Destroy the default context */ libusb_exit(NULL); } return TEST_STATUS_SUCCESS; }
void LibUsbDevice::initializeDevice() { int status; status = libusb_init(&context); //initialize the library for the session we just declared if(status != 0) { cstatus = tr("Initialization Error!"); qDebug()<<"Initialization Error! "<<status<<endl; //there was an error isInitialiazed = false; return; } isInitialiazed = true; if(libusb_has_capability (LIBUSB_CAP_HAS_HOTPLUG)&&0) { hasHotPlugSupport = true; //status = libusb_hotplug_register_callback (context, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED, LIBUSB_HOTPLUG_ENUMERATE , VENDOR_ID, // PRODUCT_ID, CLASS_ID, hotplugAttachCallback, this, &hotplugHandle[0]); if (LIBUSB_SUCCESS != status) { hasHotPlugSupport = false; } //status = libusb_hotplug_register_callback (context, LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT, LIBUSB_HOTPLUG_ENUMERATE , VENDOR_ID, // PRODUCT_ID, CLASS_ID, hotplugDetachCallback, this, &hotplugHandle[1]); if (LIBUSB_SUCCESS != status) { hasHotPlugSupport = false; } future = QtConcurrent::run (this,&LibUsbDevice::eventThread); } libusb_set_debug(context, LIBUSB_LOG_LEVEL_INFO); //set verbosity level to 3 }
void usbhost_init_libusb(void) { number_ports_used = 0; if (libusb_init(NULL)) { D(bug("USBHost: Imposible to start libusb")); return; } libusb_set_debug(NULL, 3); for (int i = 0; i <= MAX_NUMBER_VIRT_DEV; i++) { virtual_device[i].connected = false; virtual_device[i].virtdev_available = false; } for (int i = 0; i < NUMBER_OF_PORTS; i++) { roothub.port[i].device_index = 0; } SDL_CreateNamedThread(trigger_interrupt, "USB", NULL); usbhost_get_device_list(); init_flag = true; }
int IntersonManagerTest::TestSyncBulk_FrameByFrame_CheckFrameNumbers() { // Testing Receiving Data : B-Mode, Synchronous Bulk uInt8 motorSpeed10[] = {0xB9, 0x04, 0x00, 0x00, 0xB7, 0xA4, 0x32}; // 10.0 fps uInt8 motorSpeed15[] = {0x7A, 0x0D, 0x00, 0x00, 0x80, 0xA4, 0x32}; // 15.0 fps this->m_IntMng->initializeMotorSpeed(motorSpeed15); libusb_set_debug(NULL, LIBUSB_LOG_LEVEL_NONE); std::cout<<std::dec; this->m_IntMng->startAcquisitionRoutine(0); int r; for (int i = 0; i < 30; ++i) // 30 frames { int transferSize = 241 * 1024; unsigned char endpoint = 0x82; unsigned char *buffer = new unsigned char[transferSize]; int transferred = 1; unsigned int BULK_TRANSFER_TIMEOUT = 1000; libusb_device_handle *handle = this->m_IntMng->getHandle(); r = libusb_bulk_transfer(handle, endpoint, buffer, transferSize, &transferred, BULK_TRANSFER_TIMEOUT); std::cout << "Frame numbers:" << std::hex << std::endl; for (int k = 0; k < 241 * 1024; k += 1024) { std::cout << +buffer[k] << " "; } std::cout << std::dec << std::endl; } this->m_IntMng->stopAcquisitionRoutine(); return 0; }
void IdacDriverManager::initLibusb() { libusb_init(NULL); #ifndef QT_NO_DEBUG libusb_set_debug(NULL, 3); #endif }
static int scan_usb(libusb_context *ctx, libusb_device_handle **dev_handle) { libusb_device **devs; const int ret = libusb_init(&ctx); if (ret < 0) { fprintf(stderr, "%s\n", libusb_strerror(ret)); return -1; } libusb_set_debug(ctx, _debug > 3 ? 3 : _debug); const ssize_t cnt = libusb_get_device_list(ctx, &devs); if (cnt == 0) { fprintf(stderr, "Could not get device list: %s\n", libusb_strerror(ret)); return -1; } *dev_handle = libusb_open_device_with_vid_pid(ctx, OWL_VENDOR_ID, CM160_DEV_ID); libusb_free_device_list(devs, 1); if (!*dev_handle) { fprintf(stderr, "Could not find an OWL CM160 plugged.\n"); return -1; } return 0; }
int InitDevice(AlienFxType_t *all, AlienFxHandle_t *fxh) { int succp = 0; if(0 == libusb_init( & fxh->usb_context)) { libusb_set_debug(fxh->usb_context, 3); int i; for(i = 0 ; (i < AlienFxTypesCount) && ! succp ; ++i) { AlienFxType_t *fxtype = &all[i]; if(verbose) printf("scanning for AlienFX type \"%s\"... ", fxtype->name); if(fxh->usb_handle = libusb_open_device_with_vid_pid(fxh->usb_context, fxtype->idVendor, fxtype->idProduct)) { fxh->info = fxtype; if(verbose) printf("found \"%s\".\n", fxh->info->name); succp = 1; } else if(verbose) puts("no."); } if(fxh->usb_handle) { Detach(fxh->usb_handle); if(0 > libusb_claim_interface(fxh->usb_handle, 0)) { perror("libusb_claim_interface"); fxh->usb_handle = 0; } } } else perror("libusb_init"); return succp; }
dfu_error DFU::init() { int error = libusb_init(&ctx); //initialize a library session if (error < 0) { return (dfu_error)(-99); } libusb_set_debug(ctx, 3); dev_handle = libusb_open_device_with_vid_pid(ctx, vid, pid); if (dev_handle == NULL) { return dfu_error::USB_NO_DEVICE; } if (libusb_kernel_driver_active(dev_handle, 0)) { libusb_detach_kernel_driver(dev_handle, 0); } error = libusb_claim_interface(dev_handle, 0); if (error < 0) { return dfu_error::USB_ACCESS; } //attempt to get dfu functional descriptor, does not work on atmel devices. /* unsigned char data[9]; error = libusb_get_descriptor(dev_handle, 0x21, 0, data, 7); */ return dfu_error::USB_OK; }
int InitUSB() { libusb_init(&context); libusb_set_debug(context, 3); return 0; }
int main() { printf("msp430_serial starting...\n"); printf("libusb initing...\n"); // initialize USB context, and get a device handle. HANDLE h = init_dev(1, 0, 0xf432); if (h == NULL) { fprintf(stderr, "Handle is NULL, initialization failed.\n"); return(1); } // enable debugging #ifdef DEBUG libusb_set_debug(mspContext, 3); #endif // get endpoints MSP_get_endpoints(h, &ep_int_in, &ep_bulk_in, &ep_bulk_out); // Send magic setup control transfers... MSP_setup(h); get_descriptor(h); // TI driver does this 26 times... not sure why // read status do_control_transfer(h,0xa1,0x21); // write back to device do_send_std(h,0x21,0x20,true); while (1) { do_bulk_transfer(h); libusb_handle_events(mspContext); } printf("Exiting.\n"); MSP_uninitialize(h); return(0); }
/** * g_usb_context_set_debug: * @context: a #GUsbContext * @flags: a GLogLevelFlags such as %G_LOG_LEVEL_ERROR | %G_LOG_LEVEL_INFO, or 0 * * Sets the debug flags which control what is logged to the console. * * Using %G_LOG_LEVEL_INFO will output to standard out, and everything * else logs to standard error. * * Since: 0.1.0 **/ void g_usb_context_set_debug (GUsbContext *context, GLogLevelFlags flags) { GUsbContextPrivate *priv; int debug_level; g_return_if_fail (G_USB_IS_CONTEXT (context)); priv = context->priv; if (flags & (G_LOG_LEVEL_DEBUG | G_LOG_LEVEL_INFO)) debug_level = 3; else if (flags & (G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_WARNING)) debug_level = 2; else if (flags & (G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR)) debug_level = 1; else debug_level = 0; if (debug_level != priv->debug_level) { priv->debug_level = debug_level; libusb_set_debug (priv->ctx, debug_level); g_object_notify_by_pspec (G_OBJECT (context), pspecs[PROP_DEBUG_LEVEL]); } }
//http://www.dreamincode.net/forums/topic/148707-introduction-to-using-libusb-10/ int list_all_usb_devices() { libusb_device **devs; //pointer to pointer of device, used to retrieve a list of devices libusb_context *ctx = NULL; //a libusb session int r; //for return values ssize_t cnt; //holding number of devices in list r = libusb_init(&ctx); //initialize a library session if(r < 0) { std::cout<<"Init Error "<<r<<std::endl; //there was an error return 1; } libusb_set_debug(ctx, 3); //set verbosity level to 3, as suggested in the documentation cnt = libusb_get_device_list(ctx, &devs); //get the list of devices if(cnt < 0) std::cout<<"Get Device Error"<<std::endl; //there was an error std::cout<<cnt<<" Devices in list."<<std::endl; //print total number of usb devices ssize_t i; //for iterating through the list for(i = 0; i < cnt; i++) printdev(devs[i]); //print specs of this device libusb_free_device_list(devs, 1); //free the list, unref the devices in it libusb_exit(ctx); //close the session return 0; }
/* Getting device handle */ int init () { libusb_init(NULL); libusb_set_debug(NULL, 3); // Wireless mode handle = libusb_open_device_with_vid_pid(NULL, DEV_VID, DEV_PID_Wireless); if (handle == NULL) { // Wired mode handle = libusb_open_device_with_vid_pid(NULL, DEV_VID, DEV_PID_Wired); if (handle == NULL) { printf("[Error] Naga Epic not found!\n"); libusb_exit(NULL); return 1; } else { printf("[Info] Naga Epic is connected\n"); } } else { printf("[Info] Naga Epic Dock is connected\n"); } // Detaching mouse from kernel if (libusb_kernel_driver_active(handle,DEV_INTF)) libusb_detach_kernel_driver(handle, DEV_INTF); if (libusb_claim_interface(handle, DEV_INTF) < 0) { printf("[Error] IO exception\n"); libusb_close(handle); libusb_exit(NULL); return 1; } return 0; }
bool FalconCommLibUSB::initLibUSB() { if((m_deviceErrorCode = libusb_init(&m_usbContext)) < 0) { std::cout << "failed to initialise libusb" << std::endl; return false; } #if defined(LIBUSB_DEBUG) //Spam libusb messages //Between 0-3 for libusb 1.0 libusb_set_debug(m_usbContext, 3); #else libusb_set_debug(m_usbContext, 0); #endif }
void RX2164::init(map<channelId, map<actionId, RxActionData>> v_channel_action, std::function<void(int, int, int, int, u_char, u_char, u_char, u_char)> &callback, int debug_lvl) { _channel_actions = v_channel_action; _callback_func = callback; ASSERT_WITH_CODE(debug_lvl, return); libusb_set_debug(usb_ctx, debug_lvl); }
int main (int argc, char *argv[]) { int err; struct libusb_device_handle* handle; if ((err = libusb_init (&ctx)) != 0) { printf ("libusb_init failed with code %d\n", err); return 1; } libusb_set_debug (ctx, 3); handle = libusb_open_device_with_vid_pid (ctx, GTP_VENDOR, GTP_PRODUCT); if (!handle) printf ("LCD-USB device not found\n"); else { libusb_claim_interface (handle, 0); printf ("LCD-USB device found, version = %s\n", lcd_get_version (handle)); } libusb_close (handle); libusb_exit (ctx); return 0; }
int Context::setDebug(State & state, Context_wrapper * wrapper){ Stack * stack = state.stack; if (stack->is<LUA_TNUMBER>(1)){ libusb_set_debug(wrapper->context, stack->to<int>(1)); } return 0; }
int jtag_libusb_open(const uint16_t vids[], const uint16_t pids[], struct jtag_libusb_device_handle **out) { int cnt, idx, errCode; if (libusb_init(&jtag_libusb_context) < 0) return -ENODEV; libusb_set_debug(jtag_libusb_context, 3); cnt = libusb_get_device_list(jtag_libusb_context, &devs); for (idx = 0; idx < cnt; idx++) { if (!jtag_libusb_match(devs[idx], vids, pids)) continue; errCode = libusb_open(devs[idx], out); /** Free the device list **/ libusb_free_device_list(devs, 1); if (errCode < 0) return errCode; return 0; } return -ENODEV; }
int main(int argc, char **argv) { //Pass Interrupt Signal to our handler signal(SIGINT, sighandler); libusb_init(&ctx); libusb_set_debug(ctx, 3); //Open Device with VendorID and ProductID handle = libusb_open_device_with_vid_pid(ctx, USB_VENDOR_ID, USB_PRODUCT_ID); if (!handle) { perror("device not found"); return 1; } int r = 1; //Claim Interface 0 from the device r = libusb_claim_interface(handle, 0); if (r < 0) { fprintf(stderr, "usb_claim_interface error %d\n", r); return 2; } printf("Interface claimed\n"); while (1){ usb_read(); // usb_write(); } //never reached libusb_close(handle); libusb_exit(NULL); return 0; }
int FTDIDevice_Open(FTDIDevice *dev) { int err; memset(dev, 0, sizeof *dev); if ((err = libusb_init(&dev->libusb))) { return err; } libusb_set_debug(dev->libusb, 2); dev->handle = libusb_open_device_with_vid_pid(dev->libusb, OV_VENDOR, OV_PRODUCT); if (!dev->handle) { dev->handle = libusb_open_device_with_vid_pid(dev->libusb, FTDI_VENDOR, FTDI_PRODUCT_FT2232H); } if (!dev->handle) { return LIBUSB_ERROR_NO_DEVICE; } return DeviceInit(dev); }
int main(int argc, char *argv[]) { int err; libusb_init(NULL); libusb_set_debug(NULL, 3); /* Try to open directly accessory. If it's not there, try to switch phone to it */ handle = libusb_open_device_with_vid_pid(NULL, ACCESSORY_VID, ACCESSORY_PID_DBG); //if(handle) //libusb_reset_device(handle); if(handle == NULL){ printf("Device not in Accessory mode. Trying to switch it to it...\n"); err = setupAccessory("STMicroelectronics", "adkping", "Just pings data", "2.0", "http://www.st.com", "1234567890123456"); if(err < 0){ fprintf(stdout, "Sorry, can't set up accessory, giving up\n"); deInit(); return -1; } } /* Do some stuff */ if(mainPhase() < 0){ fprintf(stdout, "Error during main phase\n"); deInit(); return -1; } deInit(); fprintf(stdout, "Done, no errors\n"); return 0; }
void USBThread::ConnectToUSBDevice() { printf("Connect to the USB device -> THREAD: %d\n",QThread::currentThreadId()); //initilize usb libusb_init(&sensor_cxt); libusb_set_debug(sensor_cxt, 1); bool usbSetUp = false; while (!usbSetUp) { usbSetUp = true; printf("going to try and get handle for USB\n"); handle = libusb_open_device_with_vid_pid(sensor_cxt,MY_VID,MY_PID); if (handle == 0) { printf("failed to get handle\n"); usbSetUp = false; ((GenericExecThread*)(this->thread()))->forceSleep(1); continue; } printf("got handle!\n"); //printf("Reseting device\n"); //libusb_reset_device(handle); //printf("Device Reset\n"); int usbConfig; libusb_get_configuration(handle, &usbConfig); if (usbConfig == 0) { printf("Setting Configuration\n"); if (!libusb_set_configuration(handle, 1)) { printf("Failed to set configuration\n"); libusb_close(handle); FailedToConnect(); usbSetUp = false; ((GenericExecThread*)(this->thread()))->forceSleep(10); continue; } printf("Set Configuration\n"); } printf("Claiming Interface\n"); int claimResults = libusb_claim_interface(handle, 0); if (claimResults != 0) { printf("Failed to claim Interface\n"); libusb_close(handle); usbSetUp = false; FailedToConnect(); if (LIBUSB_ERROR_NOT_FOUND == claimResults) printf("Requested Interface does not exist.\n"); else if (LIBUSB_ERROR_BUSY == claimResults) printf("Another program or driver has claimed the interface.\n"); else if (LIBUSB_ERROR_NO_DEVICE == claimResults) printf("The device has been disconnected .\n"); ((GenericExecThread*)(this->thread()))->forceSleep(10); continue; } printf("Claimed Interface\n"); } // done connecting and configuring, should be able to // send bulk packets now }
int main(void) { int i, ret, transferred; struct libusb_device_handle *dev = NULL; unsigned char readback[BUF_LEN]; ret = libusb_init(NULL); if (ret < 0) { fprintf(stderr, "libusb_init failed (got 1.0?)\n"); return 1; } libusb_set_debug(NULL, 3); printf("Daisho USB controller verification\n\n"); dev = open_daisho_device(); if (dev == NULL) { printf("Failed to find Daisho device\n"); return -1; } printf("got device\n"); ret = libusb_set_configuration(dev, 1); if (ret < 0) { printf("* Can't set config: %s\n", libusb_error_name(ret)); libusb_close(dev); return -1; } else { printf("* Set configuration \n"); } ret = libusb_claim_interface(dev, 0); if (ret < 0) { printf("* Can't claim interface: %s\n", libusb_error_name(ret)); libusb_close(dev); return -1; } else { printf("* Claimed interface\n"); } while(1) { ret = libusb_bulk_transfer(dev, 0x81, readback, BUF_LEN, &transferred, 0); if (ret < 0){ printf("* Couldn't read: %s\n", libusb_error_name(ret)); break; /* Ignore case where we have an incomplete state */ } else if (transferred > 0) { for(i=0;i<transferred;i++) printf("%02x ", readback[i]); printf("\n"); } fflush(NULL); } libusb_release_interface(dev, 0); if(dev) libusb_close(dev); printf("\n* Finished\n"); return 0; }
/** \ingroup core * Set message verbosity. * - Level 0: no messages ever printed by the library (default) * - Level 1: error messages are printed to stderr * - Level 2: warning and error messages are printed to stderr * - Level 3: informational messages are printed to stdout, warning and error * messages are printed to stderr * * The default level is 0, which means no messages are ever printed. If you * choose to increase the message verbosity level, ensure that your * application does not close the stdout/stderr file descriptors. * * You are advised to set level 3. libfprint is conservative with its message * logging and most of the time, will only log messages that explain error * conditions and other oddities. This will help you debug your software. * * If the LIBFPRINT_DEBUG environment variable was set when libfprint was * initialized, this function does nothing: the message verbosity is fixed * to the value in the environment variable. * * If libfprint was compiled without any message logging, this function does * nothing: you'll never get any messages. * * If libfprint was compiled with verbose debug message logging, this function * does nothing: you'll always get messages from all levels. * * \param ctx the context to operate on, or NULL for the default context * \param level debug level to set */ API_EXPORTED void fp_set_debug(int level) { if (log_level_fixed) return; log_level = level; libusb_set_debug(fpi_usb_ctx, level); }
API_EXPORTED void usb_set_debug(int level) { usb_debug = level; /* usb_set_debug can be called before usb_init */ if (ctx) libusb_set_debug(ctx, 3); }
void irecv_set_debug_level(int level) { libirecovery_debug = level; #ifndef WIN32 if(libirecovery_context) { libusb_set_debug(libirecovery_context, libirecovery_debug); } #endif }
//============================================================================== void USB_Device::set_debug_mode(DebugLevel level) { #if defined(LIBUSB_API_VERSION) && (LIBUSB_API_VERSION >= 0x01000106) libusb_set_option(context_.get(), LIBUSB_OPTION_LOG_LEVEL, level); #else libusb_set_debug(context_.get(), level); #endif }
int ptouch_open(ptouch_dev *ptdev) { libusb_device **devs; libusb_device *dev; libusb_device_handle *handle = NULL; struct libusb_device_descriptor desc; ssize_t cnt; int r,i=0; if ((*ptdev=malloc(sizeof(struct _ptouch_dev))) == NULL) { fprintf(stderr, _("out of memory\n")); return -1; } if ((libusb_init(NULL)) < 0) { fprintf(stderr, _("libusb_init() failed\n")); return -1; } #ifdef DEBUG libusb_set_debug(NULL, 3); #endif /* DEBUG */ if ((cnt=libusb_get_device_list(NULL, &devs)) < 0) { return -1; } while ((dev=devs[i++]) != NULL) { if ((r=libusb_get_device_descriptor(dev, &desc)) < 0) { fprintf(stderr, _("failed to get device descriptor")); libusb_free_device_list(devs, 1); return -1; } for (int k=0; ptdevs[k].vid > 0; k++) { if ((desc.idVendor == ptdevs[k].vid) && (desc.idProduct == ptdevs[k].pid) && (ptdevs[k].flags >= 0)) { fprintf(stderr, _("%s found on USB bus %d, device %d\n"), ptdevs[k].name, libusb_get_bus_number(dev), libusb_get_device_address(dev)); if ((r=libusb_open(dev, &handle)) != 0) { fprintf(stderr, _("libusb_open error :%s\n"), libusb_error_name(r)); return -1; } libusb_free_device_list(devs, 1); if ((r=libusb_kernel_driver_active(handle, 0)) == 1) { if ((r=libusb_detach_kernel_driver(handle, 0)) != 0) { fprintf(stderr, _("error while detaching kernel driver: %s\n"), libusb_error_name(r)); } } if ((r=libusb_claim_interface(handle, 0)) != 0) { fprintf(stderr, _("interface claim error: %s\n"), libusb_error_name(r)); return -1; } (*ptdev)->h=handle; return 0; } } } fprintf(stderr, _("No P-Touch printer found on USB (remember to put switch to position E)\n")); libusb_free_device_list(devs, 1); return -1; }
bool AsyncPluginImpl::Start() { if (libusb_init(&m_context)) { OLA_WARN << "Failed to init libusb"; return false; } OLA_DEBUG << "libusb debug level set to " << m_debug_level; libusb_set_debug(m_context, m_debug_level); m_use_hotplug = HotplugSupported(); OLA_INFO << "HotplugSupported returned " << m_use_hotplug; if (m_use_hotplug) { #ifdef HAVE_LIBUSB_HOTPLUG_API m_usb_thread.reset(new LibUsbHotplugThread( m_context, hotplug_callback, this)); #else OLA_FATAL << "Mismatch between m_use_hotplug and " " HAVE_LIBUSB_HOTPLUG_API"; return false; #endif } else { m_usb_thread.reset(new LibUsbSimpleThread(m_context)); } m_usb_adaptor.reset(new AsyncronousLibUsbAdaptor(m_usb_thread.get())); // Setup the factories. m_widget_factories.push_back(new AnymauDMXFactory(m_usb_adaptor.get())); m_widget_factories.push_back( new EuroliteProFactory(m_usb_adaptor.get())); m_widget_factories.push_back( new JaRuleFactory(m_plugin_adaptor, m_usb_adaptor.get())); m_widget_factories.push_back( new ScanlimeFadecandyFactory(m_usb_adaptor.get())); m_widget_factories.push_back(new SunliteFactory(m_usb_adaptor.get())); m_widget_factories.push_back(new VellemanK8062Factory(m_usb_adaptor.get())); // If we're using hotplug, this starts the hotplug thread. if (!m_usb_thread->Init()) { STLDeleteElements(&m_widget_factories); m_usb_adaptor.reset(); m_usb_thread.reset(); return false; } if (!m_use_hotplug) { // Either we don't support hotplug or the setup failed. // As poor man's hotplug, we call libusb_get_device_list periodically to // check for new devices. m_scan_timeout = m_plugin_adaptor->RegisterRepeatingTimeout( TimeInterval(5, 0), NewCallback(this, &AsyncPluginImpl::ScanUSBDevices)); // Call it immediately now. ScanUSBDevices(); } return true; }
bool FalconCommLibUSB::initLibUSB() { LOG_INFO("Initializing communications"); if((m_deviceErrorCode = libusb_init(&m_usbContext)) < 0) { LOG_ERROR("Failed to initialize"); return false; } #if defined(LIBUSB_DEBUG) //Spam libusb messages //Between 0-3 for libusb 1.0 LOG_INFO("Setting libusb debug level to 3"); libusb_set_debug(m_usbContext, 3); #else LOG_INFO("Setting libusb debug level to 0"); libusb_set_debug(m_usbContext, 0); #endif }