Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2003-04-09
16:01 • Closed ticket [438509ffff]: TIP#35 Patches: Serial port enhancements plus 2 ... artifact: 7bfe6fc2e2 user: schroedter
2002-03-06
04:03 • Ticket [438509ffff]: 4 changes artifact: ac922a3576 user: hobbs
2002-02-27
14:01 • Ticket [438509ffff]: 4 changes artifact: 3d5f6c9e2f user: schroedter
03:06 • Ticket [438509ffff]: 4 changes artifact: b89c4c529c user: hobbs
03:06 • Ticket [438509ffff]: 5 changes artifact: ae3a4d4b23 user: hobbs
2002-02-26
20:49 • Ticket [438509ffff]: 4 changes artifact: 80ccbf7406 user: schroedter
20:49 • Ticket [438509ffff]: 4 changes artifact: cfe31c8697 user: schroedter
20:49 • Add attachment tclUnixChan.c.patch to ticket [438509ffffffffff|438509ff... artifact: 3f4951b268 user: schroedter
03:50 • Ticket [438509ffff] TIP#35 Patches: Serial port enhancements status still Op... artifact: 6b51d72915 user: hobbs
2002-01-10
13:34 • Ticket [438509ffff]: 4 changes artifact: b2bd870388 user: schroedter
2002-01-07
18:12 • Ticket [438509ffff]: 4 changes artifact: a04a701fc2 user: schroedter
2001-12-14
14:57 • Ticket [438509ffff]: 4 changes artifact: 821905f51c user: schroedter
2001-12-13
08:11 • Ticket [438509ffff]: 4 changes artifact: e4569ba4df user: hobbs
2001-10-17
04:21 • Ticket [438509ffff]: 5 changes artifact: e742907d73 user: hobbs
2001-10-13
02:30 • Ticket [438509ffff]: 5 changes artifact: e072482a4e user: hobbs
2001-10-08
12:53 • Ticket [438509ffff]: 4 changes artifact: 9e052378f4 user: schroedter
2001-10-06
07:31 • Ticket [438509ffff]: 4 changes artifact: 49a2ce928d user: hobbs
01:15 • Ticket [438509ffff]: 1 change artifact: 6da2ca842e user: hobbs
2001-10-05
14:44 • Ticket [438509ffff]: 4 changes artifact: ad5543b5a7 user: schroedter
2001-09-24
13:59 • Ticket [438509ffff]: 4 changes artifact: 15628537c7 user: schroedter
13:59 • Add attachment tip35_patch1.0.tgz to ticket [438509ffffffffff|438509fff... artifact: 16387368f4 user: schroedter
2001-08-02
08:47 • Ticket [438509ffff] TIP#35 Patches: Serial port enhancements status still Op... artifact: 0fb9cb55bd user: hobbs
2001-07-04
19:32 • Add attachment tip32patch.tgz to ticket [438509ffff] artifact: 733825bcea user: schroedter
19:32 • Ticket [438509ffff] TIP#35 Patches: Serial port enhancements status still Op... artifact: 894ce9822f user: schroedter
19:03 • Ticket [438509ffff]: 4 changes artifact: a3ff1a9194 user: schroedter
19:03 • Add attachment tip35patch.tgz to ticket [438509ffff] artifact: 8bad228acc user: schroedter
12:03 • New ticket [438509ffff] TIP#35 Patches: Serial port enhancements. artifact: cc87461575 user: schroedter

TIP#35 Patches: Serial port enhancements

Closed438509ffffffffffffffffffffffffffffffffffCreated 25 years agoUpdated 24 years ago
Descriptionplain2001-07-04 12:03:50
The attached tar.gz file contains patches for 
TIP#35: Enhanced Support for Serial communications.

Affected systems: Windows and Unix (termios.h).
The changes have been tested under 
    Windows 95/98/NT4.0/2000
    Linux (Suse7.1).

Unix system file patches:
    tclUnixChan.c

The following options are added to the fconfigure 
command for serial ports:
    -handshake none|rtscts|xonxoff
        Setup automatic handshake
    -xchar
        Query xon/xoff characters
    -xchar {xonChar xoffChar}
        Setup xon/xoff characters
    -timeout msec
        Setup read timeout, granularity = 100 msec
    -ttycontrol {RTS 1 DTR 0 BREAK 1}
        Control RS-232 handshake output lines
    -ttystatus
        Query RS-232 handshake input lines,
        returns e.g. {CTS 1 DSR 0 RING 1 DCD 0}
    -queue
        Query number of bytes in the system input
        and output queues, returns a list of 2 int's,
        e.g. {25 87}

For Windows the following options are
implemented:
    -handshake none|dtrdsr|rtscts|xonxoff
        Setup automatic handshake
    -sysbuffer {inBufSize outBufSize}
        Setup the system buffer sizes for serial I/O.
    -xchar
    -xchar {xonChar xoffChar}
    -timeout msec
    -ttycontrol {RTS 1 DTR 0 BREAK 1}
    -ttystatus
    -queue

For Windows the following files are affected:

tclWinPort.h
    Declare a new function TclWinSerialReopen()

tclWinChan.h
    Call TclWinSerialReopen() after detecting the
    serial port.

tclWinSerial.c
    Partial rewrite of Tcl's serial driver. 
    The current implementation only performs blocking
    output. Added [fconfigure] options.

The following doc files are patched:

fconfigure.n
    Serial [fconfigure] options are now documented 
    here.

open.n
    Serial port filenames are documented here.
    Added a link to [fconfigure] for additional serial 
    options.
   
The attached file tip35patch.tgz contains patches
(diff -c file.old file.new > file.patch)
against the Tcl8.4a2 sources.

The patch file for tclWinSerial.c is larger 
than the original file. 
Therefore both files are attached:
    tclWinSerial.c
    tclWinSerial.c.patch
schroedterplain2001-07-04 19:03:51
File Added - 8066: tip35patch.tgz
schroedterplain2001-07-04 19:32:40
File Added - 8067: tip32patch.tgz

Logged In: YES 
user_id=99573

Sorry, I touched tclUnixChan.c with a DOS editor,
therefore the diff file became too large.
I hope for tclUnicChan.c the following diff is better:

diff -c --ignore-all-space f.old f.new > f.patch
hobbsplain2001-08-02 08:47:55
Logged In: YES 
user_id=72656

Are these now complete following the vote on TIP #35?
schroedterplain2001-09-24 13:59:17
File Added - 11131: tip35_patch1.0.tgz
schroedterplain2001-10-05 14:44:36
Logged In: YES 
user_id=99573

The patches are now complete following TIP#35.
Latest file: tip35_patch1.0.tgz
(Somehow I'm unable to delete the older files ...)

IMO it should be not a problem to backport them
to the upcoming Tcl 8.3.4 release.

Rolf.
hobbs Ticket [438509ffff]: 1 change [History diff]2001-10-06 01:15:22
hobbsplain2001-10-06 07:31:40
Logged In: YES 
user_id=72656

Are there any tests that we can safely make to ensure that 
this features works (on unix and/or windows)?
schroedterplain2001-10-08 12:53:49
Logged In: YES 
user_id=99573

For real tests you'll need hardware (a loopback connector,
a second PC sending data, producing overruns & handshake).
I've tested it here for Linux, Win2k/NT/98/95.

The handshake itself is performed by the OS driver.
Tcl provides only the [fconfigure] interface to the 
corresponding OS calls ioctl() or SetCommState().
The only new *code* is the writer thread for windows,
supporting non-blocking writes.
hobbsplain2001-10-13 02:30:56
Logged In: YES 
user_id=72656

These do not compile on an HP with uname:

HP-UX llbertha B.11.00 U 9000/800 2002402864

where the original sources are OK.  It complains about the 
lack of certain definitions.  Windows went OK, as did 
Linux.  However, looking through the patch, it can't 
compile if USE_TERMIOS isn't 1 (which is possible).  The 
TTYFLUSH was created only for USE_TERMIOS, and there may be 
a few other tidbits lying in wait like that.
hobbsplain2001-10-17 04:21:39
Logged In: YES 
user_id=72656

I have applied the Windows portions of this to 8.4a4cvs 
(this is targeted for 8.4, not 8.3.x).  We need to work on 
tclUnixChan.c so that it compiles cleanly across systems 
(although it may only have the serial enhancements on good 
posix systems).
hobbsplain2001-12-13 08:11:32
Logged In: YES 
user_id=72656

OK, Rolf noted that sys/modem.h is needed on HP, and 
perhaps other platforms.  We need an up-to-date patch 
against the current sources that also makes use of 
HAVE_SYS_MODEM_H (add AC_CHECK_HEADER(sys/modem.h) to 
SC_SERIAL_PORT in tcl.m4).  We also need to make sure that 
all the cases are covered when USE_TERMIOS isn't true.
schroedterplain2001-12-14 14:57:20
File Added - 14693: tclUnixChan.c.patch

Logged In: YES 
user_id=99573

I can contribute a better patch for tclUnixChan which should 
meet the 2nd point, when USE_TERMIOS isn't true.
But I don't have access to Unix systems other than Linux, 
Sparc.
Nor I'm familiar with autoconf.

Who can help ?
Rolf.
schroedterplain2002-01-07 18:12:50
File Added - 15614: tclUnixChan.c.patch

Logged In: YES 
user_id=99573

The TIP#35 implementation for Unix contains the same bug
as described for bug#500348:
TtySetOptionProc() shouldn't modify it's 'value' argument.

The new patch file is attached.
schroedterplain2002-01-10 13:34:25
File Added - 15784: tclUnixChan.c.patch

Logged In: YES 
user_id=99573

Following a comment from Andreas Kupries, this patch
should use strncasecmp() instead of defining a new strCaseEqu().
hobbsplain2002-02-26 03:50:31
Logged In: YES 
user_id=72656

This patch doesn't apply against the current sources.  Can 
we get an updated version of this?  It seems to be based on 
quite old sources actually.

Also, this still doesn't address cleanly excising the code 
if support isn't available (in the USE_SGTTY or USE_TERMIO 
cases).  The compile will just barf on the non-existent 
#defines then.  Thus the patch really isn't complete.
schroedterplain2002-02-26 20:49:02
Logged In: YES 
user_id=99573

The patch from january doesn't apply, because its "too old". There were lot of changes (TIP#27) since then 
(TIP#27). I remade the changes. The patch file is attached.

Non-POSIX systems: Should compile and run without the TIP#35 enhancements.
To make it clear: The TIP#35 enhancements are Windows and TERMIOS (POSIX) only.

IMO I put everything into #ifdef's, so it should compile also for USE_TERMIO and USE_SGTTY systems.
I did it to the *best of my knowledge* without having such a system.
So if there are problems, please give me a precise error message.
schroedterplain2002-02-26 20:49:06
File Added - 18460: tclUnixChan.c.patch
hobbsplain2002-02-27 03:06:00
Logged In: YES 
user_id=72656

added the necessary config stuff for HPs, tested on AIX-
4.3/rs6000, Solaris 2.6 and 2.8, Linux 2.2 and 2.4.

This still needs more docs and (perhaps conditional) tests, 
but the code is in the 8.4a4cvs.  I'm leaving it open for 
docs and tests, and perhaps a Mac version.  If we don't get 
any Mac version, that must be clearly stated in the docs.
hobbsplain2002-02-27 03:06:01
File Deleted - 14693:
schroedterplain2002-02-27 14:01:15
Logged In: YES 
user_id=99573

Thanks, Jeff.

There is no Mac version for TIP#35 and no Non-Posix version (TERMIO,SGTTY).
IMO this is clearly stated in the docs (fconfigure.n, large section on serial communications).

Tests are a problem because for monitoring handshake signals you'll need either a 2nd PC
with a proper cable (many NULL-modem cables are only 3 lines), a breakout box and/or a loopback 
connector.
hobbsplain2002-03-06 04:03:17
Logged In: YES 
user_id=72656

The unix implementation introduced bug 525783 
(http://sourceforge.net/tracker/?
func=detail&atid=110894&aid=525783&group_id=10894).

The problem was the use of tcflush that throws away data on 
exit.  This should really only be done on true serial 
channels, if it is a problem.  I've reverted that behavior 
for now (8.4a4), but it must be revisited.
schroedter Closed ticket [438509ffff]. [History diff]2003-04-09 16:01:36
Log in (anonymous is fine) to add a comment.

Attachments: