2010/7/12 Chris Wolf <cw10...@gmail.com>: > Wander, > > I tried some other things: > > 1.) I tried to use openusb. There were some issues building on the Mac - > the distribution tar archive was missing a header file, "darwin.h" > and the sample program was missing, both of which I got from source > control. Even after that, the PyUSB wrapper didn't work as expected, > although it did find and open the shared library. > > 2.) Next I tried libusb10, this seemed to work. The PyUSB wrapper can now > iterate over all the devices/interfaces on my machine. > > I noticed that the PyUSB bindings seem to not fully treat the notion of > busses - even the legacy.busses() function only returns a single dummy > Bus object, which simply has an array of Devices, regardless of which real > bus each of those devices belongs to. I suppose this is Ok, since for the > purpose of interacting with connected peripherals, the particular bus does > not matter as long as somehow you can fetch the matching device and it's > cfg, interface, ep, etc. > > I guess I was curious about busses so that I could have a program to traverse > the whole bus/device tree like Apple's hardware profiler. (see attached image) > > This last point is not very important, so I don't expect any help from you > on this - I was just comparing the libusb/PyUSB capability with the Apple > utility. > > The important issue of finding devices/interfaces/config seems to be solved > by moving away from libusb01 to libusb10. > > Thanks for your help, > > Chris Wolf > > P.S. If you still want to pursue the issues with libusb01 on MacOS, I can work > with you on it, otherwise I seem to be all set with libusb10.
This would be for great help, it is really weird that PyUSB get_busses is not working. > > On 7/11/10 11:09 AM, Chris Wolf wrote: >> >> >> >>> What's libusb .so file named? >> >> I also looked at this code: >> >> class _LibUSB(usb.backend.IBackend): >> @methodtrace(_logger) >> def enumerate_devices(self): >> _check(_lib.usb_find_busses()) >> _check(_lib.usb_find_devices()) >> >> bus = _lib.usb_get_busses() >> >> while bool(bus): >> dev = bus[0].devices >> while bool(dev): >> yield dev[0] >> dev = dev[0].next >> bus = bus[0].next >> >> >> ...and so I performed the following test: >> >>>>> import usb.backend.libusb01 >>>>> usbe = usb.backend.libusb01.get_backend() >>>>> libusb = usb.backend.libusb01._lib >>>>> busses = libusb.usb_get_busses() >>>>> print bool(busses) >> False >> >> So it looks like it's not getting the bus linked list for some reason, >> even though the 'C' lib demo code does: >> >> int >> main(int argc, char *argv[]) { >> struct usb_bus *busses; >> usb_init(); >> usb_find_busses(); >> usb_find_devices(); >> >> busses = usb_get_busses(); >> >> struct usb_bus *bus; >> int c, i, a; >> >> /* ... */ >> >> for (bus = busses; bus; bus = bus->next) { >> struct usb_device *dev; >> printf("BUS: %02.02x: %s\n", bus->location, bus->dirname); >> >> >> Thanks, >> >> -Chris > > ------------------------------------------------------------------------------ > This SF.net email is sponsored by Sprint > What will you do first with EVO, the first 4G phone? > Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first > _______________________________________________ > pyusb-users mailing list > pyusb-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/pyusb-users > > -- Best Regards, Wander Lairson Costa ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ pyusb-users mailing list pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users