From: Roger B. <ro...@ro...> - 2003-12-13 05:57:13
|
> The > current logic being used seems to want to walk the tree looking for a > match with vendor and product code on a device, and then get it's > second interface, but since you cannot open the device this whole > approach falls apart. That is what the native/usb/usb.py code does as a test, but isn't what bitpim proper does. BitPim invokes usbscan.py in the main code to get a list of all USB devices and names them usb::bus::device::interface comdiagnose then picks out what devices from the output of comscan.py and usbscan.py are likely to be phones or USB to serial cables. The reason for using names is so that particular devices can be selected. As a worst case example, here is usbscan output for my machine with a USB to serial cable, a VX4400 and a VX6000 plugged in. UsbScan 7 December 2003 usb::001::016::0: active: 1 available: 0 description: USB Device - Vendor 0x4b8 Product 0x5 (Interface 0) libusb: 1 usb-interface: 0 usb-product: 5 usb-vendor: 1208 usb::001::020::0: active: 1 available: 0 description: USB Device - Vendor 0x67b Product 0x2303 (Interface 0) libusb: 1 usb-interface: 0 usb-product: 8963 usb-vendor: 1659 usb::001::022::1: active: 1 available: 0 description: USB Device - Vendor 0x1004 Product 0x6000 (Interface 1) libusb: 1 usb-interface: 1 usb-product: 24576 usb-vendor: 4100 usb::001::022::2: active: 1 available: 1 description: USB Device - Vendor 0x1004 Product 0x6000 (Interface 2) libusb: 1 usb-interface: 2 usb-product: 24576 usb-vendor: 4100 usb::001::021::1: active: 1 available: 0 description: USB Device - Vendor 0x1004 Product 0x6000 (Interface 1) libusb: 1 usb-interface: 1 usb-product: 24576 usb-vendor: 4100 usb::001::021::2: active: 1 available: 1 description: USB Device - Vendor 0x1004 Product 0x6000 (Interface 2) libusb: 1 usb-interface: 2 usb-product: 24576 usb-vendor: 4100 > On MacOS X for this device, you *CAN* get to the interface in > question, but you actually have to go directly for the interface by > vendor, product, configuration and interface number. What if there are multiple devices with the same details? > The question becomes, how to hack libusb so it will work or, if that > falls through, write a separate access routine for the Mac, at least > the 'open/init' bit. You have to call usb_open in order to call usb_claim_interface in libusb. The actual opening of a device happens in _openusb in commport.py. You can build a seperate interface for USB if you want to instead of using libusb. You can see another example in native/wab where I actually wrote my own code for Python interfacing. Roger |