Reading serial data in linux byte-for-byte at 56K reliably
问题 I'm trying to create a function with the most minimal delay possible that checks to see if the serial port has data and if it does, it reads every single byte and prints each byte in hex format until no more bytes are available. If there is no data, the function must return right away. This is my code: int fd=open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_SYNC); // Trying to set correct options here struct termios o; tcgetattr(fd,&o); cfsetispeed(&o,57600); cfsetospeed(&o,57600); /* 8 bits, no