2010-07-08 08:07:48     BF537-stamp stdin problem

Document created by Aaronwu Employee on Aug 22, 2013
Version 1Show Document
  • View in full screen mode

2010-07-08 08:07:48     BF537-stamp stdin problem

Yuval Yosef (ISRAEL)

Message: 91044   

 

 

I use BF537-stamp board.

I have a problem with using stdin in my application.

When I run my application from shell it's works OK.

But I need to run application automatically after Kernal is up.

So , I added new lines at end of rc file:

 

chmod +x app

./app

 

The application itself included in the uClinux-dist.   

 

The application starts but receives invalid input from stdin

(without any input from keyboard).

 

What I do wrong ? Are there other ways to run application

automatically after Kernal is up (not by changing rc file) ?

 

Any help will be usefull.

Thanks.

============================================

P.S.

Output:

 

Commands:

s     start

f     finish

q     quit

Command: Invalid input character '.'

 

Commands:

s     start

f     finish

q     quit

Command: Invalid input character '.'

....

 

 

 

 

My application:

#include <stdio.h>

int main(int argc, char *argv[])

{

 

char tmp[10];

 

for (;;) {

  puts("");

  puts("Commands:");

  puts("  s     start");

  puts("  f     finish");

  puts("  q     quit");

 

  printf("Command: "); fflush(stdout);

 

  fgets(tmp, sizeof(tmp), stdin);

 

  switch (tmp[0]) {

   case 's':  puts("start ");

           break;

   case 'f':  puts("finish ");

           break;

            case 'q':  return 0;

                       break;

   default:

        printf("Invalid input character '%c'\n", tmp[0]);

        break;

  }

 

} /* for (;;)  */

 

}

QuoteReplyEditDelete

 

 

2010-07-08 12:44:32     Re: BF537-stamp stdin problem

Mike Frysinger (UNITED STATES)

Message: 91064   

 

please search the forums.  simpleinit redirects stdin from /dev/null before executing /etc/rc.  input really shouldnt be done from that file because it's blocking the booting process.

Attachments

    Outcomes