473,395 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Python and USB

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

Jul 18 '05 #1
3 12114
> 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
Jul 18 '05 #2
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

Jul 18 '05 #3
> 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
Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.