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: general OS X user-space GET_DESCRIPTOR device request?



On Friday, March 15, 2002, at 10:31 PM, Barry Twycross wrote:

IOUSBLib has nice friendly calls such as GetDevice<whatever> but what about more generalised usage of bRequest fields for obtaining other info. Using the example of USBGetManufacturerStringIndex, how can you, in the user-space, issue a GET_DESCRIPTOR call to retrieve the relevant info, specifying the bRequest, wValue, wIndex fields etc. I guess you'd use something along the lines of kUSBRqGetDescriptor (or kUSBRqGetStatus or whatever) I'm just not entirely sure how to do this, or if ot's possible to, from the user-space in

Nano has mentioned which API to use, if you're confused about what the parameters should be, this is documented in the USB spec, chapter 9.

Hi Barry,
Since my original mail on this subject I've been reading through a lot more of the USB spec so have a better understanding of the processes, parameter's etc as defined in those documents, but thanks for the breakdown.


The wLength you supply is however long you expect the string to be. You could supply 255, the maximum. However there is a common bug in which devices can hang on this, so the normal way of doing this is to ask for 2 bytes, which tells you the length of the descriptor (the first byte). Then you ask for exactly the right number of bytes.

Aha, pre-emptive question answering!
Very handy tip indeed, I was going to go for the rather inefficient maximum option, or at least a wLength which should reasonably be able to hold the string. Thanks again for all your help, it's _really_ appreciated.
All the best,


ben
_______________________________________________
usb mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/usb
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: general OS X user-space GET_DESCRIPTOR device request? (From: Barry Twycross <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.