From owner-freebsd-usb@FreeBSD.ORG Mon Jun 8 17:17:16 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 AC53F106564A for ; Mon, 8 Jun 2009 17:17:16 +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 919C18FC12 for ; Mon, 8 Jun 2009 17:17:16 +0000 (UTC) (envelope-from jmt@twilley.org) Received: from localhost (localhost [127.0.0.1]) by alpha.twilley.org (Postfix) with ESMTP id 0E482233822; Mon, 8 Jun 2009 10:17:16 -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 1er3-UppcXOd; Mon, 8 Jun 2009 10:17:14 -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 19F6C233819; Mon, 8 Jun 2009 10:17:14 -0700 (PDT) Message-ID: <4A2D476B.20100@twilley.org> Date: Mon, 08 Jun 2009 10:16:27 -0700 From: Jack Twilley User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: Sylvestre Gallon References: <4A2B29C0.7020709@twilley.org> <164b4c9c0906070648gb7abd54o967c2daebf6e8032@mail.gmail.com> In-Reply-To: <164b4c9c0906070648gb7abd54o967c2daebf6e8032@mail.gmail.com> 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:17:16 -0000 Sylvestre Gallon wrote: > On Sun, Jun 7, 2009 at 4:45 AM, 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()... >> >> 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.