From 65a649565d54bd03e251f6dffee64589e0dcf64a Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Tue, 24 Aug 2004 21:37:25 +0000 Subject: [PATCH] Applied serial-fixes from Huang Yushuo Tested connection with ZOC and HyperTerm on Windows git-svn-id: svn://svn.code.sf.net/p/rdesktop/code/trunk/rdesktop@754 423420c4-83ab-492f-b58f-81f9feb106b5 --- rdpdr.c | 3 ++- serial.c | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rdpdr.c b/rdpdr.c index f76ba0c..867727a 100644 --- a/rdpdr.c +++ b/rdpdr.c @@ -940,7 +940,8 @@ rdpdr_check_fds(fd_set * rfds, fd_set * wfds, BOOL timed_out) /* only delete link if all data has been transfered */ /* or if result was 0 and status success - EOF */ if ((iorq->partial_len == iorq->length) || - (result == 0)) + (g_rdpdr_device[iorq->device].device_type == + DEVICE_TYPE_SERIAL) || (result == 0)) { #if WITH_DEBUG_RDP5 DEBUG(("RDPDR: AIO total %u bytes read of %u\n", iorq->partial_len, iorq->length)); diff --git a/serial.c b/serial.c index de34db5..eca326c 100644 --- a/serial.c +++ b/serial.c @@ -374,7 +374,9 @@ serial_enum_devices(uint32 * id, char *optarg) // Init data structures for device pser_inf = (SERIAL_DEVICE *) xmalloc(sizeof(SERIAL_DEVICE)); pser_inf->ptermios = (struct termios *) xmalloc(sizeof(struct termios)); + memset(pser_inf->ptermios, 0, sizeof(struct termios)); pser_inf->pold_termios = (struct termios *) xmalloc(sizeof(struct termios)); + memset(pser_inf->pold_termios, 0, sizeof(struct termios)); pos2 = next_arg(optarg, '='); strcpy(g_rdpdr_device[*id].name, optarg); @@ -406,7 +408,7 @@ serial_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposi pser_inf = (SERIAL_DEVICE *) g_rdpdr_device[device_id].pdevice_data; ptermios = pser_inf->ptermios; - serial_fd = open(g_rdpdr_device[device_id].local_path, O_RDWR | O_NOCTTY); + serial_fd = open(g_rdpdr_device[device_id].local_path, O_RDWR | O_NOCTTY | O_NONBLOCK); if (serial_fd == -1) { @@ -437,6 +439,7 @@ serial_create(uint32 device_id, uint32 access, uint32 share_mode, uint32 disposi tcsetattr(serial_fd, TCSANOW, ptermios); */ + cfmakeraw(pser_inf->ptermios); *handle = serial_fd; /* all read and writes should be non blocking */