commit c698d567f34e466b03f0fefbf21b23da2345b17f from: Sven M. Hallberg date: Tue Jan 10 19:50:03 2023 UTC use cfmakeraw when setting up the serial line Somehow missed that function at first. This makes serial I/O work on Linux. commit - 4c0960ae086413f5348da9e7392cb2ca83605d1f commit + c698d567f34e466b03f0fefbf21b23da2345b17f blob - 9f8d316767c254a3189ddd9ff497dcb8645158a5 blob + a781da6248c75e1d47604983174c0f69336e53ca --- README +++ README @@ -19,7 +19,7 @@ BUILDING Run make. The program is designed for a Unix environment, specifically OpenBSD. - Patches that port it to other platforms are welcome. + It has also been tested on Debian GNU/Linux. SEE ALSO MC5000 dev kit https://github.com/rickp/MC5000_DevKit blob - bd78fb130c3d5a2fb0f3c64d73c53c8f146e91a5 blob + f99780563b9048b69962437a917ed43e83d53944 --- mc5000.c +++ mc5000.c @@ -204,11 +204,9 @@ main(int argc, char *argv[]) if (tcgetattr(fileno(devf), &t) != 0) err(1, "tcgetattr"); cfsetspeed(&t, B19200); /* 19200 Baud */ - t.c_iflag = 0; /* raw input */ - t.c_oflag = 0; /* raw output */ - t.c_cflag = CREAD|CS8; /* 8N1, no flow control */ + cfmakeraw(&t); /* raw i/o mode */ + t.c_cflag |= CREAD|CS8; /* 8N1, no flow control */ t.c_cflag |= CLOCAL; /* ignore "modem" status */ - t.c_lflag = 0; /* no echo, line canon. etc. */ t.c_cc[VMIN] = 0; /* stop read() if... */ t.c_cc[VTIME] = 1; /* ...no input after 100 ms */ if (tcsetattr(fileno(devf), TCSAFLUSH, &t) != 0)