Problems with output to console

Steven Scholz steven.scholz at imc-berlin.de
Sat Dec 10 13:27:31 UTC 2005


Tito wrote:
> On Saturday 10 December 2005 11:41, Steven Scholz wrote:
> 
>>Hi all,
>>
>>I have two different ARM based boards (different CPUs, both Linux
>>2.6.14) running BusyBox v1.00.
>>
>>I want a little application (started by a script that is started by
>>inittab) to output stuff using printf() on my serial console.
>>
>>foobar.c is
>>int main (void)
>>{
>>        printf("Hello World (printf)!\n");
>>        return 0;
>>}
> 
> Hi, Just my 0.02 €.

In 0.01 € would be enough. Though you need 0.02 US$! ;-)

> Maybe something like:
> 
> int main(void)
> {
> 	FILE *out;
> 
> 	if((out = fopen(" /dev/ttyS0", "r+")) == NULL)
> 		return 1;
> 	fprintf(out, "test\n");
> 	fclose(out);
> 	return 0;
> } 
> 
> could be a workaround.
> But sure there is a better way.....
I am sure as well.

But I am not only looking for a workaround. I want to understand the
problem.

And as you might have guessed, I need this for debug outputs for my
application (which is of course a tiny little bit more complicated than
foobar.c ...)

So what happens, if I telnet into a closed box, kill the running
application and start it again? Right. Debug output is sent to serial
console, which I dont have then ... ;-)
So "stdout" is what I want. And "stdout" should be ttyS0 when started
from inittab (or from scripts that were started from inittab) started...

--
Steven



More information about the busybox mailing list