RTS/CTS and DTR/DTS control

Discussion in 'Python' started by Mike, Jul 4, 2003.

  1. Mike

    Mike Guest

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

    Thanks
    Mike, Jul 4, 2003
    #1
    1. Advertising

  2. "Mike" <> wrote in
    news:p:

    > 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).
    Howard Lightstone, Jul 4, 2003
    #2
    1. Advertising

  3. Mike

    Mike Guest

    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
    Mike, Jul 4, 2003
    #3
  4. Mike

    Peter Hansen Guest

    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
    Peter Hansen, Jul 5, 2003
    #4
  5. Mike

    Peter Hansen Guest

    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
    Peter Hansen, Jul 5, 2003
    #5
  6. Mike

    Peter Hansen Guest

    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
    Peter Hansen, Jul 5, 2003
    #6
    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. Jason Cochran

    SQL Server 2000 DTS and ActivePerl

    Jason Cochran, Dec 2, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    353
    Jason Cochran
    Dec 2, 2003
  2. tfs

    ASP and DTS Packages

    tfs, Jun 30, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    443
  3. Replies:
    2
    Views:
    415
    Joe Greer
    Apr 23, 2008
  4. Klaus Kleiner

    Setting RTS with Win32::SerialPort

    Klaus Kleiner, Feb 14, 2005, in forum: Perl Misc
    Replies:
    1
    Views:
    218
    Ron Savage
    Feb 16, 2005
  5. jshanman

    Endgame RTS on Google Maps (BETA)

    jshanman, Aug 9, 2006, in forum: Javascript
    Replies:
    3
    Views:
    91
    jshanman
    Aug 11, 2006
Loading...

Share This Page