Datos de lectura de Linux de UART

Quiero leer datos de UART, seguíeste tutorial, la función de escritura funciona como se esperaba, sin embargo, tengo problemas con la función de lectura:

Esta es la función uart_init:

void uart_init()
{
 printf("\n +----------------------------------+");
 printf("\n |        Serial Port Write         |");
 printf("\n +----------------------------------+");

/*------------------------------- Opening the Serial Port -------------------------------*/

  fd = open("/dev/ttyUSB0",O_RDWR | O_NOCTTY| O_SYNC);      /* !!blocks the read  */
                                                            /* O_RDWR Read/Write access to serial port           */
                                                            /* O_NOCTTY - No terminal will control the process   */
                                                            /* O_NDELAY -Non Blocking Mode,Does not care about-  */
                                                            /* -the status of DCD line,Open() returns immediatly */                                        

 if(fd == -1)                                               /* Error Checking */
  printf("\n  Error! in Opening ttyUSB0  ");
 else
  printf("\n  ttyUSB0 Opened Successfully ");


 /*---------- Setting the Attributes of the serial port using termios structure --------- */

struct termios SerialPortSettings;          /* Create the structure                          */

tcgetattr(fd, &SerialPortSettings);         /* Get the current attributes of the Serial port */

cfsetispeed(&SerialPortSettings,B19200);        /* Set Read  Speed as 19200                       */
cfsetospeed(&SerialPortSettings,B19200);        /* Set Write Speed as 19200                       */

SerialPortS,ettings.c_cflag &= ~PARENB;          /* Disables the Parity   Enable bit(PARENB),So No Parity   */
SerialPortSettings.c_cflag &= ~CSTOPB;          /* CSTOPB = 2 Stop bits,here it is cleared so 1 Stop bit */
SerialPortSettings.c_cflag &= ~CSIZE;           /* Clears the mask for setting the data size             */
SerialPortSettings.c_cflag |=  CS8;             /* Set the data bits = 8                                 */

SerialPortSettings.c_cflag &= ~CRTSCTS;         /* No Hardware flow Control                         */
SerialPortSettings.c_cflag |= CREAD | CLOCAL;   /* Enable receiver,Ignore Modem Control lines       */ 


SerialPortSettings.c_iflag &= ~(IXON | IXOFF | IXANY);          /* Disable XON/XOFF flow control both i/p and o/p */
SerialPortSettings.c_iflag &= ~(ICANON | ECHO | ECHOE | ISIG);  /* Non Cannonical mode                            */

SerialPortSettings.c_oflag &= ~OPOST;/*No Output Processing*/

/* Setting Time outs */
SerialPortSettings.c_cc[VMIN] = 10; /* Read at least 10 characters */
SerialPortSettings.c_cc[VTIME] = 0; /* Wait indefinetly   */

if((tcsetattr(fd,TCSANOW,&SerialPortSettings)) != 0) /* Set the attributes to the termios structure*/
 printf("\n  ERROR ! in Setting attributes");
else
 printf("\n  BaudRate = 19200 \n  StopBits = 1 \n  Parity   = none");

}

la función de recepción:

void uart_receive()
{
 char read_buffer[32];   /* Buffer to store the data received              */
 int  bytes_read = 0;    /* Number of bytes read by the read() system call */
 int i = 0;

 bytes_read = read(fd,&read_buffer,10); /* Read the data                   */

 printf("\n\n  Bytes Rxed %d", bytes_read); /* Print the number of bytes read */
 printf("\n\n  ");

 for(i=0;i<bytes_read;i++)   /*printing only the received characters*/
 printf("%c",read_buffer[i]);

 printf("\n +----------------------------------+\n\n\n");
}

la función principal:

void main(void)
{ 
  uart_init();
  /*------------------------------- Write data to serial port -----------------------------*/
  //uart_write_commande(write_buffer); //Write function works well
  uart_receive();

  close(fd);/* Close the Serial port */
}

EDITAR

Ejecuto el programa y espero a que se reciban los bytes de datos en UART, envío datos usando UART pero la función de lectura se mantiene bloqueada.

Estoy usando una máquina virtual con Ubunutu 14.04, y no estoy seguro de que usar un UART emulado pueda causar problemas durante la recepción.

Respuestas a la pregunta(3)

Su respuesta a la pregunta