linux demo code just like serial port