At the moment, I am thinking of using PTY but I am not sure how to attached the slave PTY to a serial port. I'd appreciate if someone show me some example.