Hi,

Sorry no code (yet), as I would first like to get some buy in for
the concept before spending time on coding this.

For apps which show a list of usb devices to the user, it is useful
to have some userfriendly description of the device to show.

I've code for this in spice-gtk, which I think really should be in
libusb, as it is useful for other apps too.

Therefor I would like to suggest to add these functions:

char *libusb_get_vendor_string(libusb_device *device);
char *libusb_get_product_string(libusb_device *device);

These functions would do the following:

1) See if the OS backend supports access to cached string
descriptors, and if it does try to get the cached string descriptor
for the vendor resp. product

2) If 1) fails lookup idVendor + idProduct in usbutils usb.ids file
This means shipping our own copy, and then when build check for:
"pkg-config --variable=usbids usbutils", and then use that if found,
otherwise use our build in copy. This will give us strings for 99% of
all devices, even if the backend does not support cached string descriptor
access.

3) if both 1 and 2 fail return NULL.

We've been using this with spice-gtk for a while now and it works
pretty well.

The returned string will be dynamically allocated and should be freed
by the caller.

Regards,

Hans

------------------------------------------------------------------------------
Try New Relic Now & We'll Send You this Cool Shirt
New Relic is the only SaaS-based application performance monitoring service 
that delivers powerful full stack analytics. Optimize and monitor your
browser, app, & servers with just a few lines of code. Try New Relic
and get this awesome Nerd Life shirt! http://p.sf.net/sfu/newrelic_d2d_may
_______________________________________________
libusbx-devel mailing list
libusbx-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libusbx-devel

Reply via email to