X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; q=dns; s=default; b=mZXPBiKHqPD73mhHF5qgL0+Gg5+fO FZnfsMmiM9XJRrjJZhW7toQ3oDLHXBRawFtfdTZ/C3m/Nr7ckwMJYUEsBZk8MgiG CEUwc62Njhcce2PcqdR7mkOnCVBo0gMIoDdG5th5pL5Yj7N5nxEPcCqtrWJ7u3eN cqkakcK7ugmkZk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:date:message-id:subject:from:to :content-type; s=default; bh=tTywPbO8Bv3H5g58gs2j3mpOTtw=; b=FJu 9u93/t83X1T4GKkXROLF86VupnbSVSeszkbQnpeo3i370shFe8sjX8i3ihZzNLhh /xd8cChutswL/qrvZfbvax0mSGAUqASyej9TYrsSuDQvxyaeIjdh2Ch6RGSWzcQP 2VR421Sag01oM1Rdb1PI6lL3CG9bpjJjPZm4fdI4= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 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 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) Date: Wed, 15 Jul 2015 23:13:22 -0500 Message-ID: Subject: Serial Port communication issues in Cygwin From: J Kohn To: cygwin AT cygwin DOT com Content-Type: text/plain; charset=UTF-8 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