diff options
author | Pali Rohár <pali@kernel.org> | 2021-10-06 14:30:25 +0200 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2021-10-21 07:39:05 +0200 |
commit | a46877eeb2de77d8d1daf1ea362423b6d2fc4f09 (patch) | |
tree | d5adbdef319ad6759e2f25ffd406b188cc346aab /tools | |
parent | ee8ce3840aec25cf38b3059fc43cfa7ca6003f55 (diff) | |
download | u-boot-a46877eeb2de77d8d1daf1ea362423b6d2fc4f09.zip u-boot-a46877eeb2de77d8d1daf1ea362423b6d2fc4f09.tar.gz u-boot-a46877eeb2de77d8d1daf1ea362423b6d2fc4f09.tar.bz2 |
tools: termios_linux.h: Fix tcsendbreak() implementation
There are two Linux ioctls which implements tcsendbreak() functionality:
TCSBRK and TCSBRKP
TCSBRK with non-zero parameter implements tcdrain() and with zero parameter
implements tcsendbreak() for duration of 0.25s.
TCSBRKP with zero parameter is same as TCSBRK and with non-zero parameter
implements tcsendbreak() for duration in deciseconds specified by
parameter. TCSBRKP does not have to be provided by older toolchain
versions.
So tcsendbreak() has to either use TCSBRK with zero parameter or TCSBRKP
with any parameter.
Fix code to use TCSBRKP and fallback to TCSBRK with 0.
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/termios_linux.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/termios_linux.h b/tools/termios_linux.h index d73989b..e100c8e 100644 --- a/tools/termios_linux.h +++ b/tools/termios_linux.h @@ -90,7 +90,11 @@ static inline int tcflush(int fd, int q) static inline int tcsendbreak(int fd, int d) { - return ioctl(fd, TCSBRK, d); +#ifdef TCSBRKP + return ioctl(fd, TCSBRKP, d); +#else + return ioctl(fd, TCSBRK, 0); +#endif } static inline int tcflow(int fd, int a) |