Find the answer to your Linux question:
Results 1 to 2 of 2
Hi All, An application is running on the board is not able to receive the characters from the serial port from the host. Host and board have been connected thru ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2008
    Posts
    2

    An application is running on the board is not able to receive the characters from the


    Hi All,
    An application is running on the board is not able to receive the characters from the serial port from the host. Host and board have been connected thru serial port.

    bootargs on the board
    console=ttyS0,115200n8 noinitrd ...

    App is on board is waiting for the characters on the serial port.
    i = 10;
    fd = open("/dev/console", O_RDWR);
    if( 0 > fd )
    {
    perror("open");
    return -1;
    }

    // dup2(0, fd);
    change_settings(fd);
    while( i-- )
    {
    if( read(fd, &c, 1) != 1 )
    {
    perror("read");
    close(fd);
    return -1;
    }
    buf[10 - i] = c;
    printf("%c\n", c);
    }
    restore_settings(fd);
    close(fd);

    App on the host is doing the write on the ttyS0 file.

    i = 10;
    fd = open("/dev/ttyS0", O_RDWR);
    if( 0 > fd )
    {
    perror("open");
    return -1;
    }
    change_settings(fd);
    while( i-- )
    {
    if( write(fd, &c, 1) != 1)
    perror("write");
    }
    restore_settings(fd);
    close(fd);

    The app is running on board is not receiving anything from the host application.
    My guess is " i am not opening the correct file", if it is correct, can you guys tell me which file i need to open on the host to recieve the chars from the host?


    When i add printk in the tty_io.c file under drivers/char/. I was able to see some characters. No idea y?

    Can you guys help me on this? (Thanks in Advance)

    Regards,
    Ramesh.

  2. #2
    Just Joined!
    Join Date
    Aug 2008
    Posts
    2
    Actually two guys are waiting on the stdin (my app & bash)...so bash was always reading the input...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •