CVS: rdesktop serial.c,1.16,1.17

Michael Gernoth <[email protected]>
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/rdesktop
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7067

Modified Files:
	serial.c 
Log Message:
add support for reading the modem status-lines


Index: serial.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/serial.c,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** serial.c	24 Aug 2004 21:37:25 -0000	1.16
--- serial.c	25 Aug 2004 00:43:48 -0000	1.17
***************
*** 3,6 ****
--- 3,7 ----
  #include <termios.h>
  #include <strings.h>
+ #include <sys/ioctl.h>
  #include "rdesktop.h"
  
***************
*** 74,77 ****
--- 75,84 ----
  #define SERIAL_EV_EVENT2           0x1000	// Provider specific event 2
  
+ /* Modem Status */
+ #define SERIAL_MS_CTS 0x10
+ #define SERIAL_MS_DSR 0x20
+ #define SERIAL_MS_RNG 0x40
+ #define SERIAL_MS_CAR 0x80
+ 
  #ifndef CRTSCTS
  #define CRTSCTS 0
***************
*** 520,524 ****
  	int flush_mask, purge_mask;
  #endif
! 	uint32 result;
  	uint8 immediate;
  	SERIAL_DEVICE *pser_inf;
--- 527,531 ----
  	int flush_mask, purge_mask;
  #endif
! 	uint32 result, modemstate;
  	uint8 immediate;
  	SERIAL_DEVICE *pser_inf;
***************
*** 612,616 ****
  			break;
  		case SERIAL_GET_MODEMSTATUS:
! 			out_uint32_le(out, 0);	/* Errors */
  			break;
  		case SERIAL_GET_COMMSTATUS:
--- 619,635 ----
  			break;
  		case SERIAL_GET_MODEMSTATUS:
! 			modemstate = 0;
! #ifdef TIOCMGET
! 			ioctl(handle, TIOCMGET, &result);
! 			if (result & TIOCM_CTS)
! 				modemstate |= SERIAL_MS_CTS;
! 			if (result & TIOCM_DSR)
! 				modemstate |= SERIAL_MS_DSR;
! 			if (result & TIOCM_RNG)
! 				modemstate |= SERIAL_MS_RNG;
! 			if (result & TIOCM_CAR)
! 				modemstate |= SERIAL_MS_CAR;
! #endif
! 			out_uint32_le(out, modemstate);
  			break;
  		case SERIAL_GET_COMMSTATUS:



-------------------------------------------------------
SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media
100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33
Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift.
http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.