2009-08-19 Marek Safar <marek.safar@gmail.com>
[mono.git] / support / serial.c
index abe409e05b617269da96c9b7f453dbe179d31ca9..c0708a11929529d77ef8ae79abbbce521a10e8b7 100644 (file)
@@ -92,27 +92,19 @@ int
 write_serial (int fd, guchar *buffer, int offset, int count, int timeout)
 {
        struct pollfd pinfo;
+       guint32 n;
 
        pinfo.fd = fd;
        pinfo.events = POLLOUT;
        pinfo.revents = POLLOUT;
 
-       
-       struct timeval tmval;
-       fd_set writefs;
-       guint32 n;
-
        n = count;
 
-       FD_SET(fd, &writefs);
-       tmval.tv_sec = timeout / 1000;
-       tmval.tv_usec = (timeout - tmval.tv_sec) * 1000;        
-       
        while (n > 0)
        {
                size_t t;
                        
-               if (timeout > 0) {
+               if (timeout != 0) {
                        int c;
                        
                        while ((c = poll (&pinfo, 1, timeout)) == -1 && errno == EINTR)
@@ -277,6 +269,7 @@ set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, MonoStop
            
        case Even: /* Even */
            newtio.c_cflag &= ~(PARODD);
+           newtio.c_cflag |= (PARENB);
            break;
            
        case Mark: /* Mark */