summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Kleine-König <u.kleine-koenig@pengutronix.de>2022-09-07 11:38:13 +0200
committerUwe Kleine-König <u.kleine-koenig@pengutronix.de>2022-09-07 11:40:38 +0200
commit696da5d9b39eb9a8e947651e5fb2e0a8835d249a (patch)
tree22f4bf30a6400ecd6a0a6f46afe5ce23ffff4a4e
parent50e868981dbe58a472bb79638f849262f0f432ef (diff)
downloadmicrocom-696da5d9b39eb9a8e947651e5fb2e0a8835d249a.tar.gz
microcom-696da5d9b39eb9a8e947651e5fb2e0a8835d249a.tar.xz
serial: Open code tcsendbreak
This is a copy from libc6. tcsendbreak() is defined in <termios.h>. This header however is incompatible with <linux/termios.h>, which in turn is needed to make use of TCSETS2. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
-rw-r--r--serial.c15
1 files changed, 13 insertions, 2 deletions
diff --git a/serial.c b/serial.c
index e4dc39c..be5714f 100644
--- a/serial.c
+++ b/serial.c
@@ -203,9 +203,20 @@ static int serial_set_flow(struct ios_ops *ios, int flow)
static int serial_send_break(struct ios_ops *ios)
{
- tcsendbreak(ios->fd, 0);
+ int ret;
+ struct timeval delay = {
+ .tv_sec = 0,
+ .tv_usec = 400000,
+ };
- return 0;
+ ret = ioctl(ios->fd, TIOCSBRK, NULL);
+ if (ret < 0)
+ return ret;
+
+ select(0, NULL, NULL, NULL, &delay);
+
+ ret = ioctl(ios->fd, TIOCCBRK, NULL);
+ return ret;
}
/* restore original terminal settings on exit */