2011/11/26 Dean Hall <dwhall...@gmail.com>:
> Hello,
>
> I just joined the list and wanted to introduce myself.  I'm an
> embedded systems developer and I'm looking for a cross-platform API to
> access HID devices.  Python is my goto high level language.  So these
> parameters led me straight to this project.  I just dl'd and installed
> pyusb-1.0.0-a0 on Mac OS X (10.5.8) X86.  I estimate that pyusb found
> an old libusb that I built ages ago.  I'd like to know if there's a
> way to query pyusb which backend it is using.

Welcome to the mailing list. You can see what backend is in use by
accesing internal data dev._ctx.backend and using the isistance
function. But bear in mind that this is internal data and may change
in the future. The porable way to be sure what backend you are using
is to supply one in the usb.core.find function (the backend
parameter).

>
> Without any trouble, I've been able to do this::
>
>        >>> import usb.core
>        >>> dev = usb.core.find()
>        >>> dev
>        <usb.core.Device object at 0x71abd0>
>        >>> dev.bLength
>        18
>
> I have OS X 10.5 and 10.6 systems on which I can validate pyusb.  I'm
> still learning the API, so I don't know any good exercises yet.  I did
> run the following test that came with the source::
>
>        $ pwd
>        /Users/dwhall/dwh/code/other/pyusb-1.0.0-a0/tests
>        $ python testall.py
>        .......
>        ----------------------------------------------------------------------
>        Ran 7 tests in 0.003s
>
>        OK
>

If you want to run the regression tests, you will need a PIC 18F4550
device and get the test firmware from [1], accessing the pyusb branch.
You may have to do some tweaks in the code depending the
configurations of your hardware. If you run the regression tests
without a hardware, it will run fewer tests.

> My next goal is to create a higher-level interface using pyusb that
> does something like:
>
>        import usb.util
>        devs = usb.util.enumerate_hid()
>        ...
>
> regards,
>

As far as I know, libusb is problematic with HID devices, you should
take a look at hidapi [2], but I don't know if there is any python
binding for it.

[1] https://github.com/walac/pyusb

[2] http://www.signal11.us/oss/hidapi/

-- 
Best Regards,
Wander Lairson Costa
https://github.com/walac
https://gitorious.org/~walac

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure 
contains a definitive record of customers, application performance, 
security threats, fraudulent activity, and more. Splunk takes this 
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
pyusb-users mailing list
pyusb-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pyusb-users

Reply via email to