From owner-freebsd-usb@FreeBSD.ORG Mon Jun 8 17:18:58 2009 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8273106564A for ; Mon, 8 Jun 2009 17:18:58 +0000 (UTC) (envelope-from jmt@twilley.org) Received: from alpha.twilley.org (alpha.twilley.org [204.152.189.135]) by mx1.freebsd.org (Postfix) with ESMTP id AE0BE8FC19 for ; Mon, 8 Jun 2009 17:18:58 +0000 (UTC) (envelope-from jmt@twilley.org) Received: from localhost (localhost [127.0.0.1]) by alpha.twilley.org (Postfix) with ESMTP id 88432233822; Mon, 8 Jun 2009 10:18:58 -0700 (PDT) X-Virus-Scanned: amavisd-new at twilley.org Received: from alpha.twilley.org ([127.0.0.1]) by localhost (alpha.twilley.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id FZYYkU3pnWri; Mon, 8 Jun 2009 10:18:56 -0700 (PDT) Received: from [10.202.10.160] (205.158.109.36.ptr.us.xo.net [205.158.109.36]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by alpha.twilley.org (Postfix) with ESMTPSA id AB5B8233819; Mon, 8 Jun 2009 10:18:56 -0700 (PDT) Message-ID: <4A2D47FF.8040209@twilley.org> Date: Mon, 08 Jun 2009 10:18:55 -0700 From: Jack Twilley User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Hans Petter Selasky References: <4A2B29C0.7020709@twilley.org> <200906080030.53822.hselasky@c2i.net> In-Reply-To: <200906080030.53822.hselasky@c2i.net> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-usb@freebsd.org Subject: Re: How to retrieve iManufacturer/iProduct information from libusb20? X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 08 Jun 2009 17:18:59 -0000 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? > > > --HPS Thanks! Jack.