How to retrieve iManufacturer/iProduct information from libusb20?

Jack Twilley jmt at twilley.org
Mon Jun 8 17:17:16 UTC 2009


Sylvestre Gallon wrote:
> On Sun, Jun 7, 2009 at 4:45 AM, Jack Twilley<jmt at twilley.org> wrote:
>> I have been looking through the source to usbconfig and other tools trying
>> to figure out how to retrieve the iManufacturer and iProduct strings.  The
>> libusb20 man page describes the libusb20_dev_get_device_desc() function but
>> there's no useful information on the struct it returns.  The include file
>> looks as if the struct is automagically generated by macros within macros
>> which is too complicated for me to figure out without help.  Any ideas?
>>  There's gotta be a better way than using LIBUSB20_DEVICE_DESC()...
>>
>> Jack.
> 
> 
> You can use the function libusb20_dev_get_device_desc() that
> returns a struct LIBUSB20_DEVICE_DESC_DECODED *. The field
> idVendor and idProduct in the struct LIBUSB20_DEVICE_DESC_DECODED
> are what you are looking for :)

idVendor and idProduct look good according to the output of usbconfig, 
but whenever I try to refer to ddesc->idVendor (or anything else in that 
structure) I get "error: dereferencing pointer to incomplete type". 
This is what sent me looking through the includes for the actual type 
definition.

Other than the usbconfig code that uses the LIBUSB20_DEVICE_DESC() 
macro, is there any other example code out there that does what I'm 
trying to do?

> 
> Cheers,
> 

Thanks!

Jack.


More information about the freebsd-usb mailing list