CVS: rdesktop serial.c,1.11,1.12
Peter Bystr?m <[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-serv10414
Modified Files:
serial.c
Log Message:
error handling, rts, figured out modemstatus and some constants - volker milde
Index: serial.c
===================================================================
RCS file: /cvsroot/rdesktop/rdesktop/serial.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** serial.c 15 Feb 2004 21:19:28 -0000 1.11
--- serial.c 4 Mar 2004 08:01:07 -0000 1.12
***************
*** 54,57 ****
--- 54,78 ----
#define EVEN_PARITY 2
+ #define SERIAL_PURGE_TXABORT 0x00000001
+ #define SERIAL_PURGE_RXABORT 0x00000002
+ #define SERIAL_PURGE_TXCLEAR 0x00000004
+ #define SERIAL_PURGE_RXCLEAR 0x00000008
+
+ /* SERIAL_WAIT_ON_MASK */
+ #define SERIAL_EV_RXCHAR 0x0001 // Any Character received
+ #define SERIAL_EV_RXFLAG 0x0002 // Received certain character
+ #define SERIAL_EV_TXEMPTY 0x0004 // Transmitt Queue Empty
+ #define SERIAL_EV_CTS 0x0008 // CTS changed state
+ #define SERIAL_EV_DSR 0x0010 // DSR changed state
+ #define SERIAL_EV_RLSD 0x0020 // RLSD changed state
+ #define SERIAL_EV_BREAK 0x0040 // BREAK received
+ #define SERIAL_EV_ERR 0x0080 // Line status error occurred
+ #define SERIAL_EV_RING 0x0100 // Ring signal detected
+ #define SERIAL_EV_PERR 0x0200 // Printer error occured
+ #define SERIAL_EV_RX80FULL 0x0400 // Receive buffer is 80 percent full
+ #define SERIAL_EV_EVENT1 0x0800 // Provider specific event 1
+ #define SERIAL_EV_EVENT2 0x1000 // Provider specific event 2
+
+
extern RDPDR_DEVICE g_rdpdr_device[];
***************
*** 187,190 ****
--- 208,213 ----
}
+ pser_inf->rts = (ptermios->c_cflag & CRTSCTS) ? 1 : 0;
+
return True;
}
***************
*** 287,291 ****
cfsetospeed(pser_inf->ptermios, pser_inf->dtr ? speed : 0);
! ptermios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CSIZE);
switch (pser_inf->stop_bits)
{
--- 310,314 ----
cfsetospeed(pser_inf->ptermios, pser_inf->dtr ? speed : 0);
! ptermios->c_cflag &= ~(CSTOPB | PARENB | PARODD | CSIZE | CRTSCTS);
switch (pser_inf->stop_bits)
{
***************
*** 294,297 ****
--- 317,321 ----
break;
}
+
switch (pser_inf->parity)
{
***************
*** 303,306 ****
--- 327,331 ----
break;
}
+
switch (pser_inf->word_length)
{
***************
*** 319,322 ****
--- 344,350 ----
}
+ if (pser_inf->rts)
+ ptermios->c_cflag |= CRTSCTS;
+
tcsetattr(serial_fd, TCSANOW, ptermios);
}
***************
*** 384,388 ****
--- 412,420 ----
if (!get_termios(pser_inf, serial_fd))
+ {
+ printf("INFO: SERIAL %s access denied\n", g_rdpdr_device[device_id].name);
+ fflush(stdout);
return STATUS_ACCESS_DENIED;
+ }
// Store handle for later use
***************
*** 390,394 ****
/* some sane information */
! printf("INFO: SERIAL %s to %s\nINFO: speed %u baud, stop bits %u, parity %u, word length %u bits, dtr %u\n", g_rdpdr_device[device_id].name, g_rdpdr_device[device_id].local_path, pser_inf->baud_rate, pser_inf->stop_bits, pser_inf->parity, pser_inf->word_length, pser_inf->dtr);
printf("INFO: use stty to change settings\n");
--- 422,427 ----
/* some sane information */
! printf("INFO: SERIAL %s to %s\nINFO: speed %u baud, stop bits %u, parity %u, word length %u bits, dtr %u, rts %u\n", g_rdpdr_device[device_id].name, g_rdpdr_device[device_id].local_path, pser_inf->baud_rate, pser_inf->stop_bits, pser_inf->parity, pser_inf->word_length, pser_inf->dtr, pser_inf->rts);
!
printf("INFO: use stty to change settings\n");
***************
*** 413,417 ****
serial_close(HANDLE handle)
{
! g_rdpdr_device[get_device_index(handle)].handle = 0;
close(handle);
return STATUS_SUCCESS;
--- 446,452 ----
serial_close(HANDLE handle)
{
! int i = get_device_index(handle);
! if (i >= 0)
! g_rdpdr_device[i].handle = 0;
close(handle);
return STATUS_SUCCESS;
***************
*** 460,463 ****
--- 495,500 ----
*result = read(handle, data, length);
+ //hexdump(data, *read);
+
return STATUS_SUCCESS;
}
***************
*** 473,476 ****
--- 510,514 ----
serial_device_control(HANDLE handle, uint32 request, STREAM in, STREAM out)
{
+ int flush_mask, purge_mask;
uint32 result;
uint8 immediate;
***************
*** 556,568 ****
set_termios(pser_inf, handle);
break;
! #if 0
! case SERIAL_WAIT_ON_MASK:
! /* XXX implement me */
break;
! case SERIAL_SET_BREAK_ON:
! tcsendbreak(serial_fd, 0);
break;
case SERIAL_PURGE:
-
printf("SERIAL_PURGE\n");
in_uint32(in, purge_mask);
--- 594,618 ----
set_termios(pser_inf, handle);
break;
! case SERIAL_SET_RTS:
! pser_inf->rts = 1;
! set_termios(pser_inf, handle);
break;
! case SERIAL_CLR_RTS:
! pser_inf->rts = 0;
! set_termios(pser_inf, handle);
! break;
! case SERIAL_GET_MODEMSTATUS:
! out_uint32_le(out, 0); /* Errors */
! break;
! case SERIAL_GET_COMMSTATUS:
! out_uint32_le(out, 0); /* Errors */
! out_uint32_le(out, 0); /* Hold reasons */
! out_uint32_le(out, 0); /* Amount in in queue */
! out_uint32_le(out, 0); /* Amount in out queue */
! out_uint8(out, 0); /* EofReceived */
! out_uint8(out, 0); /* WaitForImmediate */
break;
+ #if 0
case SERIAL_PURGE:
printf("SERIAL_PURGE\n");
in_uint32(in, purge_mask);
***************
*** 578,586 ****
rdpdr_abort_io(handle, 3, STATUS_CANCELLED);
break;
!
case SERIAL_RESET_DEVICE:
case SERIAL_SET_BREAK_OFF:
- case SERIAL_SET_RTS:
- case SERIAL_CLR_RTS:
case SERIAL_SET_XOFF:
case SERIAL_SET_XON:
--- 628,640 ----
rdpdr_abort_io(handle, 3, STATUS_CANCELLED);
break;
! case SERIAL_WAIT_ON_MASK:
! /* XXX implement me */
! out_uint32_le(out, pser_inf->wait_mask);
! break;
! case SERIAL_SET_BREAK_ON:
! tcsendbreak(serial_fd, 0);
! break;
case SERIAL_RESET_DEVICE:
case SERIAL_SET_BREAK_OFF:
case SERIAL_SET_XOFF:
case SERIAL_SET_XON:
***************
*** 588,592 ****
break;
#endif
-
default:
unimpl("SERIAL IOCTL %d\n", request);
--- 642,645 ----
***************
*** 605,608 ****
--- 658,663 ----
index = get_device_index(handle);
+ if (index < 0)
+ return True;
if (g_rdpdr_device[index].device_type != DEVICE_TYPE_SERIAL)
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click