Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Python and USB

Reply
Thread Tools

Python and USB

 
 
Marco Bartel
Guest
Posts: n/a
 
      04-05-2004
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

 
Reply With Quote
 
 
 
 
Roger Binns
Guest
Posts: n/a
 
      04-05-2004
> 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


 
Reply With Quote
 
 
 
 
Marco Bartel
Guest
Posts: n/a
 
      04-06-2004
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

 
Reply With Quote
 
Roger Binns
Guest
Posts: n/a
 
      04-06-2004
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Plug-in USB hardware device captures keystrokes on Mac and PC USB keyboards. Theo Computer Security 15 12-06-2012 02:10 AM
Any USB devices that plug into a USB port and make your PC an access point? Ned Wireless Networking 7 04-16-2007 03:31 PM
USB error: "One of the USB devices attached to this hub has malfunctioned, and Windows does not recognize it." Salil Computer Support 1 03-24-2007 12:16 PM
Re: USB issue ... some USB 2 ports working only in USB 1 mode hungsolo2005@yahoo.com A+ Certification 0 06-14-2006 07:26 PM
USB and USB 2.0 PowerPost2000 Computer Support 8 07-17-2005 05:08 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57