device filtering support
Xiaofan Chen
xiaofanc at gmail.com
Sun Feb 5 04:29:14 EST 2012
On Sun, Feb 5, 2012 at 10:15 AM, Vitali Lovich <vlovich at gmail.com> wrote:
> On Feb 4, 2012, at 6:02 PM, Xiaofan Chen wrote:
>> On the other hand, I understand the desire to follow the Linux libusb's
>> idea of "query all USB device for information". In that case, libusbx
>> can not use the approach of libusbK. I was hoping Vitali's filter approach
>> can help to make things better.
>
> I fail to see anyone actually demonstrating that there's a problem here as
> opposed to a hand-wavy theoretical issue. Until there's a demonstrable
> issue here, there is no point in trying to over-architect a solution to a
> theoretical problem, especially one that appears to be poorly understood.
Actually there was one complaint last time we carried out
the survey in libusb-win32 list.
http://libusb.6.n5.nabble.com/User-survey-tp4384281p4393121.html
"- enumaration of devices was far too slow (much slower than under
libusb-win32 )"
Travis' view
http://libusb.6.n5.nabble.com/User-survey-tp4384281p4394283.html
Pete's answer
http://libusb.6.n5.nabble.com/User-survey-tp4384281p4406262.html
Pete's view was in his answer.
++++++++++++++++++++++++++++
The solution, as far as libusb-1.0 is concerned (-win32 is slightly
different) is either get Microsoft to cache descriptors in the OS, do
that ourselves with a Windows service (which would massive drawback for
ease of use, so as bad an "option" as the previous one) or ignore/change
the current libusb-1.0 requirements that enumeration retrieves the
descriptors for all devices, as, per libusbi.h:
o get_device_list():
" Your implementation should enumerate all devices on the system,
regardless of whether they have been seen before or not."
o get_device_descriptor():
" The descriptor should be retrieved from memory, NOT via bus I/O to the
device. This means that you may have to cache it in a private structure
during get_device_list enumeration. You may also have to keep track
of which configuration is active when the user changes it."
...
Once we have hotplug (or better, during hotplug integration), I think
libusb-1.0 should overhaul how enumeration is being conducted across
platforms anyway, as re-building the whole list is a costly process,
which would be better performed once, preferably during init, and
updated through hotplug events.
++++++++++++++++++++++++++++++++
So I think Pete agreed that there is a problem but it should be
solved together with hotplug or after hotplug.
I believe that you mentioned before as well you saw performance
problem under Mac OS X related to the device list.
The not-so-well understood issue is how bad the problem is.
Whether it is a fundamental problem or just a performance problem
which needs "just optimization".
Interestingly, Pete was against the idea of using a Windows
service. But that is actually quite close to his current idea
of spawning a new process.
--
Xiaofan
More information about the libusbx
mailing list