On Mon, Apr 19, 2010 at 7:57 AM, Xiaofan Chen <xiaof...@gmail.com> wrote:
> I said that the 0.4.2 example works in the legacy mode. But it is > using the 1.0 backend as you mentioned. How do I force usb.legacy to use the libusb01 backend? I add a few lines in the 0.4.2 example and it still works fine. Can I say that it is using libusb01 backend and it seems only the custom matching function is not working properly? #!/usr/bin/env python # # Enumerate usb devices # #Copyright 2005 - 2007 Wander Lairson Costa import usb.core import usb.backend.libusb01 b = usb.backend.libusb01.get_backend() assert b is not None import usb.legacy busses = usb.busses() for bus in busses: devices = bus.devices for dev in devices: print "Device:", dev.filename print " Device class:",dev.deviceClass print " Device sub class:",dev.deviceSubClass print " Device protocol:",dev.deviceProtocol print " Max packet size:",dev.maxPacketSize print " idVendor: %d (0x%04x)" % (dev.idVendor, dev.idVendor) print " idProduct: %d (0x%04x)" % (dev.idProduct, dev.idProduct) print " Device Version:",dev.deviceVersion for config in dev.configurations: print " Configuration:", config.value print " Total length:", config.totalLength print " selfPowered:", config.selfPowered print " remoteWakeup:", config.remoteWakeup print " maxPower:", config.maxPower for intf in config.interfaces: print " Interface:",intf[0].interfaceNumber for alt in intf: print " Alternate Setting:",alt.alternateSetting print " Interface class:",alt.interfaceClass print " Interface sub class:",alt.interfaceSubClass print " Interface protocol:",alt.interfaceProtocol for ep in alt.endpoints: print " Endpoint:",hex(ep.address) print " Type:",ep.type print " Max packet size:",ep.maxPacketSize print " Interval:",ep.interval [mc...@myfreebsd ~/Desktop/build/pyusb/pyusb-0.4.2/samples]$ python usbenum_libusb01.py Device: Device class: 9 Device sub class: 0 Device protocol: 0 Max packet size: 64 idVendor: 0 (0x0000) idProduct: 0 (0x0000) Device Version: 256 Configuration: 1 Total length: 25 selfPowered: 1 remoteWakeup: 0 maxPower: 0 Interface: 0 Alternate Setting: 0 Interface class: 9 Interface sub class: 0 Interface protocol: 0 Endpoint: 0x81 Type: 3 Max packet size: 32 Interval: 255 Device: Device class: 9 Device sub class: 0 Device protocol: 1 Max packet size: 64 idVendor: 0 (0x0000) idProduct: 0 (0x0000) Device Version: 256 Configuration: 1 Total length: 25 selfPowered: 1 remoteWakeup: 0 maxPower: 0 Interface: 0 Alternate Setting: 0 Interface class: 9 Interface sub class: 0 Interface protocol: 0 Endpoint: 0x81 Type: 3 Max packet size: 8 Interval: 255 Device: Device class: 0 Device sub class: 0 Device protocol: 0 Max packet size: 8 idVendor: 1423 (0x058f) idProduct: 37728 (0x9360) Device Version: 256 Configuration: 1 Total length: 32 selfPowered: 0 remoteWakeup: 0 maxPower: 200 Interface: 0 Alternate Setting: 0 Interface class: 8 Interface sub class: 6 Interface protocol: 80 Endpoint: 0x1 Type: 2 Max packet size: 64 Interval: 0 Endpoint: 0x82 Type: 2 Max packet size: 64 Interval: 0 Device: Device class: 0 Device sub class: 0 Device protocol: 0 Max packet size: 8 idVendor: 1133 (0x046d) idProduct: 49236 (0xc054) Device Version: 21504 Configuration: 1 Total length: 34 selfPowered: 0 remoteWakeup: 1 maxPower: 196 Interface: 0 Alternate Setting: 0 Interface class: 3 Interface sub class: 1 Interface protocol: 2 Endpoint: 0x81 Type: 3 Max packet size: 6 Interval: 10 Device: Device class: 0 Device sub class: 0 Device protocol: 0 Max packet size: 8 idVendor: 2341 (0x0925) idProduct: 5206 (0x1456) Device Version: 1 Configuration: 1 Total length: 46 selfPowered: 1 remoteWakeup: 0 maxPower: 200 Interface: 0 Alternate Setting: 0 Interface class: 255 Interface sub class: 255 Interface protocol: 255 Endpoint: 0x1 Type: 2 Max packet size: 64 Interval: 0 Endpoint: 0x81 Type: 2 Max packet size: 64 Interval: 0 Endpoint: 0x2 Type: 3 Max packet size: 8 Interval: 10 Endpoint: 0x82 Type: 3 Max packet size: 8 Interval: 10 -- Xiaofan http://mcuee.blogspot.com ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users