[uClibc-cvs] uClibc/libc/termios termios.c,1.12,1.13

Erik Andersen andersen at uclibc.org
Sat Sep 6 06:09:54 UTC 2003


Update of /var/cvs/uClibc/libc/termios
In directory winder:/tmp/cvs-serv24006

Modified Files:
	termios.c 
Log Message:
Running ltp 20030905 showed that tcsendbreak was broken.
This fixes it.


Index: termios.c
===================================================================
RCS file: /var/cvs/uClibc/libc/termios/termios.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- termios.c	16 Jul 2002 15:02:01 -0000	1.12
+++ termios.c	6 Sep 2003 06:09:51 -0000	1.13
@@ -70,21 +70,23 @@
 /* Send zero bits on FD.  */
 int tcsendbreak( int fd, int duration)
 {
-	/*
-	 * The break lasts 0.25 to 0.5 seconds if DURATION is zero, and an
-	 * implementation-defined period if DURATION is nonzero. We define a
-	 * positive DURATION to be number of milliseconds to break.
-	 */
+	/* The break lasts 0.25 to 0.5 seconds if DURATION is zero,
+	   and an implementation-defined period if DURATION is nonzero.
+	   We define a positive DURATION to be number of milliseconds to break.  */
 	if (duration <= 0)
 		return ioctl(fd, TCSBRK, 0);
 
-	/*
-	 * ioctl can't send a break of any other duration for us. This could be
-	 * changed to use trickery (e.g. lower speed and send a '\0') to send
-	 * the break, but for now just return an error.
-	 */
-	__set_errno(EINVAL);
+#ifdef TCSBRKP
+	/* Probably Linux-specific: a positive third TCSBRKP ioctl argument is
+	   defined to be the number of 100ms units to break.  */
+	return ioctl(fd, TCSBRKP, (duration + 99) / 100);
+#else
+	/* ioctl can't send a break of any other duration for us.
+	   This could be changed to use trickery (e.g. lower speed and
+	   send a '\0') to send the break, but for now just return an error.  */
+	__set_errno (EINVAL);
 	return -1;
+#endif
 }
 #endif
 




More information about the uClibc-cvs mailing list