Skip site navigation (1)Skip section navigation (2)
Date:      Tue,  8 Aug 2000 14:11:00 -0700 (PDT)
From:      r_chipi@yahoo.com
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   ports/20490: Termios timeout parameters, VMIN, VTIME, dont work with Python.
Message-ID:  <20000808211100.6472837B765@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         20490
>Category:       ports
>Synopsis:       Termios timeout parameters, VMIN, VTIME, dont work with Python.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Aug 08 14:20:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Ramiro Chipi
>Release:        4.1-RELEASE
>Organization:
>Environment:
FreeBSD rc-fbsd.ote.racal.com 4.1-RELEASE FreeBSD 4.1-RELEASE #0: Thu Jul 27 04:44:16 GMT 2000     root@usw4.freebsd.org:/usr/src/sys/compile/GENERIC  i386

>Description:
When using VMIN = 0 and VTIME > 0 to control receiver timeout
in Python, it does not work as it should.  For example, programming
VMIN = 0 and VTIME = 200 should make a read block for at least 20 seconds
or until a character is received, however, the read does not block and
returns immediately.  When a similar routine is written in C it works
as it should.
>How-To-Repeat:
To reapeat write the following test code:

# This code does not work

import os
from TERMIOS import *
from tty import *

fd = os.open("/dev/cuaa1", os.O_RDWR)
attrs = tcgetattr(fd)
attrs[CFLAG] = CS8 | CLOCAL | CREAD
attrs[OFLAG] = attrs[OFLAG] & ~OPOST
attrs[LFLAG] = 0
attrs[CC][VMIN] = 0
attrs[CC][VTIME] = 200
tcsetattr(fd, TCSANOW, attrs)


print os.read(fd, 80)

/* the equivalent test in C works as it should */
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <fcntl.h>


main()
{
    struct termios term;
    int fd, bytes;
    char buf[80];

    fd = open("/dev/cuaa1", O_RDWR);
    if (fd < 0)
    {
        perror("open");
        return 1;
    }

    tcgetattr(fd, &term);
    term.c_cflag = CS8 | CREAD | CLOCAL;
    term.c_oflag &= ~OPOST;
    term.c_lflag = 0;
    term.c_cc[VMIN] = 0;
    term.c_cc[VTIME] = 200;
    tcsetattr(fd, TCSANOW, &term);

    bytes = read(fd, buf, 40);
    buf[bytes] = 0;
    puts(buf);
    return 0;

}




>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000808211100.6472837B765>