Anonymous
public text v1 · immutable#include <stdio.h>
#include <termios.h>
#include <fcntl.h>
int main (int argc, char * * argv) {
if (argc < 2) {
printf("Usage: setbaud port\n");
return 1;
}
int fd = open(argv[1], O_RDWR);
if (fd < 0) {
printf("Couldn't open %s\n", argv[1]);
}
struct termios tr;
tcgetattr(fd, &tr);
cfsetispeed(&tr, B4800);
cfsetospeed(&tr, B4800);
tcflush(fd, TCIFLUSH);
tcsetattr(fd, TCSANOW, &tr);
}