From owner-freebsd-ports Tue Aug 8 14:20: 6 2000 Delivered-To: freebsd-ports@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 213B537BB2A for ; Tue, 8 Aug 2000 14:20:01 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id OAA88033; Tue, 8 Aug 2000 14:20:00 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: by hub.freebsd.org (Postfix, from userid 32767) id 6472837B765; Tue, 8 Aug 2000 14:11:00 -0700 (PDT) Message-Id: <20000808211100.6472837B765@hub.freebsd.org> Date: Tue, 8 Aug 2000 14:11:00 -0700 (PDT) From: r_chipi@yahoo.com To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: ports/20490: Termios timeout parameters, VMIN, VTIME, dont work with Python. Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >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 #include #include #include 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