Please, find attached a little patch that should fix your problem. I could not test it because my dev machine died a month ago. Please, report if it worked thus I can commit it.
Wander 2011/2/23 Sarah Messer <ikust...@yahoo.com> > of course, as soon as I hit "send", i find this: > http://pyusb.sourceforge.net/docs/1.0/tutorial.html > > ... > > -Sarah > > --- On *Wed, 2/23/11, Sarah Messer <ikust...@yahoo.com>* wrote: > > > From: Sarah Messer <ikust...@yahoo.com> > Subject: [pyusb-users] TypeError with legacy > DeviceHandle.claimInterface(Interface) > To: pyusb-users@lists.sourceforge.net > Date: Wednesday, February 23, 2011, 2:55 PM > > > Hello, > > I've recently updated my OS (to openSuSe 11.3), after changing my > motherboard (long story). Probably more relevant is the fact that at the > same time I'm going from pyusb 0.1ish to pyusb-1.0.0-a1 > > Code that had been working well is now going through the > compatibility/legacy layer, which seems to _almost_ work. The issue appears > when I claim the USB interface. Here's the tail of the traceback: > > File "./acquisition/scope.py", line 975, in _foundrightscope > self.hand.claimInterface(self.face) > File "/usr/local/lib/python2.6/site-packages/usb/legacy.py", line 225, in > claimInterface > util.claim_interface(self.dev, interface) > File "/usr/local/lib/python2.6/site-packages/usb/util.py", line 191, in > claim_interface > device._ctx.managed_claim_interface(device, interface) > File "/usr/local/lib/python2.6/site-packages/usb/core.py", line 112, in > managed_claim_interface > self.backend.claim_interface(self.handle, i) > File "/usr/local/lib/python2.6/site-packages/usb/_debug.py", line 52, in > do_trace > return f(*args, **named_args) > File "/usr/local/lib/python2.6/site-packages/usb/backend/libusb10.py", > line 471, in claim_interface > _check(_lib.libusb_claim_interface(dev_handle, intf)) > ArgumentError: argument 2: <type 'exceptions.TypeError'>: wrong type > > "self.hand" is of type <class 'usb.legacy.DeviceHandle'> (It came from a > call to "dev.open()", where "dev" is of type <class 'usb.legacy.Device'>.) > "self.face" is of type <class 'usb.legacy.Interface'> > > The wiki page that I used to use for reference ( > http://wiki.erazor-zone.de/wiki:projects:python:pyusb:pydoc) doesn't > appear to talk about conversion or use of the new & improved pyusb... > > Could someone tell me where to go for conversion / interface docs? I'd like > to do as little code conversion as possible, but I'm not sure where to > start. > > Thanks > > -Sarah > > > > -----Inline Attachment Follows----- > > > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs and other IT data in > Real-Time with Splunk. Collect, index and harness all the fast moving IT > data > generated by your applications, servers and devices whether physical, > virtual > or in the cloud. Deliver compliance at lower cost and gain new business > insights. http://p.sf.net/sfu/splunk-dev2dev > > -----Inline Attachment Follows----- > > > _______________________________________________ > pyusb-users mailing list > pyusb-users@lists.sourceforge.net<http://mc/compose?to=pyusb-users@lists.sourceforge.net> > https://lists.sourceforge.net/lists/listinfo/pyusb-users > > > > > ------------------------------------------------------------------------------ > Free Software Download: Index, Search & Analyze Logs and other IT data in > Real-Time with Splunk. Collect, index and harness all the fast moving IT > data > generated by your applications, servers and devices whether physical, > virtual > or in the cloud. Deliver compliance at lower cost and gain new business > insights. http://p.sf.net/sfu/splunk-dev2dev > _______________________________________________ > pyusb-users mailing list > pyusb-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pyusb-users > >
Index: usb/legacy.py =================================================================== --- usb/legacy.py (revisão 89) +++ usb/legacy.py (cópia de trabalho) @@ -222,9 +222,12 @@ Arguments: interface: interface number or an Interface object. """ - util.claim_interface(self.dev, interface) - self.__claimed_interface = interface + if_num = interface.interfaceNumber \ + if isinstance(interface, Interface) else interface + util.claim_interface(self.dev, if_num) + self.__claimed_interface = if_num + def releaseInterface(self): r"""Release an interface previously claimed with claimInterface.""" util.release_interface(self.dev, self.__claimed_interface)
------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users