Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: usb novice question



On May 12, 2005, at 1:45 PM, Bob Kuehne wrote:

and from my understanding of this device, the second sub-interface is known as the alternate interface. the question is how do i access this in code? i can always find the first one, but i can't seem to figure out the right flavor of what i need to install in my requests 'bAlternateSetting' to get this to work. i know that i do have the right device (vendor and product ids match) matched. how do i select inteface 0, alternate setting 1?

i know, bad form, replying to yourself. but i suppose i'm glad i figured it out. writing the question sparked enough insight that i found it. here's the rest of the pseudocode:


my code snippet:

--
    request.bInterfaceClass = kIOUSBFindInterfaceDontCare;
    request.bInterfaceSubClass = kIOUSBFindInterfaceDontCare;
    request.bInterfaceProtocol = kIOUSBFindInterfaceDontCare;
    request.bAlternateSetting = kIOUSBFindInterfaceDontCare;

kernResult = (*device)->CreateInterfaceIterator(device,
&request, &iterator);
while (usbInterface = IOIteratorNext(iterator))
{
print( "%x\n", usbInterface );

// get plugin
kernResult = IOCreatePlugInInterfaceForService(usbInterface,
kIOUSBInterfaceUserClientTypeID,
kIOCFPlugInInterfaceID,
&plugInInterface, &score);
kernResult = IOObjectRelease(usbInterface);
// get plugin
result = (*plugInInterface)->QueryInterface(plugInInterface,
CFUUIDGetUUIDBytes(kIOUSBInterfaceInterfaceID),
&interface);
(*plugInInterface)->Release(plugInInterface);
kernResult = (*interface)->USBInterfaceOpen(interface);
IOReturn rr = (*interface)->SetAlternateInterface ( interface, 1 );


    }
--

this seems to get me what i need. any better ways of doing the same?

bob

_______________________________________________
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
References: 
 >usb novice question (From: Bob Kuehne <email@hidden>)



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.