On Sat, Jan 28, 2012 at 9:59 AM, Xiaofan Chen <xiaof...@gmail.com> wrote: >> The problem is that under Mac OS X, bool(bus) >> returns False. > > Hmm, that analysis is not correct. The issue is actually > bool(dev) returns false. > > Under Ubuntu Linux 11.04, which uses libusb-0.1 > legacy, it seems to work fine. > > mcuee@GX620Ubuntu:~/Desktop/build/pyusb/pyusb$ python > Python 2.7.2+ (default, Oct 4 2011, 20:03:08) > [GCC 4.6.1] on linux2 > Type "help", "copyright", "credits" or "license" for more information. >>>> import usb.core >>>> import usb.util >>>> import usb.backend.libusb01 >>>> usbe=usb.backend.libusb01.get_backend() >>>> usbe > <usb.backend.libusb01._LibUSB object at 0xb73a732c> >>>> libusb=usb.backend.libusb01._lib >>>> libusb > <CDLL 'libusb-0.1.so.4', handle 9b8db78 at b73a418c> >>>> libusb.usb_find_busses() > 5 >>>> libusb.usb_find_devices() > 10 >>>> busses=libusb.usb_get_busses() >>>> print busses > <usb.backend.libusb01.LP__usb_bus object at 0xb7431734> >>>> print bool(busses) > True >>>> print busses.contents > <usb.backend.libusb01._usb_bus object at 0xb743165c> >>>> dev=busses[0].devices >>>> print dev > <usb.backend.libusb01.LP__usb_device object at 0xb74316ec> >>>> print bool(dev) > True
I also changed my Ubuntu 11.04 box to use libusb-compat-0.1 compatible layer on top of libusb-1.0, things still work fine. So it is not an issue with libusb-compat or libusb-legacy. -- 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