Switch to select() for polling serial port.