From: Steven P. <n9...@n9...> - 2003-12-16 17:42:30
|
On Dec 16, 2003, at 10:01 AM, Steven Palm wrote: > There may yet have to be a third choice. The issue is that once a > device is spoken for by a kernel driver, you can not get access to it > to configure it. And in order for the phone to function as a network > interface via PPP, you have to have the kernel driver loaded, so this > is like to be a problem. > > The workaround on the Mac is essentially to bypass the open device, > configure, claim interface stuff and maybe jump right to opening the > requisite interface on the device. I have done some more reading on > this, and I should be able to find the device, enumerate it's > interfaces, get vendor/product/protocol information, device > descriptor, etc... even if it's claimed by a kernel driver, but I can > not open the device itself, only it's unclaimed interface(s). This is > where the libusb model breaks down. However, I perhaps can add an > additional bit to libusb such as open_usb_interface() as a fallthrough > in case opening the device fails. Well, I've properly reworked the darwin implementation of libusb and it seems quite happy now... It can do things it never dreamed of before. :-) Because of the fact that the MacOS will allow you to interact somewhat with devices even if they are opened exclusively by other processes, I took advantage of that. I treat all requests to open a device as "partially" successful even if they fail to gain exclusive access. Then, in other parts of libusb, things are allowed or disallowed based on the type of open they managed to get... So, you can get device information, descriptor, interfaces, etc, but you can NOT set configuration/etc. You can enumerate and claim interfaces, though, provided they are not used by the system. So, with this new and improved (?) version of libusb, you get something like this from usbscan.py: UsbScan 7 December 2003 usb::026::002::0: active: True available: False description: USB Device - Vendor 0x5ac Product 0x8203 (Interface 0) libusb: True usb-interface: 0 usb-product: 33283 usb-vendor: 1452 usb::059::002::1: active: True available: False description: USB Device - Vendor 0x1004 Product 0x6000 (Interface 1) libusb: True usb-interface: 1 usb-product: 24576 usb-vendor: 4100 usb::059::002::2: active: True available: True description: USB Device - Vendor 0x1004 Product 0x6000 (Interface 2) libusb: True usb-interface: 2 usb-product: 24576 usb-vendor: 4100 ...and it works even with the MacOS X driver loaded to supply /dev/cu.usbmodemXXX drivers for PPP access. I will send this over to the darwin guy at libusb and see what he thinks. I'll also start working on the comscan.py module to return something meaningful for the Mac. Hopefully. ;-) -. ----. -.-- - -.-- Steve Palm - n9...@n9... -. ----. -.-- - -.-- |