Added List tests
[mono.git] / support / serial.c
index 2df6297e5f9431e6d8dabdd92c44955bead82a3b..8ae46b8a6bfcfd110ee0e63d4bfd512854d1668e 100644 (file)
@@ -11,9 +11,7 @@
 #include <string.h>
 #include <sys/poll.h>
 
-#include <mono/metadata/object.h>
-#include <mono/metadata/appdomain.h>
-#include <mono/metadata/exception.h>
+#include <glib.h>
 
 int
 open_serial (char* devfile)
@@ -57,7 +55,6 @@ read_serial (int fd, guchar *buffer, int offset, int count, int timeout)
        poll (&ufd, 1, timeout);
 
        if ((ufd.revents & POLLIN) != POLLIN) {
-               mono_raise_exception (mono_get_exception_io ("ReadTimeout exceeded"));
                return -1;
        }
  
@@ -79,7 +76,6 @@ write_serial (int fd, guchar *buffer, int offset, int count, int timeout)
        poll (&ufd, 1, timeout);
 
        if ((ufd.revents & POLLOUT) != POLLOUT) {
-               mono_raise_exception (mono_get_exception_io ("WriteTimeout exceeded"));
                return;
        }
  
@@ -171,16 +167,22 @@ set_attributes (int fd, int baud_rate, int parity, int dataBits, int stopBits, i
 
        newtio.c_iflag &= ~IXOFF;
        newtio.c_oflag &= ~IXON;
+#ifdef CRTSCTS
        newtio.c_cflag &= ~CRTSCTS;
+#endif /* def CRTSCTS */
        switch (handshake) {
        case 0: /* None */
                /* do nothing */
                break;
        case 1: /* RequestToSend (RTS) */
+#ifdef CRTSCTS
                newtio.c_cflag |= CRTSCTS;
+#endif /* def CRTSCTS */
                break;
        case 2: /* RequestToSendXOnXOff (RTS + XON/XOFF) */
+#ifdef CRTSCTS
                newtio.c_cflag |= CRTSCTS;
+#endif /* def CRTSCTS */
                /* fall through */
        case 3: /* XOnXOff */
                newtio.c_iflag |= IXOFF;
@@ -196,6 +198,19 @@ set_attributes (int fd, int baud_rate, int parity, int dataBits, int stopBits, i
        return TRUE;
 }
 
+/*
+ * mono internals should not be used here.
+ * this serial stuff needs to be implemented with icalls.
+ * make this at least compile until the code is moved elsewhere
+ * defined(linux) is wrong, too
+ */
+void*
+list_serial_devices (void)
+{
+       return NULL;
+}
+
+#if 0
 MonoArray *
 list_serial_devices (void)
 {
@@ -230,3 +245,5 @@ list_serial_devices (void)
 
        return array;
 }
+#endif
+