| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
|
I wrote a glob of code, understanding very little and riffing off the sample code in the documentation, which works fine when our USB device is declared to have device class 0x00. Our USB engineer has recently come to the conclusion that we really should be using device class 0xFF. When we do, I can't succeed in getting an "interface" for the device. It's a Cypress device. When the firmware we download into it has DeviceDscr: db DSCR_DEVICE_LEN ;; Descriptor length db DSCR_DEVICE ;; Decriptor type dw 0002H ;; Specification Version (BCD) db 000H ;; Device class db 000H ;; Device sub-class db 000H ;; Device sub-sub-class db 64 ;; Maximum packet size dw 07311H ;; Vendor ID (ECRM) dw 0A1ECH ;; Product ID (ECRM Device) dw FW_VERSION ;; Product version ID db 1 ;; Manufacturer string index db 2 ;; Product string index db 0 ;; Serial number string index db 1 ;; Number of configurations ;; Interface Descriptor db DSCR_INTRFC_LEN ;; Descriptor length db DSCR_INTRFC ;; Descriptor type db 0 ;; Zero-based index of this interface db 0 ;; Alternate setting db 5 ;; Number of end points db 0ffH ;; Interface class db 0ffH ;; Interface sub class db 0ffH ;; Interface sub sub class db 0 ;; Interface descriptor string index everything works fine. If we change the "Device class" to 0ffH, I can't access it. In both cases, whether the device class is 000H or 0ffH, I get about 98% there. I: --detect that our ECRM device is not on the bus --acquire the Cypress device and download our firmware into it, causing a new ECRM device to magically appear on the bus --create a matching dictionary: matchingDictionary = IOServiceMatching(kIOUSBDeviceClassName); CFDictionarySetValue(matchingDictionary, CFSTR(kUSBVendorID), CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &vendor)); CFDictionarySetValue(matchingDictionary, CFSTR(kUSBProductID), CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt32Type, &product)); --successfully call IOServiceGetMatchingService on the dictionary and obtain a valid io_service_t --successfully call IOCreatePlugInInterfaceForService on that value --successfully obtain a IOUSBDeviceInterface182 for the device --fill out an IOUSBFindInterfaceRequest structure: memset(&request, 0, sizeof(request)); // superstition request.bInterfaceClass = kIOUSBFindInterfaceDontCare; request.bInterfaceSubClass = kIOUSBFindInterfaceDontCare; request.bInterfaceProtocol = kIOUSBFindInterfaceDontCare; request.bAlternateSetting = kIOUSBFindInterfaceDontCare; --successfully call CreateInterfaceIterator(dev, &request, &iterator) and obtain a valid, nonzero iterator. Where the two situations differ is at the point where I try to obtain an io_service_t for an interface: usbInterface = IOIteratorNext(iterator). When the device class is 00H, I obtain a valid usbInterface and I'm off to the races and everything's fine. When the device class is 0FFH, the first call to IOIteratorNext(iterator) returns 0, i.e. it doesn't find any interfaces. Since I'm successfully get to the "device" itself, the API can't be objecting too strenuously to the device class being 0xFF. So, why won't the "device" give me an "interface?" I've looked all over for somewhere, anywhere in the API where I can tell it that the device class, like the interface class, should be a "DontCare," or else a way of I can tell it explicitly to expect the device class to be 0xFF, but I can't find anything and can't find documentation that discusses this. (It's particular annoying since my Windows-coding colleague, whose level of understanding is about the same as mine, finds that under Windows the 0xFF device class "just works" with no changes needed on his part...) |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Usb mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/usb/email@hidden This email sent to email@hidden
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.