2011/5/10 wander.lairson <wander.lair...@gmail.com>:
> The root of all trouble is the internal
> _ResourceManager.get_configuration method, that returns an interface
> object. If I change it to return the interface number instead, maybe
> the performance gets improved, either with an Interface object or
> interface number as parameter. Going to check that.
>
Please, try the the attached (untested) patch and check if you get any
improvement...
Wander
Index: usb/core.py
===================================================================
--- usb/core.py (revisão 90)
+++ usb/core.py (cópia de trabalho)
@@ -158,6 +158,15 @@
else:
return util.find_descriptor(cfg, bInterfaceNumber=intf)
+ def get_interface_number(self, device, intf):
+ if intf is None:
+ cfg = self.get_active_configuration(device)
+ return cfg[(0,0)].bInterfaceNumber
+ elif isinstance(intf, Interface):
+ return intf.bInterfaceNumber
+ else:
+ return intf
+
def get_active_configuration(self, device):
if self._active_cfg_index is None:
cfg = util.find_descriptor(
@@ -590,7 +599,7 @@
util.ENDPOINT_TYPE_ISO:backend.iso_write
}
- intf = self._ctx.get_interface(self, interface)
+ intf = self._ctx.get_interface_number(self, interface)
fn = fn_map[self._ctx.get_endpoint_type(self, endpoint, intf)]
self._ctx.managed_claim_interface(self, intf)
------------------------------------------------------------------------------
Achieve unprecedented app performance and reliability
What every C/C++ and Fortran developer should know.
Learn how Intel has extended the reach of its next-generation tools
to help boost performance applications - inlcuding clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users