On Sat, Jan 21, 2012 at 2:33 AM, Peter Bigot <pabi...@users.sourceforge.net> wrote: >> Could you please post your full test codes? > > The only thing above that was "import usb". That code does assume > that the backend is libusb01; if the error you're getting is: > > AttributeError: '_Device' object has no attribute 'bus' > > perhaps you're using libusb10 even if you think you aren't. Try the > following version
Thanks. The code now works for me under Ubuntu 11.04. > import usb > import usb.backend.libusb01 > > for d in usb.core.find(find_all=True, > backend=usb.backend.libusb01.get_backend()): > dev = d._ctx.dev > print type(dev) > print '%s: %u:%u or %s:%u' % (d, d.bus, d.address, > dev.bus[0].dirname, dev.devnum) > > When I do that, it appears the patch is correct even with libusb01 compat. > This is what I get under Ubuntu 11.04 which uses libusb-0.1 legacy, without your patch. <class 'usb.backend.libusb01._usb_device'> <usb.core.Device object at 0x85fe7cc>: 5:2 or 005:2 <class 'usb.backend.libusb01._usb_device'> <usb.core.Device object at 0x85fe84c>: 5:1 or 005:1 <class 'usb.backend.libusb01._usb_device'> <usb.core.Device object at 0x85fe8ac>: 4:2 or 004:2 <class 'usb.backend.libusb01._usb_device'> <usb.core.Device object at 0x85fe8ec>: 4:1 or 004:1 <class 'usb.backend.libusb01._usb_device'> <usb.core.Device object at 0x85fe92c>: 3:3 or 003:3 <class 'usb.backend.libusb01._usb_device'> <usb.core.Device object at 0x85fe96c>: 3:2 or 003:2 <class 'usb.backend.libusb01._usb_device'> <usb.core.Device object at 0x85fe9ac>: 3:1 or 003:1 <class 'usb.backend.libusb01._usb_device'> <usb.core.Device object at 0x85fe9ec>: 2:2 or 002:2 <class 'usb.backend.libusb01._usb_device'> <usb.core.Device object at 0x85fea2c>: 2:1 or 002:1 <class 'usb.backend.libusb01._usb_device'> <usb.core.Device object at 0x85fea6c>: 1:1 or 001:1 mcuee@GX620Ubuntu:/usr/lib$ lsusb Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 002 Device 002: ID 413c:3010 Dell Computer Corp. Optical Wheel Mouse Bus 003 Device 002: ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC Bus 003 Device 003: ID 046d:c315 Logitech, Inc. Classic New Touch Keyboard Bus 004 Device 002: ID 0db0:a970 Micro Star International Bluetooth dongle Bus 005 Device 002: ID 03eb:2022 Atmel Corp. at90usbkey sample firmware (composite device) Does this mean that your patch is not necessary, at least for Ubuntu 11.04 version of libusb-0.1? -- Xiaofan ------------------------------------------------------------------------------ Try before you buy = See our experts in action! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-dev2 _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users