- /* same thing for modem (plus: set baud rate) - TODO: make CLI option */
- tcgetattr(sfd, &tiosfd);
- tio = tiosfd;
- tio.c_lflag &= ~(ICANON|ECHO);
- tio.c_iflag &= ~(IXON|ICRNL);
- tio.c_oflag &= ~(ONLCR);
- tio.c_cc[VMIN] = 1;
- tio.c_cc[VTIME] = 0;
- cfsetispeed(&tio, tty_value_to_baud(speed));
- cfsetospeed(&tio, tty_value_to_baud(speed));
- if (tcsetattr(sfd, TCSANOW, &tio)) {
- bb_perror_msg("can't tcsetattr for %s", "device");
- goto unlock_and_exit;
- }
+ // open device
+ sfd = open_or_warn(argv[0], O_RDWR | O_NOCTTY | O_NONBLOCK);
+ if (sfd < 0)
+ goto done;
+ fcntl(sfd, F_SETFL, O_RDWR);