From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13850 invoked by alias); 16 Jul 2015 04:13:27 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 13839 invoked by uid 89); 16 Jul 2015 04:13:27 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.6 required=5.0 tests=AWL,BAYES_50,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-wi0-f182.google.com Received: from mail-wi0-f182.google.com (HELO mail-wi0-f182.google.com) (209.85.212.182) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 16 Jul 2015 04:13:25 +0000 Received: by wibxm9 with SMTP id xm9so2166397wib.0 for ; Wed, 15 Jul 2015 21:13:23 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.194.103.130 with SMTP id fw2mr15526375wjb.121.1437020002920; Wed, 15 Jul 2015 21:13:22 -0700 (PDT) Received: by 10.28.131.67 with HTTP; Wed, 15 Jul 2015 21:13:22 -0700 (PDT) Date: Thu, 16 Jul 2015 04:13:00 -0000 Message-ID: Subject: Serial Port communication issues in Cygwin From: J Kohn To: cygwin@cygwin.com Content-Type: text/plain; charset=UTF-8 X-SW-Source: 2015-07/txt/msg00258.txt.bz2 Hello, I am trying to use Cygwin to automate some testing of an external device. The external device communicates to the PC running Cygwin over a serial cable at 115200 baud. I have been able to manually send and receive data from the external device using PuTTY, Teraterm, and Powershell, but I am having troubles doing the same with Cygwin. These are the commands I am using in Cygwin to initialize the serial port, open it for read and write, and capture the output: stty -F /dev/ttyS2 speed 115200 exec 4<> /dev/ttyS2 cat <&4 > /cygdrive/c/path/to/file When I execute those commands, and power on the device, I receive nothing. The file remains empty. If I then close Cygwin and immediately open PuTTY or Teraterm or Powershell to the correct serial port, I start receiving correct/valid data. I attempted opening the serial port only for read, but that did not work. If I open a PuTTY session first (to use PuTTY to set the correct parameters for the serial port), and then open the serial port with Cygwin and cat the output, I again receive nothing. The one way that I have been able to correctly read data in from the serial port with Cygwin is if I replace file descriptor 4 in my above exec command with file descriptor 0. If I run that command (exec 0<> /dev/ttyS2), I am no longer able to manually type anything into the terminal window, but if I power on my external device, each line of text from the device is read in correctly, but, obviously, that is not very useful to me for my testing... If it helps, the serial port configuration in cygwin after opening/closing the serial port with PuTTY: $ stty -F /dev/ttyS2 speed 115200 baud; line = 0; intr = ; quit = ; erase = ; kill = ; eof = ; swtch = ; susp = ; rprnt = ; werase = ; lnext = ; flush = ; min = 0; time = 0; -cread -brkint -icrnl ixoff -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke I have tried this with the latest download of cygwin, and I've tried it with older versions. I have tried using the 32bit and 64bit versions. My device is doing a BIOS boot to an EFI shell, where I'd like to enter in some test commands, and then I would be doing a pxe boot of a custom linux. The BIOS boot, test commands, and pxe boot are all dumping data over the serial port. I'd like to be able to capture and monitor that output with cygwin in an automated fashion, but I am having issues with reading that data in with Cygwin. Can someone help me figure out or understand why I am unable to read data in from the serial port with cygwin except with file descriptor 0, but I am able to read/write the serial port with PuTTY, Teraterm, and Powershell? Thanks! --Jesse -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple