From: Marc Karasek <marc_karasek@ivivity.com>
To: "'Richard B. Johnson '" <root@chaos.analogic.com>,
Marc Karasek <marc_karasek@ivivity.com>
Cc: "'linux-kernel@vger.kernel.org'" <linux-kernel@vger.kernel.org>
Subject: RE: Bug in serial.c
Date: Thu, 19 Apr 2001 12:18:26 -0400 [thread overview]
Message-ID: <25369470B6F0D41194820002B328BDD27C93@ATLOPS> (raw)
I think maybe we have a miscommunication here.. I am not running any apps
(yet) all I am trying to do is get it to boot up under 2.4.3. The
apps/daemons/modules are the next step. I am just booting the standard
kernel to a login prompt. (I am usng busybox for init.) Before a login
prompt a script is run as part of inittab to setup the eth0 port, etc...
This requires some input from the console (in this case ttyS0). It is at
this point that 2.4.2 works (accepts input and lets the script continue)
2.4.3 just sits there, you can bang on the keys all you want :-(
Also, I did a diff between serial.c in 2.4.2 & 2.4.3 and there are a lot of
changes...
-----Original Message-----
From: Richard B. Johnson
To: Marc Karasek
Sent: 4/19/01 12:07 PM
Subject: RE: Bug in serial.c
On Thu, 19 Apr 2001, Marc Karasek wrote:
> Did something change between 2.4.2 & 2.4.3? Under 2.4.2 I did not
have to
> init the terminal (are you refering to the host or client side?) and
just
> accepted the defaults (9600, 8n1) which was fine for debug and
terminal I/O.
>
>
> My issue is with 2.4.2 it works with 2.4.3 (same .config) it does not.
So
> in my mind this is a bug of some type..... :-)
>
> Which kernel are you using in your embedded project??
>
I have conditional compiles for 2.2.17 to 2.2.19 plus 2.4.1, 2.4.2,
2.4.3, 2.4.4-pre(something, maybe 4).
There have been a lot of changes (and bugs), but Serial TTY I/O has
not been one of them -- and I use RS-232C with ANSI escape sequences
(vt101 DEC), because we don't have a screen-card or a keyboard. I
would have been first to notice.
Of course my code DID initialize the terminal from the start, if yours
didn't, the defaults may have changed. There was an old bug with
flow-control (an X-OFF stuck-state), that required the terminal
to opened and closed twice to clear. I still have the work-around
in the init code.
/*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-=-*/
/*
* Since we __are__ init, we have to everything that is necessary to
* startup and maintain the system.
*/
int main(int argc, char *argv[])
{
MEM *mem;
size_t i;
int fd, flags;
speed_t baud;
if((mem = (MEM *) malloc(sizeof(MEM))) == NULL)
ERRORS(Malloc);
strcpy(argv[0], "Platinum");
argv[0] = mem->argv0;
argv[1] = mem->argv1;
argv[2] = NULL;
/*-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
-=-*/
/*
* We may have failed to open an initial console. Therefore, we do the
* terminal stuff over from scratch.
*/
clr(&mem->st, sizeof(struct termios));
mem->st.c_cc[VINTR] = (char) 'C' - 64;
mem->st.c_cc[VQUIT] = (char) '\\'- 64;
mem->st.c_cc[VERASE] = (char) '?' + 64;
mem->st.c_cc[VKILL] = (char) 'U' - 64;
mem->st.c_cc[VEOF] = (char) 'D' - 64;
mem->st.c_cc[VTIME] = (char) 0;
mem->st.c_cc[VMIN] = (char) 1;
mem->st.c_cc[VSWTC] = (char) '@' - 64;
mem->st.c_cc[VSTART] = (char) 'Q' - 64;
mem->st.c_cc[VSTOP] = (char) 'S' - 64;
mem->st.c_cc[VSUSP] = (char) 'Z' - 64;
mem->st.c_cc[VEOL] = (char) '@' - 64;
mem->st.c_cc[VREPRINT] = (char) 'R' - 64;
mem->st.c_cc[VDISCARD] = (char) 'O' - 64;
mem->st.c_cc[VWERASE] = (char) 'W' - 64;
mem->st.c_cc[VLNEXT] = (char) 'V' - 64;
mem->st.c_cc[VEOL2] = (char) '@' - 64;
mem->st.c_oflag = OPOST|ONLCR;
mem->st.c_iflag = ICRNL|IXON;
mem->st.c_lflag =
ISIG|ICANON|ECHO|ECHOE|ECHOK|ECHOCTL|ECHOKE|IEXTEN;
mem->st.c_cflag = B9600|CS8|CREAD|HUPCL|CLOCAL;
/*
* Because of a bug in the Linux 2.4.0 terminal driver, we have to do
* this twice to get the flow-control turned off.
*/
for(i=0; i< 2; i++)
{
(void)close(STDIN_FILENO);
(void)close(STDOUT_FILENO);
(void)close(STDERR_FILENO);
if((fd = open(stdcmd, O_RDWR|O_NDELAY, 0)) < 0)
fd = open(Altcons, O_RDWR|O_NDELAY);
if((flags = fcntl(fd, F_GETFL, 0)) == FAIL)
ERRORS(Fcntl);
flags &= ~O_NDELAY;
if(fcntl(fd, F_SETFL, flags) == FAIL)
ERRORS(Fcntl);
if(!!fd)
{
if(dup2(fd, STDIN_FILENO) == FAIL)
ERRORS(Dup2);
if(dup2(fd, STDOUT_FILENO) == FAIL)
ERRORS(Dup2);
if(dup2(fd, STDERR_FILENO) == FAIL)
ERRORS(Dup2);
if(fd > 2) (void)close(fd);
}
else /* fd is STDIN_FILENO */
{
if(dup(fd) == FAIL) /* Make STDOUT_FILENO */
ERRORS(Dup);
if(dup(fd) == FAIL) /* Make STDERR_FILENO */
ERRORS(Dup);
}
if(tcflush(STDIN_FILENO, TCIFLUSH) < 0)
ERRORS(Tcflush);
if(tcsetattr(STDIN_FILENO, TCSANOW, &mem->st) < 0)
ERRORS(Tcsetattr);
}
Cheers,
Dick Johnson
Penguin : Linux version 2.4.1 on an i686 machine (799.53 BogoMips).
"Memory is like gasoline. You use it up when you are running. Of
course you get it all back when you reboot..."; Actual explanation
obtained from the Micro$oft help desk.
next reply other threads:[~2001-04-19 16:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-04-19 16:18 Marc Karasek [this message]
-- strict thread matches above, loose matches on Subject: below --
2001-04-19 15:32 Marc Karasek
2001-04-19 15:38 ` Disconnect
2001-04-19 15:43 ` Richard B. Johnson
2001-04-19 23:10 ` Steven Walter
2001-04-20 16:31 ` Fabrice Gautier
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=25369470B6F0D41194820002B328BDD27C93@ATLOPS \
--to=marc_karasek@ivivity.com \
--cc=linux-kernel@vger.kernel.org \
--cc=root@chaos.analogic.com \
/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®