From: Piotr Esden-T. <pi...@es...> - 2012-01-18 21:21:12
|
Thanks Xiaofan for pointing out the libusb mailinglist. Thanks to Fernando for pointing out the IOService.app. This is the structure I am getting for my device: AppleACPIPlatformExpert > PCI0@0 > AppleACPIPCI > EHC1@1D,7 > AppleUSBEHCI > Black Magic Probe@fd120000 > AppleUSBCDC > Black Magic Firmware Upgrade@4 > Black Magic GDB Server@0 > AppleUSBCDCACMControl > Black Magic UART Port@2 > AppleUSBCDCACMControl > IOUSBInterface@1 > AppleUSBCDCACMData > IOUSBInterface@3 > AppleUSBCDCACMData Also you asked which version of Mac OS I am running: 10.7.2 Based on the output of IOService it seems that AppleUSBCDC driver is claiming the "Black Magic Probe" device and that may be the reason why libusb can not access the ep0 to read out device strings nor send the detach command to the "Black Magic Firmware Upgrade" DFU Interface (it uses ep0 only not a separate endpoint). Please correct me if I am wrong. I am using pyusb with libusb 1.0 to access the device. The full code can be found here: https://github.com/esden/blackmagic/blob/master/scripts/stm32_mem.py and here https://github.com/esden/blackmagic/blob/master/scripts/dfu.py The error I am getting when running this code is the following: Traceback (most recent call last): File "../scripts/stm32_mem.py", line 75, in <module> man = dfudev.handle.getString(dfudev.dev.iManufacturer, 30) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/usb/legacy.py", line 272, in getString return util.get_string(self.dev, length, index, langid).encode('ascii') File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/usb/util.py", line 248, in get_string 0 File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/usb/control.py", line 169, in get_descriptor data_or_wLength = desc_size File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/usb/core.py", line 678, in ctrl_transfer self.__get_timeout(timeout) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/usb/_debug.py", line 52, in do_trace return f(*args, **named_args) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/usb/backend/libusb10.py", line 548, in ctrl_transfer timeout)) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/usb/backend/libusb10.py", line 357, in _check raise USBError(_str_error[retval.value]) usb.core.USBError: Unknown error I hope it will be possible to find some solution to that. Thanks for your help. Cheers Esden On Jan 18, 2012, at 6:37 AM, Xiaofan Chen wrote: > On Wed, Jan 18, 2012 at 4:39 PM, Piotr Esden-Tempski <pi...@es...> wrote: >> I am having an issue with a device that is providing a hybrid device >> with two CDC interfaces and a DFU interface. When plugged in the >> CDC interfaces are being properly detected and presented as two >> /dev/cu.usbmodemxxx. >> >> I am trying to access the remaining DFU interface using libusb, I >> can open and claim the DFU interface but I can't send any commands >> to the device, like get vendor string, get manufacturer string or >> DFU detach command. > > You might be able to get better help in libusb mailing list. > http://www.libusb.org/wiki/MailingList > > You may also want to post your libusb codes snippet. > As answered by Fernando, the get vendor string and > get manufacturer string command should be directed > to the device and not the interface. |