title: pySerial inWaiting returns incorrect number of bytes
body: <p>I've got a simple program to test serial functionality. My serial device reacts to two inputs. If the user enters 'a', it responds with 'fg'. If the user enters anything other character/byte, it responds with 'z'. If I send 'b' to the serial device, it will return 'z' just fine. When I send 'a', it should return both 'f' and 'g', so two bytes instead of one. </p>
  
  <p>See code below. </p>
  
  <pre><code>#!/usr/bin/env python
  
  import serial
  
  ser = serial.Serial(
      port = '/dev/ttyUSB0',
      baudrate = 9600,
      parity = serial.PARITY_NONE,
      stopbits = serial.STOPBITS_ONE,
      bytesize = serial.EIGHTBITS
      )
  
  ser.write('a')
  byteData = ser.read(1) # read one, blocking
  moreBytes = ser.inWaiting()
  
  if moreBytes:
      byteData = byteData + ser.read(moreBytes)
      print byteData
  
  print byteData
  
  
  ser.close()
  </code></pre>
  
  <p>The output is :</p>
  
  <pre><code>user@ubuntu:~/code/native$ ./serialTesting.py 
  f
  </code></pre>
  
  <p>inWaiting() gives the value of 0, thus it never reads the second byte. If I do a small change to the code, and manually read the two expected bytes, it works fine.</p>
  
  <pre><code>#!/usr/bin/env python
  
  import serial
  
  ser = serial.Serial(
      port = '/dev/ttyUSB0',
      baudrate = 9600,
      parity = serial.PARITY_NONE,
      stopbits = serial.STOPBITS_ONE,
      bytesize = serial.EIGHTBITS
      )
  
  ser.write('a')
  byteData = ser.read(2) # read two expected bytes for the result 'fg'
  
  print byteData
  
  ser.close()
  </code></pre>
  
  <p>The output is as expected:</p>
  
  <pre><code>user@ubuntu:~/code/native$ ./serialTesting.py 
  fg
  </code></pre>