Just curious, cause I had a run-in regarding this, but are you utilizing the
asynchronous API by chance? I didn't see anything on that tutorial about it.
I had a fun time trying to get it to work. I think libusb-1.0 and Python are
simply incompatible with each other (through threading), unless someone has
figured out what I couldn't. Incidentally, openusb worked, but memory usage
kept climbing upwards. I didn't bother to see if there were memory leaks in
openusb.

On Mon, Oct 19, 2009 at 10:34 AM, follower <follo...@rancidbacon.com> wrote:

> 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
>
------------------------------------------------------------------------------
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

Reply via email to