Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Subject: FW: Bug in the /dev/ttySx handling code? Date: Mon, 9 May 2005 13:16:49 -0500 Message-ID: <14CEE0B69DBDFC41A192613D8B4098CA01434287@XCH-CORP.staktek.com> From: "Terry Dabbs" To: X-Spam-Score: -0.9 X-Spam-Flag: NO X-Spam-Report: -0.9 points, 5.0 required * -1.0 BAYES_00 BODY: Bayesian spam probability is 0 to 1% * [score: 0.0000] * 0.1 AWL AWL: From: address is in the auto white-list X-Spam-Processed-By: dbcheck.staktek.com X-IsSubscribed: yes Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id j49IHEFb026973 It appears you are using com1, with this command: stty -F /dev/ttyS0 -a But, your strace shows ttyS1, which is com2. Are you plugged into the proper port with your cable? T. Dabbs Subject: Bug in the /dev/ttySx handling code? I compiled a linux program, which uses the serial driver (and is working) under cygwin (winxp), but the communication was not working. For initializing the port, I use: fd = open (dev, O_RDWR | O_NOCTTY); tcgetattr (fd, &t1); t1.c_cflag = B19200 | CS8 | PARENB | CLOCAL | CREAD; t1.c_iflag = IGNBRK | INPCK | ISIG; t1.c_oflag = 0; t1.c_lflag = 0; t1.c_cc[VTIME] = 1; t1.c_cc[VMIN] = 0; tcsetattr (fd, TCSAFLUSH, &t1); Then normal read/write to the file descriptor follows. strace logged: 47 22132 [main] eibd 3124 fhandler_serial::open: fhandler_serial::open (/dev/ttyS1, 0x8002, 0xF78) 101 22233 [main] eibd 3124 fhandler_base::open_9x: (\\.\com2, 0x8002) 1415 23648 [main] eibd 3124 fhandler_base::set_flags: flags 0x8002, supplied_bin 0x10000 59 23707 [main] eibd 3124 fhandler_base::set_flags: filemode set to binary 42 23749 [main] eibd 3124 fhandler_base::open_9x: 0x6C8 = CreateFile (\\.\com2, 0xC0000000, 0x7, 0x22E990, 0x3, 0x40000080, 0) 44 23793 [main] eibd 3124 fhandler_base::open_9x: 1 = fhandler_base::open (\\.\com2, 0x8002) 97 23890 [main] eibd 3124 fhandler_serial::open: 0x1 = fhandler_serial::open (/dev/ttyS1, 0x8002, 0xF78) 45 23935 [main] eibd 3124 open: 5 = open (/dev/ttyS1, 0x8002) 85 24020 [main] eibd 3124 fhandler_serial::tcgetattr: vmin_ 0, vtime_ 0 41 24061 [main] eibd 3124 tcgetattr: iflag 4, oflag 0, cflag 930, lflag 0, VMIN 0, VTIME 0 75 24136 [main] eibd 3124 fhandler_serial::tcgetattr: vmin_ 0, vtime_ 0 46 24182 [main] eibd 3124 tcgetattr: iflag 4, oflag 0, cflag 930, lflag 0, VMIN 0, VTIME 0 57 24239 [main] eibd 3124 fhandler_serial::tcsetattr: action 1 55 24294 [main] eibd 3124 fhandler_serial::tcsetattr: flushed file buffers 210 24504 [main] eibd 3124 fhandler_serial::tcsetattr: vtime 100, vmin 0 42 24546 [main] eibd 3124 fhandler_serial::tcsetattr: ReadTotalTimeoutConstant 100, ReadIntervalTimeout -1, ReadTotalTimeoutMultiplier -1 56 24602 [main] eibd 3124 tcsetattr: iflag 0x11, oflag 0x0, cflag 0x9BE, lflag 0x0, VMIN 0, VTIME 1 43 24645 [main] eibd 3124 tcsetattr: 0 = tcsetattr (5, 1, 22EDF0) A printf of the return code of tcsetattr returned 0. I connected the program using a null modem cable to an other Linux machine. It turned out, that cygwin configured the serial interface to 9600 baud. With this configuration, I can send without any errors data on the linux PC to the cygwin program (and back): stty -F /dev/ttyS0 -a speed 9600 baud; rows 0; columns 0; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = ; eol2 = ; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 1; time = 5; parenb parodd cs8 -hupcl -cstopb cread clocal -crtscts ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0 -isig -icanon -iexten -echo -echoe -echok -echonl -noflsh -xcase -tostop -echoprt -echoctl -echoke On cygwin, stty on the serial is not working (stty -F /dev/ttyS0 shows 0 baud; stty -F /dev/ttyS0 speed 9600 returns an error message). Is the serial driver emulation code not supporting this, or is there an bug in it? mfg Martin Kögler PS: Please CC me on replies -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/