Hi, I've been working with the 1.x series of code (some notes: <http://code.rancidbacon.com/LearningAboutPythonandUSB>) and encountered an issue where it appears there's no easy way to retrieve string descriptors, AFAICT.
I wrote a function to make retrieving string descriptors more straightforward and incorporated it in an example 'lsusb' script: <http://code.rancidbacon.com/files/lsusb.py> I've included the code of the function below. It's not the most robust of code but hopefully it might save someone the time it took me to work out how to get it working. If it's useful feel free to consider it a "patch". :) --Philip; def getStringDescriptor(device, index): """ """ response = device.ctrl_transfer(usb.util.ENDPOINT_IN, usb.legacy.REQ_GET_DESCRIPTOR, (usb.util.DESC_TYPE_STRING << 8) | index, 0, # language id 255) # length # TODO: Refer to 'libusb_get_string_descriptor_ascii' for error handling return response[2:].tostring().decode('utf-16') ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Pyusb-users mailing list Pyusb-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/pyusb-users