mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "David L" <idht4n@hotmail.com>
To: linux-kernel@vger.kernel.org
Subject: Re: serial port canonical mode weirdness?
Date: Thu, 01 Apr 2004 07:45:19 -0800	[thread overview]
Message-ID: <BAY2-F59A7JVwzf8pTL0003f16c@hotmail.com> (raw)

> > When I configure a serial port for canonical mode (newtio.c_lflag = 
>ICANON),
> > I get behavior that isn't what I'd expect.
>
>Can you supply the test program you're using on the receive end?
>
>--
#include <termios.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>

#define BAUDRATE B38400
#define SERIALDEVICE "/dev/ttyS0"

int main()
{
  int fd, res;
  struct termios newtio;
  unsigned char buf[10000];

  fd = open(SERIALDEVICE, O_RDWR);
  if (fd <0) {perror(SERIALDEVICE); return -1; }

  bzero(&newtio, sizeof(newtio));

  newtio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD;
  newtio.c_iflag = IGNPAR;
  newtio.c_lflag = ICANON;

  newtio.c_cc[VEOL]     = 0x0D;

  tcsetattr(fd,TCSANOW,&newtio);

  while (1) {
    res = read(fd,buf,9000);
    printf("%d bytes read (%d)\n", res, errno);
    printf("%02X %02X %02X %02X %02X %02X\n", 
buf[0],buf[1],buf[2],buf[3],buf[4],buf[5]);
  }
}

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.com/go/onm00200415ave/direct/01/


             reply	other threads:[~2004-04-01 15:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-01 15:45 David L [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-04-01  0:44 David L
2004-04-01  8:28 ` Russell King
2004-04-02 22:02 ` Russell King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BAY2-F59A7JVwzf8pTL0003f16c@hotmail.com \
    --to=idht4n@hotmail.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®