logo       

Re: Trying to output <stdout,stderr> messages in the serial console: msg#00138

lib.uclibc.general

Subject: Re: Trying to output <stdout,stderr> messages in the serial console

Markus Pietrek wrote:

Hi George,


The next big step is print some messages in the serial console. I assume
that when we fprintf in stdout or stderr, our messages should be
redirected to the systems console. Am I write on this? When executing a
regular application in /bin/sh this application should be able to output
formatted messages to the serial port?


How do you launch your application? Do you replace init by your application or modify init to call your application?

Actually I was using my applcation in place of init which I suppose is wrong. I will compile init from the userland.old repo of uClinux and try to execute it instead.

The application inherits stdout, stderr and stdin from its parent. And I think init must open /dev/ttyS0 or /dev/tty itself first.

And /dev/console provides only output, so it may be ok for stdout and stderr. It also uses many kernel buffers for retreiving the messages later (like dmesg does). It is also important that /dev/console is used by other kernel functions, so your text may be overwritten.

I understand. I also made some tests trying to open /dev/ttyS0. I open it and tried to output something there. It works fine and outputs the messages in the serial port. Thus /dev/ttyS0 works OK.

Thanks for your help,

- George

--

"Luck is what happens when preparation meets opportunity"


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise