[Mono-dev] [RFC 08/12] serial: Various workarounds for Haiku
Andreas Färber
andreas.faerber at web.de
Fri Mar 26 09:30:01 EDT 2010
This commit is licensed under the MIT X11 license.
---
support/serial.c | 17 +++++++++++++++++
1 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/support/serial.c b/support/serial.c
index 7968fbb..4cf7fe4 100644
--- a/support/serial.c
+++ b/support/serial.c
@@ -134,6 +134,9 @@ discard_buffer (int fd, gboolean input)
gint32
get_bytes_in_buffer (int fd, gboolean input)
{
+#ifdef __HAIKU__
+ return -1;
+#else
gint32 retval;
if (ioctl (fd, input ? FIONREAD : TIOCOUTQ, &retval) == -1) {
@@ -141,6 +144,7 @@ get_bytes_in_buffer (int fd, gboolean input)
}
return retval;
+#endif
}
gboolean
@@ -331,6 +335,7 @@ set_attributes (int fd, int baud_rate, MonoParity parity, int dataBits, MonoStop
static gint32
get_signal_code (MonoSerialSignal signal)
{
+#ifndef __HAIKU__
switch (signal) {
case Cd:
return TIOCM_CAR;
@@ -345,6 +350,7 @@ get_signal_code (MonoSerialSignal signal)
default:
return 0;
}
+#endif
/* Not reached */
return 0;
@@ -355,6 +361,7 @@ get_mono_signal_codes (int signals)
{
MonoSerialSignal retval = NoneSignal;
+#ifndef __HAIKU__
if ((signals & TIOCM_CAR) != 0)
retval |= Cd;
if ((signals & TIOCM_CTS) != 0)
@@ -365,6 +372,7 @@ get_mono_signal_codes (int signals)
retval |= Dtr;
if ((signals & TIOCM_RTS) != 0)
retval |= Rts;
+#endif
return retval;
}
@@ -372,6 +380,10 @@ get_mono_signal_codes (int signals)
MonoSerialSignal
get_signals (int fd, gint32 *error)
{
+#ifdef __HAIKU__
+ *error = -1;
+ return NoneSignal;
+#else
int signals;
*error = 0;
@@ -382,11 +394,15 @@ get_signals (int fd, gint32 *error)
}
return get_mono_signal_codes (signals);
+#endif
}
gint32
set_signal (int fd, MonoSerialSignal signal, gboolean value)
{
+#ifdef __HAIKU__
+ return -1;
+#else
int signals, expected, activated;
expected = get_signal_code (signal);
@@ -406,6 +422,7 @@ set_signal (int fd, MonoSerialSignal signal, gboolean value)
return -1;
return 1;
+#endif
}
int
--
1.6.5.3
More information about the Mono-devel-list
mailing list