Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 8 Jun 2009 19:42:24 +0200
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        Jack Twilley <jmt@twilley.org>
Cc:        freebsd-usb@freebsd.org
Subject:   Re: How to retrieve iManufacturer/iProduct information from libusb20?
Message-ID:  <200906081942.26220.hselasky@c2i.net>
In-Reply-To: <4A2D47FF.8040209@twilley.org>
References:  <4A2B29C0.7020709@twilley.org> <200906080030.53822.hselasky@c2i.net> <4A2D47FF.8040209@twilley.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 08 June 2009 19:18:55 Jack Twilley wrote:
> Hans Petter Selasky wrote:
> > On Sunday 07 June 2009 04:45:20 Jack Twilley
> >
> > 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()...
> >
> > After you find the string index, you can use the
> > following function to get strings:
> >
> >      int
> >      libusb20_dev_req_string_simple_sync(struct
> > libusb20_device *pdev,
> >          uint8_t index, void *ptr, uint16_t len);
>
> Finding the string index was harder than I expected, since I can't get
> anything useful out of what libusb20_dev_get_device_desc() returns.
> Heck, I even tried a short for loop from 0 to 15 just to see if the
> values I saw in usbconfig were magic values pointing to the string.
>
> How do I find the string index?
>

     struct LIBUSB20_DEVICE_DESC_DECODED *pdesc;
     pdesc = libusb20_dev_get_device_desc(pdev);
	printf("Vendor string is %u\n", pdesc->iVendor);
		if zero, the string is not present.

--HPS




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906081942.26220.hselasky>