8 int main(int argc, char *argv[])
10 struct epoll_event ev;
11 struct plotter_options options;
17 if (read_args(argc, argv, &options))
20 baud = options.baud_rate;
21 fd = open_at_baud(options.device_path, &baud);
25 if (baud != options.baud_rate) {
26 printf("Failed to set baudrate to %d, only got %d\n",
27 options.baud_rate, baud);
32 epoll_fd = epoll_create(1);
36 if (epoll_ctl(epoll_fd, EPOLL_CTL_ADD, fd, &ev) == -1) {
42 ret = epoll_wait(epoll_fd, &ev, 1, -1);
51 ret = read(fd, buf, sizeof(buf));
60 ret = write(1, buf, ret);