--- sourceforge.net/trunk/rdesktop/serial.c 2004/08/24 21:37:50 756 +++ sourceforge.net/trunk/rdesktop/serial.c 2004/08/25 00:43:48 757 @@ -2,6 +2,7 @@ #include #include #include +#include #include "rdesktop.h" #define FILE_DEVICE_SERIAL_PORT 0x1b @@ -73,6 +74,12 @@ #define SERIAL_EV_EVENT1 0x0800 // Provider specific event 1 #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 #endif @@ -519,7 +526,7 @@ #if 0 int flush_mask, purge_mask; #endif - uint32 result; + uint32 result, modemstate; uint8 immediate; SERIAL_DEVICE *pser_inf; struct termios *ptermios; @@ -611,7 +618,19 @@ set_termios(pser_inf, handle); break; case SERIAL_GET_MODEMSTATUS: - out_uint32_le(out, 0); /* Errors */ + 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: out_uint32_le(out, 0); /* Errors */