124 |
#ifndef TIOCINQ |
#ifndef TIOCINQ |
125 |
#define TIOCINQ FIONREAD |
#define TIOCINQ FIONREAD |
126 |
#endif |
#endif |
127 |
|
#ifndef TIOCOUTQ |
128 |
|
#define TIOCOUTQ FIONWRITE |
129 |
|
#endif |
130 |
|
|
131 |
extern RDPDR_DEVICE g_rdpdr_device[]; |
extern RDPDR_DEVICE g_rdpdr_device[]; |
132 |
|
|
568 |
pser_inf->ptermios->c_iflag &= |
pser_inf->ptermios->c_iflag &= |
569 |
~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); |
~(IGNBRK | BRKINT | PARMRK | ISTRIP | INLCR | IGNCR | ICRNL | IXON); |
570 |
pser_inf->ptermios->c_oflag &= ~OPOST; |
pser_inf->ptermios->c_oflag &= ~OPOST; |
571 |
pser_inf->ptermios->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN | XCASE); |
pser_inf->ptermios->c_lflag &= ~(ECHO | ECHONL | ICANON | ISIG | IEXTEN); |
572 |
pser_inf->ptermios->c_cflag &= ~(CSIZE | PARENB); |
pser_inf->ptermios->c_cflag &= ~(CSIZE | PARENB); |
573 |
pser_inf->ptermios->c_cflag |= CS8; |
pser_inf->ptermios->c_cflag |= CS8; |
574 |
|
|
703 |
case SERIAL_SET_BAUD_RATE: |
case SERIAL_SET_BAUD_RATE: |
704 |
in_uint32_le(in, pser_inf->baud_rate); |
in_uint32_le(in, pser_inf->baud_rate); |
705 |
set_termios(pser_inf, handle); |
set_termios(pser_inf, handle); |
706 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_BAUD_RATE %d\n", pser_inf->baud_rate)); |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_BAUD_RATE %d\n", |
707 |
|
pser_inf->baud_rate)); |
708 |
break; |
break; |
709 |
case SERIAL_GET_BAUD_RATE: |
case SERIAL_GET_BAUD_RATE: |
710 |
out_uint32_le(out, pser_inf->baud_rate); |
out_uint32_le(out, pser_inf->baud_rate); |
711 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_BAUD_RATE %d\n", pser_inf->baud_rate)); |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_BAUD_RATE %d\n", |
712 |
|
pser_inf->baud_rate)); |
713 |
break; |
break; |
714 |
case SERIAL_SET_QUEUE_SIZE: |
case SERIAL_SET_QUEUE_SIZE: |
715 |
in_uint32_le(in, pser_inf->queue_in_size); |
in_uint32_le(in, pser_inf->queue_in_size); |
716 |
in_uint32_le(in, pser_inf->queue_out_size); |
in_uint32_le(in, pser_inf->queue_out_size); |
717 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_QUEUE_SIZE in %d out %d\n", |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_QUEUE_SIZE in %d out %d\n", |
718 |
pser_inf->queue_in_size, pser_inf->queue_out_size)); |
pser_inf->queue_in_size, pser_inf->queue_out_size)); |
719 |
break; |
break; |
720 |
case SERIAL_SET_LINE_CONTROL: |
case SERIAL_SET_LINE_CONTROL: |
721 |
in_uint8(in, pser_inf->stop_bits); |
in_uint8(in, pser_inf->stop_bits); |
722 |
in_uint8(in, pser_inf->parity); |
in_uint8(in, pser_inf->parity); |
723 |
in_uint8(in, pser_inf->word_length); |
in_uint8(in, pser_inf->word_length); |
724 |
set_termios(pser_inf, handle); |
set_termios(pser_inf, handle); |
725 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_LINE_CONTROL stop %d parity %d word %d\n", |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_LINE_CONTROL stop %d parity %d word %d\n", pser_inf->stop_bits, pser_inf->parity, pser_inf->word_length)); |
|
pser_inf->stop_bits, pser_inf->parity, pser_inf->word_length)); |
|
726 |
break; |
break; |
727 |
case SERIAL_GET_LINE_CONTROL: |
case SERIAL_GET_LINE_CONTROL: |
728 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_LINE_CONTROL\n")); |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_LINE_CONTROL\n")); |
765 |
in_uint32_le(in, pser_inf->onlimit); |
in_uint32_le(in, pser_inf->onlimit); |
766 |
in_uint32_le(in, pser_inf->offlimit); |
in_uint32_le(in, pser_inf->offlimit); |
767 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_HANDFLOW %x %x %x %x\n", |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_HANDFLOW %x %x %x %x\n", |
768 |
pser_inf->control, pser_inf->xonoff, pser_inf->onlimit, |
pser_inf->control, pser_inf->xonoff, pser_inf->onlimit, |
769 |
pser_inf->onlimit)); |
pser_inf->onlimit)); |
770 |
set_termios(pser_inf, handle); |
set_termios(pser_inf, handle); |
771 |
break; |
break; |
772 |
case SERIAL_SET_TIMEOUTS: |
case SERIAL_SET_TIMEOUTS: |
776 |
in_uint32(in, pser_inf->write_total_timeout_multiplier); |
in_uint32(in, pser_inf->write_total_timeout_multiplier); |
777 |
in_uint32(in, pser_inf->write_total_timeout_constant); |
in_uint32(in, pser_inf->write_total_timeout_constant); |
778 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_TIMEOUTS read timeout %d %d %d\n", |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_TIMEOUTS read timeout %d %d %d\n", |
779 |
pser_inf->read_interval_timeout, |
pser_inf->read_interval_timeout, |
780 |
pser_inf->read_total_timeout_multiplier, |
pser_inf->read_total_timeout_multiplier, |
781 |
pser_inf->read_total_timeout_constant)); |
pser_inf->read_total_timeout_constant)); |
782 |
break; |
break; |
783 |
case SERIAL_GET_TIMEOUTS: |
case SERIAL_GET_TIMEOUTS: |
784 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_TIMEOUTS read timeout %d %d %d\n", |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_TIMEOUTS read timeout %d %d %d\n", |
785 |
pser_inf->read_interval_timeout, |
pser_inf->read_interval_timeout, |
786 |
pser_inf->read_total_timeout_multiplier, |
pser_inf->read_total_timeout_multiplier, |
787 |
pser_inf->read_total_timeout_constant)); |
pser_inf->read_total_timeout_constant)); |
788 |
|
|
789 |
out_uint32(out, pser_inf->read_interval_timeout); |
out_uint32(out, pser_inf->read_interval_timeout); |
790 |
out_uint32(out, pser_inf->read_total_timeout_multiplier); |
out_uint32(out, pser_inf->read_total_timeout_multiplier); |
793 |
out_uint32(out, pser_inf->write_total_timeout_constant); |
out_uint32(out, pser_inf->write_total_timeout_constant); |
794 |
break; |
break; |
795 |
case SERIAL_GET_WAIT_MASK: |
case SERIAL_GET_WAIT_MASK: |
796 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_WAIT_MASK %X\n", pser_inf->wait_mask); |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_WAIT_MASK %X\n", |
797 |
out_uint32(out, pser_inf->wait_mask)); |
pser_inf->wait_mask); out_uint32(out, pser_inf->wait_mask)); |
798 |
break; |
break; |
799 |
case SERIAL_SET_WAIT_MASK: |
case SERIAL_SET_WAIT_MASK: |
800 |
in_uint32(in, pser_inf->wait_mask); |
in_uint32(in, pser_inf->wait_mask); |
801 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_WAIT_MASK %X\n", pser_inf->wait_mask)); |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_WAIT_MASK %X\n", |
802 |
|
pser_inf->wait_mask)); |
803 |
break; |
break; |
804 |
case SERIAL_SET_DTR: |
case SERIAL_SET_DTR: |
805 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_DTR\n")); |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_SET_DTR\n")); |
857 |
ioctl(handle, TIOCINQ, &result); |
ioctl(handle, TIOCINQ, &result); |
858 |
out_uint32_le(out, result); /* Amount in in queue */ |
out_uint32_le(out, result); /* Amount in in queue */ |
859 |
if (result) |
if (result) |
860 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_COMMSTATUS in queue %d\n", result)); |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_COMMSTATUS in queue %d\n", |
861 |
|
result)); |
862 |
|
|
863 |
result = 0; |
result = 0; |
864 |
ioctl(handle, TIOCOUTQ, &result); |
ioctl(handle, TIOCOUTQ, &result); |
885 |
rdpdr_abort_io(handle, 3, STATUS_CANCELLED); |
rdpdr_abort_io(handle, 3, STATUS_CANCELLED); |
886 |
break; |
break; |
887 |
case SERIAL_WAIT_ON_MASK: |
case SERIAL_WAIT_ON_MASK: |
888 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_WAIT_ON_MASK %X\n", pser_inf->wait_mask)); |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_WAIT_ON_MASK %X\n", |
889 |
|
pser_inf->wait_mask)); |
890 |
pser_inf->event_pending = 1; |
pser_inf->event_pending = 1; |
891 |
if (serial_get_event(handle, &result)) |
if (serial_get_event(handle, &result)) |
892 |
{ |
{ |
992 |
pser_inf->event_dsr = bytes & TIOCM_DSR; |
pser_inf->event_dsr = bytes & TIOCM_DSR; |
993 |
if (pser_inf->wait_mask & SERIAL_EV_DSR) |
if (pser_inf->wait_mask & SERIAL_EV_DSR) |
994 |
{ |
{ |
995 |
DEBUG_SERIAL(("event -> SERIAL_EV_DSR %s\n", (bytes & TIOCM_DSR) ? "ON" : "OFF")); |
DEBUG_SERIAL(("event -> SERIAL_EV_DSR %s\n", |
996 |
|
(bytes & TIOCM_DSR) ? "ON" : "OFF")); |
997 |
*result |= SERIAL_EV_DSR; |
*result |= SERIAL_EV_DSR; |
998 |
ret = True; |
ret = True; |
999 |
} |
} |
1004 |
pser_inf->event_cts = bytes & TIOCM_CTS; |
pser_inf->event_cts = bytes & TIOCM_CTS; |
1005 |
if (pser_inf->wait_mask & SERIAL_EV_CTS) |
if (pser_inf->wait_mask & SERIAL_EV_CTS) |
1006 |
{ |
{ |
1007 |
DEBUG_SERIAL((" EVENT-> SERIAL_EV_CTS %s\n", (bytes & TIOCM_CTS) ? "ON" : "OFF")); |
DEBUG_SERIAL((" EVENT-> SERIAL_EV_CTS %s\n", |
1008 |
|
(bytes & TIOCM_CTS) ? "ON" : "OFF")); |
1009 |
*result |= SERIAL_EV_CTS; |
*result |= SERIAL_EV_CTS; |
1010 |
ret = True; |
ret = True; |
1011 |
} |
} |