Python and USB

Discussion in 'Python' started by Marco Bartel, Apr 5, 2004.

  1. Marco Bartel

    Marco Bartel Guest

    Hi Folks,

    i just started to adapt some i2c routines from Flagship to Python.
    I allready succeded in porting the low-level-routines accessing the
    parallel port. But now i also changed the electronics, so that my
    i2c-bus is connected to the usb-port of my machine. What i'am looking
    for now, is a way to access the usb-subsystem from python. i know there
    is a library called libusb for c , wich deals with the
    usb-kernel-modules, but unfortunatly i didn't found a wrapper around
    this library, wich allows me to do the same from within python. I just
    was thinking about to do the wrapper myself using SWIG, but i also still
    hope, that there is someone outside, who played allready with usb and
    python arround.

    great thanks in advance for some tips and hints
    Marco
     
    Marco Bartel, Apr 5, 2004
    #1
    1. Advertising

  2. Marco Bartel

    Roger Binns Guest

    > I just
    > was thinking about to do the wrapper myself using SWIG, but i also still
    > hope, that there is someone outside, who played allready with usb and
    > python arround.


    Here is one I made earlier:

    http://cvs.sf.net/viewcvs.py/bitpim/bitpim/native/usb/

    It is shipping as part of BitPim and works with libusb on Linux and Mac
    and libusb-win32 on Windows.

    If someone wants to make this into a proper distutils style package
    etc, I'd be more than happy to contribute the code etc.

    Roger
     
    Roger Binns, Apr 5, 2004
    #2
    1. Advertising

  3. Marco Bartel

    Marco Bartel Guest

    Roger Binns wrote:
    >>I just
    >>was thinking about to do the wrapper myself using SWIG, but i also still
    >>hope, that there is someone outside, who played allready with usb and
    >>python arround.

    >
    >
    > Here is one I made earlier:
    >
    > http://cvs.sf.net/viewcvs.py/bitpim/bitpim/native/usb/
    >
    > It is shipping as part of BitPim and works with libusb on Linux and Mac
    > and libusb-win32 on Windows.
    >
    > If someone wants to make this into a proper distutils style package
    > etc, I'd be more than happy to contribute the code etc.
    >
    > Roger
    >
    >

    Thanks a lot roger,
    it was exactly the thing i'am was looking for.
    Now i only have to get my device running. Under
    C i was allready using the libusb, and so this code should
    be easily to be adapted.

    THX
    Marco
     
    Marco Bartel, Apr 6, 2004
    #3
  4. Marco Bartel

    Roger Binns Guest

    > it was exactly the thing i'am was looking for.
    > Now i only have to get my device running. Under
    > C i was allready using the libusb, and so this code should
    > be easily to be adapted.


    Yes, you get a straight wrapping of libusb, as well as a
    more Pythonic interface (in libusb.py and usb.py respectively).

    There are some issues unresolved, mainly due to the APIs that
    libusb exposes. For example it makes no mention of being
    thread safe (my wrapper does release the GIL around read/writes)
    and the lists of busses/devices/configs are freed and reallocated
    if you call usb_find_busses/usb_find_devices. Consequently
    the Python objects could be pointing at freed memory.

    Roger
     
    Roger Binns, Apr 6, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Philippe Martin

    USB and Python

    Philippe Martin, Jun 23, 2006, in forum: Python
    Replies:
    3
    Views:
    8,344
    Philippe Martin
    Jun 25, 2006
  2. galapogos
    Replies:
    4
    Views:
    399
    Kenny McCormack
    May 11, 2007
  3. mcl
    Replies:
    3
    Views:
    732
  4. bussiere maillist
    Replies:
    0
    Views:
    503
    bussiere maillist
    Dec 7, 2007
  5. LittleAlex
    Replies:
    0
    Views:
    451
    LittleAlex
    Sep 15, 2008
Loading...

Share This Page