[PATCH] TIOCMBI[SC]

Yitzchak Scott-Thoennes sthoenna@efn.org
Mon Aug 1 11:15:00 GMT 2005


I don't have a serial device to test this with, but it's just selected
parts of the TIOCMSET handling slightly adapted.

2005-08-01  Yitzchak Scott-Thoennes  <sthoenna@efn.org>

	* fhandler_serial.cc (fhandler_serial::ioctl): Implement TIOCMBIS and
	TIOCMBIC.
	* include/sys/termios.h: Define TIOCMBIS and TIOCMBIC

.
-------------- next part --------------
--- winsup/cygwin/include/sys/termios.h.orig	2005-05-01 20:50:10.000000000 -0700
+++ winsup/cygwin/include/sys/termios.h	2005-08-01 02:22:34.361969600 -0700
@@ -1,6 +1,6 @@
 /* sys/termios.h
 
-   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003 Red Hat, Inc.
+   Copyright 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 Red Hat, Inc.
 
 This file is part of Cygwin.
 
@@ -14,6 +14,8 @@
 #define _SYS_TERMIOS_H
 
 #define	TIOCMGET	0x5415
+#define	TIOCMBIS	0x5416
+#define	TIOCMBIC	0x5417
 #define	TIOCMSET	0x5418
 #define	TIOCINQ		0x541B
 
--- winsup/cygwin/fhandler_serial.cc.orig	2005-07-06 13:05:00.000000000 -0700
+++ winsup/cygwin/fhandler_serial.cc	2005-08-01 02:31:30.993608000 -0700
@@ -470,6 +470,50 @@ fhandler_serial::ioctl (unsigned int cmd
 	    res = -1;
 	  }
 	break;
+      case TIOCMBIS:
+	if (ipbuffer & TIOCM_RTS)
+	  {
+	    if (EscapeCommFunction (get_handle (), SETRTS))
+	      rts = TIOCM_RTS;
+	    else
+	      {
+		__seterrno ();
+		res = -1;
+	      }
+	  }
+	if (ipbuffer & TIOCM_DTR)
+	  {
+	    if (EscapeCommFunction (get_handle (), SETDTR))
+	      dtr = TIOCM_DTR;
+	    else
+	      {
+		__seterrno ();
+		res = -1;
+	      }
+	  }
+	break;
+      case TIOCMBIC:
+	if (ipbuffer & TIOCM_RTS)
+	  {
+	    if (EscapeCommFunction (get_handle (), CLRRTS))
+	      rts = 0;
+	    else
+	      {
+		__seterrno ();
+		res = -1;
+	      }
+	  }
+	if (ipbuffer & TIOCM_DTR)
+	  {
+	    if (EscapeCommFunction (get_handle (), CLRDTR))
+	      dtr = 0;
+	    else
+	      {
+		__seterrno ();
+		res = -1;
+	      }
+	  }
+	break;
       case TIOCCBRK:
 	if (ClearCommBreak (get_handle ()) == 0)
 	  {


More information about the Cygwin-patches mailing list