title: Serial read() does not return a value without data receiving
body: <p>I am trying to work with read() function with serial connection.</p>
  
  <p>I initialize serial port with the following settings:</p>
  
  <pre><code>bool HardwareSerial::begin(speed_t speed) {
  
  
      int USB = open("/dev/ttyUSB0", O_RDWR | O_NOCTTY);
  
      if (USB == 1) {
  
          std::cout &lt;&lt; "\n  Error! in Opening ttyUSB0\n" &lt;&lt; std::endl;
      } else {
  
          std::cout &lt;&lt; "\n  ttyUSB0 Opened Successfully\n" &lt;&lt; std::endl;
      }
  
      struct termios tty;
      struct termios tty_old;
      memset(&amp;tty, 0, sizeof tty);
  
      // Error Handling
      if (tcgetattr(USB, &amp;tty) != 0) {
          std::cout &lt;&lt; "Error " &lt;&lt; errno &lt;&lt; " from tcgetattr: " &lt;&lt; strerror(errno) &lt;&lt; std::endl;
      }
  
      //Save old tty parameters
      tty_old = tty;
  
      // Set Baud Rate 
      cfsetospeed(&amp;tty, (speed_t) speed);
      cfsetispeed(&amp;tty, (speed_t) speed);
  
      // Setting other Port Stuff 
      tty.c_cflag &amp;= ~PARENB; // Make 8n1
      tty.c_cflag &amp;= ~CSTOPB;
      tty.c_cflag &amp;= ~CSIZE;
      tty.c_cflag |= CS8;
  
      tty.c_iflag &amp;= ~(IXON | IXOFF | IXANY);
      tty.c_iflag &amp;= ~(ICANON | ECHO | ECHOE | ISIG);
  
      tty.c_cflag &amp;= ~CRTSCTS; // no flow control
      tty.c_cc[VMIN] = 1; // read doesn't block
      tty.c_cc[VTIME] = 5; // 0.5 seconds read timeout
      tty.c_cflag |= CREAD | CLOCAL; // turn on READ &amp; ignore ctrl lines
  
      // Make raw
      cfmakeraw(&amp;tty);
  
      //Flush Port, then applies attributes
      tcflush(USB, TCIFLUSH);
      if (tcsetattr(USB, TCSANOW, &amp;tty) != 0) {
          std::cout &lt;&lt; "Error " &lt;&lt; errno &lt;&lt; " from tcsetattr" &lt;&lt; std::endl;
      }
  
      _USB = USB;
  
      return true;
  
  }
  </code></pre>
  
  <p>Then I periodically call class member read() function that calls stream read:</p>
  
  <pre><code>int HardwareSerial::read() {
  
      int n = 0;
      char buf;
  
      n = ::read(_USB, &amp;buf, 1);
  
      std::cout &lt;&lt; std::hex &lt;&lt; static_cast&lt;int&gt; (buf) &lt;&lt; " n:";
      std::cout &lt;&lt; n &lt;&lt; std::endl;
  
  }
  </code></pre>
  
  <p>While the port receives data read() works as expected and prints incoming bytes. But if I stop sending bytes the program hangs until some bytes will have not received.
  I expect that ::read will return 0, but it does not return anything and waits for incoming data. After new data is received the program continues work and ::read returns 1;</p>
  
  <p>So what I missed in the configuration?
  I tried different VMIN and VTIME but the result is the same.</p>