2 |
#include <fcntl.h> |
#include <fcntl.h> |
3 |
#include <termios.h> |
#include <termios.h> |
4 |
#include <strings.h> |
#include <strings.h> |
5 |
|
#include <sys/ioctl.h> |
6 |
#include "rdesktop.h" |
#include "rdesktop.h" |
7 |
|
|
8 |
#define FILE_DEVICE_SERIAL_PORT 0x1b |
#define FILE_DEVICE_SERIAL_PORT 0x1b |
74 |
#define SERIAL_EV_EVENT1 0x0800 // Provider specific event 1 |
#define SERIAL_EV_EVENT1 0x0800 // Provider specific event 1 |
75 |
#define SERIAL_EV_EVENT2 0x1000 // Provider specific event 2 |
#define SERIAL_EV_EVENT2 0x1000 // Provider specific event 2 |
76 |
|
|
77 |
|
/* Modem Status */ |
78 |
|
#define SERIAL_MS_CTS 0x10 |
79 |
|
#define SERIAL_MS_DSR 0x20 |
80 |
|
#define SERIAL_MS_RNG 0x40 |
81 |
|
#define SERIAL_MS_CAR 0x80 |
82 |
|
|
83 |
#ifndef CRTSCTS |
#ifndef CRTSCTS |
84 |
#define CRTSCTS 0 |
#define CRTSCTS 0 |
85 |
#endif |
#endif |
526 |
#if 0 |
#if 0 |
527 |
int flush_mask, purge_mask; |
int flush_mask, purge_mask; |
528 |
#endif |
#endif |
529 |
uint32 result; |
uint32 result, modemstate; |
530 |
uint8 immediate; |
uint8 immediate; |
531 |
SERIAL_DEVICE *pser_inf; |
SERIAL_DEVICE *pser_inf; |
532 |
struct termios *ptermios; |
struct termios *ptermios; |
618 |
set_termios(pser_inf, handle); |
set_termios(pser_inf, handle); |
619 |
break; |
break; |
620 |
case SERIAL_GET_MODEMSTATUS: |
case SERIAL_GET_MODEMSTATUS: |
621 |
out_uint32_le(out, 0); /* Errors */ |
modemstate = 0; |
622 |
|
#ifdef TIOCMGET |
623 |
|
ioctl(handle, TIOCMGET, &result); |
624 |
|
if (result & TIOCM_CTS) |
625 |
|
modemstate |= SERIAL_MS_CTS; |
626 |
|
if (result & TIOCM_DSR) |
627 |
|
modemstate |= SERIAL_MS_DSR; |
628 |
|
if (result & TIOCM_RNG) |
629 |
|
modemstate |= SERIAL_MS_RNG; |
630 |
|
if (result & TIOCM_CAR) |
631 |
|
modemstate |= SERIAL_MS_CAR; |
632 |
|
#endif |
633 |
|
out_uint32_le(out, modemstate); |
634 |
break; |
break; |
635 |
case SERIAL_GET_COMMSTATUS: |
case SERIAL_GET_COMMSTATUS: |
636 |
out_uint32_le(out, 0); /* Errors */ |
out_uint32_le(out, 0); /* Errors */ |