On May 24, 2013, at 3:03 PM, Sean McBride <s...@rogue-research.com> wrote:

> On Fri, 24 May 2013 11:22:13 -0600, Nathan Hjelm said:
> 
>>> Is this hotplug API opt-in?  libusbx won't start observing the comings
>> and goings of all USB devices by default I hope?
>> 
>> The hotplug API is opt-in but the internal event handlers are not. Here
>> is a short summary of the changes within libusbx:
>> - Devices are enumerated 1) when a context is created (by
>> libusb_init()) or 2) when connected. Devices are no longer enumerated
>> when you call libusb_get_device_list().
> 
> So once my process calls libusb_init(), libusbx code will run whenever any 
> kind of USB device is plugged in?

The backend thread will wake up, run very briefly, and go back to sleep.

> My app only communicates with one particular USB device, and I don't much 
> like the idea of my process running code whenever the user happens to plug in 
> a keyboard, mouse, USB key, or other unrelated thing.


The code that is running is no different that what libudev or the os runs every 
time a device is plugged in. I doubt you would notice the < 1500 us time it 
takes to enumerate a device on darwin. Its much better than the nokia design 
which spawned an extra thread per context to handle device enumeration. That 
said, the design certainly can be tweaked if there is a real problem with 
libusb enumerating devices in the a backend thread.

-Nathan
------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to