Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > RTS/CTS and DTR/DTS control

Reply
Thread Tools

RTS/CTS and DTR/DTS control

 
 
Mike
Guest
Posts: n/a
 
      07-04-2003
Is there a library in Python that will give me control over the
handshaking lines directly?

Thanks
 
Reply With Quote
 
 
 
 
Howard Lightstone
Guest
Posts: n/a
 
      07-04-2003
"Mike" <(E-Mail Removed)> wrote in
news(E-Mail Removed):

> Is there a library in Python that will give me control over the
> handshaking lines directly?
>
> Thanks
>


For Windoze, I heartily recommend siomodule.
( http://starship.python.net/crew/roger )

This is a wrapper around a well-designed professional serial I/O package.
The Python version includes the dll for free (when used with Python).
 
Reply With Quote
 
 
 
 
Mike
Guest
Posts: n/a
 
      07-04-2003

I am running Linux, Python 2.2.2. It would be nice (not mandatory)
to be cross platform though.

Thanks,
Mike

On Fri, 04 Jul 2003 18:30:11 +0000, Mike wrote:

> Is there a library in Python that will give me control over the
> handshaking lines directly?
>
> Thanks


 
Reply With Quote
 
Peter Hansen
Guest
Posts: n/a
 
      07-04-2003
Mike wrote:
> > Is there a library in Python that will give me control over the
> > handshaking lines directly?

> I am running Linux, Python 2.2.2. It would be nice (not mandatory)
> to be cross platform though.


You call them handshaking lines, so one might infer you want
to use them as such while doing serial communications. Are
you in fact actually planning to control them as discrete
inputs and outputs, for some kind of control application?
(If not, I'm curious why you want to control them directly.)

There is Chris Liechti's library, which you can find with
http://www.google.com/search?q=python+serial+port but I'm
not sure it supports direct control of the I/Os... if it
doesn't you should be able to get direct control of those
lines under Linux using appropriate fcntl.ioctl() calls, I
would think, though I haven't done it myself.

-Peter
 
Reply With Quote
 
Peter Hansen
Guest
Posts: n/a
 
      07-05-2003
Mike wrote:
>
> On Fri, 04 Jul 2003 19:36:45 -0400, Peter Hansen wrote:
>
> > Mike wrote:
> >> > Is there a library in Python that will give me control over the
> >> > handshaking lines directly?

>
> I actually want to control my X10 firecracker device. I have done it in
> Java (on Windows) already but now I want to do it in Python on Linux. You
> control the device by wiggling the control lines with certain patterns.


Okay, that helps. Are there any tight timing constraints with X10?
It's been a while since I looked at the specs. Pretty low data rate,
isn't it?

Here's a few snippets/ideas that might help get you started, if there's
nothing off the shelf:

From inside a "SerialPort" class we've built, which is lacking
what you need but has some pieces that might be relevant:

class SerialPort:

def some method():
self.port = os.open(self.portName, os.O_RDWR | os.O_NOCTTY )


def CD(self):
'''retrieve CD status'''
status = fcntl.ioctl(self.port, TIOCMGET, TIOCM_zero_str)
value = struct.unpack('I', status)[0] & TIOCM_CD
if value > 0:
return 1
else:
return 0

At the top, we have some ugly constants defined, probably grabbed from
various web pages/google searches on Linux serial ports:

-------------
# The following may be Linux specific
TIOCM_CD = 0x040
TIOCM_CAR = 0x040
TIOCMGET = 0x5415
TIOCMSET = 0x5418

# The following is used to convert between C's long to Python's int.
TIOCM_zero_str = struct.pack('I', 0)
-------------

A quick search again with Google using TIOCMSET and TIOCM_CTS and a bunch
of others finally led to this, which might be the best yet, and includes
some constant definitions that might let you get something working, if
this doesn't directly solve your problem:

http://sparc.dnsalias.net/Python_stuff/PosixSerial.py

Good luck!

-Peter
 
Reply With Quote
 
Peter Hansen
Guest
Posts: n/a
 
      07-05-2003
Peter Hansen wrote:
>
> A quick search again with Google using TIOCMSET and TIOCM_CTS and a bunch
> of others finally led to this, which might be the best yet, and includes
> some constant definitions that might let you get something working, if
> this doesn't directly solve your problem:
>
> http://sparc.dnsalias.net/Python_stuff/PosixSerial.py


Look at the main site... you might find something else of interest there. <wink>

-Peter
 
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
User Control to Control Other User Control Jonathan Wood ASP .Net 4 02-02-2010 03:41 PM
Control, Web Control and Composite Control shapper ASP .Net 6 12-26-2007 02:49 PM
persisting changes to a control outside a user control from the user control? Mad Scientist Jr ASP .Net 0 03-22-2006 08:02 AM
HTML Client Control versus. HTML Server Control versus. Web Server Control Matthew Louden ASP .Net 1 10-11-2003 07:09 PM
Using Table control in a custom composite control. Control does not render properly in design time. jb_in_marietta@yahoo.com ASP .Net 0 07-01-2003 09:26 PM



Advertisments