2012/12/24 Ryan Speers <rmspe...@gmail.com>: > Hello, > > I'm trying to update a program to support the new pyUSB 1.x. I'm having > several issues: > > First of all, legacy support isn't being compatible -- this is because the > code uses the bus and dev numbers, such as 002:005, to indicate a unique > device. The code needs to be able to express the fact that there are > possibly many devices of the exact same type plugged in, and that is one of > the reasons this numbering scheme allows us to make a short identifier > accessible to the user. When pyUSB 1.x loads and does the usb.legacy import, > I then don't get these numbers back. The first place the code uses them is > when it scans for devices, and reports them in part using: > ''.join([bus.dirname + ":" + dev.filename]) > In the new code, I think I'd do a find_all to get all the devices I want, > but then how do I give the user nice selectors they can feed back in to > choose which device to use for specific things? > > The other issue is I don't see an elegant way to know which version of pyUSB > I have installed at runtime, so that I can have the code handle things > differently, if needed. Currently what I found is to try to import usb.core > and if it fails, I know I'm in the 0.x code, and if it succeeds, I know I'm > in 1.x. Anyone have better ideas? >
Hi, I didn't get exactly what you are trying to do. Do you want your application support both PyUSB 1 and 0.x or are you trying to use PyUSB 1.0 legacy mode? PyUSB has the bus number and bus address attributes [1]. Legacy mode currently put every device in a fake bus, but this will change. [1] https://github.com/walac/pyusb/blob/master/docs/tutorial.rst. Section "Dealing with multiple identical devices". -- Best Regards, Wander Lairson Costa ------------------------------------------------------------------------------ LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial Remotely access PCs and mobile devices and provide instant support Improve your efficiency, and focus on delivering more value-add services Discover what IT Professionals Know. Rescue delivers http://p.sf.net/sfu/logmein_12329d2d _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users