121 |
|
|
122 |
/* FIONREAD should really do the same thing as TIOCINQ, where it is |
/* FIONREAD should really do the same thing as TIOCINQ, where it is |
123 |
* not available */ |
* not available */ |
124 |
#ifndef TIOCINQ |
#if !defined(TIOCINQ) && defined(FIONREAD) |
125 |
#define TIOCINQ FIONREAD |
#define TIOCINQ FIONREAD |
126 |
#endif |
#endif |
127 |
#ifndef TIOCOUTQ |
#if !defined(TIOCOUTQ) && defined(FIONWRITE) |
128 |
#define TIOCOUTQ FIONWRITE |
#define TIOCOUTQ FIONWRITE |
129 |
#endif |
#endif |
130 |
|
|
646 |
} |
} |
647 |
tcsetattr(handle, TCSANOW, ptermios); |
tcsetattr(handle, TCSANOW, ptermios); |
648 |
|
|
649 |
#ifdef WITH_DEBUG_SERIAL |
#if defined(WITH_DEBUG_SERIAL) && defined(TIOCINQ) |
650 |
ioctl(handle, TIOCINQ, &bytes_inqueue); |
ioctl(handle, TIOCINQ, &bytes_inqueue); |
651 |
DEBUG_SERIAL(("serial_read inqueue: %d expected %d\n", bytes_inqueue, length)); |
DEBUG_SERIAL(("serial_read inqueue: %d expected %d\n", bytes_inqueue, length)); |
652 |
#endif |
#endif |
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", |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_WAIT_MASK %X\n", |
797 |
pser_inf->wait_mask); out_uint32(out, pser_inf->wait_mask)); |
pser_inf->wait_mask); |
798 |
|
out_uint32(out, pser_inf->wait_mask)); |
799 |
break; |
break; |
800 |
case SERIAL_SET_WAIT_MASK: |
case SERIAL_SET_WAIT_MASK: |
801 |
in_uint32(in, pser_inf->wait_mask); |
in_uint32(in, pser_inf->wait_mask); |
855 |
out_uint32_le(out, 0); /* Hold reasons */ |
out_uint32_le(out, 0); /* Hold reasons */ |
856 |
|
|
857 |
result = 0; |
result = 0; |
858 |
|
#ifdef TIOCINQ |
859 |
ioctl(handle, TIOCINQ, &result); |
ioctl(handle, TIOCINQ, &result); |
860 |
|
#endif |
861 |
out_uint32_le(out, result); /* Amount in in queue */ |
out_uint32_le(out, result); /* Amount in in queue */ |
862 |
if (result) |
if (result) |
863 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_COMMSTATUS in queue %d\n", |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_COMMSTATUS in queue %d\n", |
864 |
result)); |
result)); |
865 |
|
|
866 |
result = 0; |
result = 0; |
867 |
|
#ifdef TIOCOUTQ |
868 |
ioctl(handle, TIOCOUTQ, &result); |
ioctl(handle, TIOCOUTQ, &result); |
869 |
|
#endif |
870 |
out_uint32_le(out, result); /* Amount in out queue */ |
out_uint32_le(out, result); /* Amount in out queue */ |
871 |
if (result) |
if (result) |
872 |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_COMMSTATUS out queue %d\n", result)); |
DEBUG_SERIAL(("serial_ioctl -> SERIAL_GET_COMMSTATUS out queue %d\n", result)); |
939 |
if (index < 0) |
if (index < 0) |
940 |
return False; |
return False; |
941 |
|
|
942 |
|
#ifdef TIOCINQ |
943 |
pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[index].pdevice_data; |
pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[index].pdevice_data; |
944 |
|
|
|
|
|
945 |
ioctl(handle, TIOCINQ, &bytes); |
ioctl(handle, TIOCINQ, &bytes); |
946 |
|
|
947 |
if (bytes > 0) |
if (bytes > 0) |
977 |
{ |
{ |
978 |
pser_inf->event_rlsd = 0; |
pser_inf->event_rlsd = 0; |
979 |
} |
} |
980 |
|
#endif |
981 |
|
|
982 |
|
#ifdef TIOCOUTQ |
983 |
ioctl(handle, TIOCOUTQ, &bytes); |
ioctl(handle, TIOCOUTQ, &bytes); |
984 |
if ((bytes == 0) |
if ((bytes == 0) |
985 |
&& (pser_inf->event_txempty > 0) && (pser_inf->wait_mask & SERIAL_EV_TXEMPTY)) |
&& (pser_inf->event_txempty > 0) && (pser_inf->wait_mask & SERIAL_EV_TXEMPTY)) |
990 |
ret = True; |
ret = True; |
991 |
} |
} |
992 |
pser_inf->event_txempty = bytes; |
pser_inf->event_txempty = bytes; |
993 |
|
#endif |
994 |
|
|
995 |
ioctl(handle, TIOCMGET, &bytes); |
ioctl(handle, TIOCMGET, &bytes); |
996 |
if ((bytes & TIOCM_DSR) != pser_inf->event_dsr) |
if ((bytes & TIOCM_DSR) != pser_inf->event_dsr) |