[portland] Request for Comments on Python USB CDC Library Code

Ron Jackson Ron at FascinatingElectronics.com
Fri Jun 20 20:40:11 CEST 2008


Hi All,

I am working on a series of devices that attach to a computer through
USB and show up as CDC (communications device class) ports. On Windows
they show up as legacy comm ports (COMx), though on Linux and OS-X
they show up as modem-type devices.

Because much of the usual serial library detritus doesn't apply, and
because there are USB issues that I want to handle elegantly (such as
USB suspends and device disconnects), I have written a Python library
specific to these devices. Actually, I've written the Windows version,
and a buddy of mine who is a Linux kernel hacker is writing the port
for Linux and OS-X.

As an example of using this library I created a simple terminal
emulation program.

All of this code works (or at least seems to). You can't run it anyway
without the target hardware, so I'm not asking for help debugging.

Python is a language with it's own style and idioms, and as I'll be
distributing this widely (I hope) I'd like to have this code display
good Python coding practice.

I've attached the code for uTerm.py and the feusb package files
__init__.py and feusb_win32.py. Yeah, it is kinda long. Sorry. Could I
get some suggestions from the group about how to improve this code?

Thanks for the help!

 -- Ron
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: uTerm.py
URL: <http://mail.python.org/pipermail/portland/attachments/20080620/dc90ef4d/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: __init__.py
URL: <http://mail.python.org/pipermail/portland/attachments/20080620/dc90ef4d/attachment-0001.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: feusb_win32.py
URL: <http://mail.python.org/pipermail/portland/attachments/20080620/dc90ef4d/attachment-0002.txt>


More information about the Portland mailing list