X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Message-ID: <95455e980805011638m16bde7fpa06ff16ba9e82f68@mail.gmail.com> Date: Fri, 2 May 2008 09:38:39 +1000 From: hce To: cygwin AT cygwin DOT com Subject: Problem with Linux serial port MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline X-IsSubscribed: yes 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 Hi, I have a small program running data transfer on serial port. Ironically, the serial port data transfer works smoothly on Cygwin window much better than the linux. On linux, the transfer data on serial port can be freezed intermittently, which does not happen on Cygwin window. Has anyone know why and how to fix it? I am using an open source serial port program from Brian J. Hennings, using native read, write and select. I suspect that the problem is likely introduced by following port configuration: int OpenPort (char *port) { int err; struct termios options, old_options; //Setup Serial fprintf(stderr,"Open Comms on port %s\n", port); if ( (Serial = open ( port , O_RDWR | O_NONBLOCK | O_SYNC ) ) == -1) { fprintf(stderr, "Cannot Open Comms - %s errno = %d\n", port, errno); return -errno; } tcgetattr(Serial,&options); memset (&options, 0,sizeof(options)); options.c_cflag &= ~PARENB; // no parity options.c_cflag &= ~CSTOPB; // one stopbit options.c_cflag &= ~CRTSCTS; // No hardware flow control. options.c_cflag &= IXON; options.c_cflag &= IXOFF; options.c_cflag &= CSIZE; options.c_cflag |= CS8; // 8N1 options.c_cflag |= (CLOCAL | CREAD); // enable Localmode, receiver options.c_cc[VMIN] = 0; // set min read characters if 0 // VTIME takes over options.c_cc[VTIME] = V_TIME; // wait V_TIME ms for character err = cfsetospeed(&options, B115200); if (err < 0) { printf ("Could not set output speed! Error = %d\n", err); close (Serial); return -1; } /*End of if*/ err = cfsetispeed(&options, B115200); if (err < 0) { printf ("Could not set input speed! Error = %d\n", err); close (Serial); return -1; } /*End of if*/ if (tcsetattr(Serial,TCSANOW, &options) < 0) { printf ("Failed to set Serial port options!\n"); close (Serial); return -1; } /*End of if*/ tcflush (Serial, TCIOFLUSH); fprintf(stderr, "Port %s OPENED \n", port); return 0; } /*End of OpenPort ()*/ Thank you. Kind Regards, Jim -- 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/