* @brief Gets the current attributes of a terminal device. * @param fd File descriptor of the terminal device. * @param tio Pointer to a struct termios where the attributes will be stored. * @return Upon successful completion, returns 0; otherwise, returns -1. * * @note This function retrieves the current attributes of a terminal device specified by the file descriptor fd. *
| 28 | * If the ioctl operation fails, the function returns -1 to indicate an error. |
| 29 | */ |
| 30 | int tcgetattr(int fd, struct termios *tio) |
| 31 | { |
| 32 | /* Get the current serial port settings. */ |
| 33 | if (ioctl(fd, TCGETA, tio)) |
| 34 | return -1; |
| 35 | |
| 36 | return 0; |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * @brief Sets the attributes of a terminal device. |
no test coverage detected