120 lines
3.3 KiB
Diff
120 lines
3.3 KiB
Diff
From cfd620b3d0cd312f21f2e97c732796e549e6750e Mon Sep 17 00:00:00 2001
|
|
From: Gerasim Troeglazov <3dEyes@gmail.com>
|
|
Date: Sat, 11 Apr 2015 15:11:24 +1000
|
|
Subject: [PATCH 1/1] Add Haiku support
|
|
|
|
---
|
|
src/SerialImp.c | 16 +++++++++++++---
|
|
src/SerialImp.h | 6 ++++++
|
|
src/gnu/io/RXTXCommDriver.java | 9 ++++++++-
|
|
3 files changed, 27 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/SerialImp.c b/src/SerialImp.c
|
|
index 617eaac..1352581 100644
|
|
--- a/src/SerialImp.c
|
|
+++ b/src/SerialImp.c
|
|
@@ -148,6 +148,11 @@
|
|
#include <lockdev.h>
|
|
#endif /* LIBLOCKDEV */
|
|
|
|
+#ifdef __HAIKU__
|
|
+#define major(x) (0)
|
|
+#define minor(x) (0)
|
|
+#endif
|
|
+
|
|
extern int errno;
|
|
|
|
#ifdef WIN32
|
|
@@ -288,7 +293,7 @@ JNIEXPORT void JNICALL RXTXPort(Initialize)(
|
|
threads, because it slows things down. Go figure. */
|
|
|
|
/* POSIX signal handling functions */
|
|
-#if !defined(WIN32)
|
|
+#if !defined(WIN32) && !defined(__HAIKU__)
|
|
struct sigaction old_action;
|
|
sigaction(SIGIO, NULL, &old_action);
|
|
/* green threads already has handler, no touch */
|
|
@@ -426,7 +431,7 @@ int configure_port( int fd )
|
|
if( cfsetospeed( &ttyset, B9600 ) < 0 ) goto fail;
|
|
#endif
|
|
if( tcsetattr( fd, TCSANOW, &ttyset ) < 0 ) goto fail;
|
|
-#ifndef WIN32
|
|
+#if !defined(WIN32) && !defined(__HAIKU__)
|
|
fcntl( fd, F_SETOWN, getpid() );
|
|
#endif /* WIN32 */
|
|
#ifdef FASYNC
|
|
@@ -566,8 +571,10 @@ void set_java_vars( JNIEnv *env, jobject jobj, int fd )
|
|
|
|
|
|
switch( ttyset.c_cflag&CSIZE ) {
|
|
+#ifndef __HAIKU__
|
|
case CS5: databits = JDATABITS_5; break;
|
|
case CS6: databits = JDATABITS_6; break;
|
|
+#endif
|
|
case CS7: databits = JDATABITS_7; break;
|
|
case CS8: databits = JDATABITS_8; break;
|
|
}
|
|
@@ -2774,8 +2781,10 @@ JNIEXPORT jint JNICALL RXTXPort(nativeStaticGetDataBits)( JNIEnv *env, jobject j
|
|
return(-1);
|
|
}
|
|
switch( ttyset.c_cflag&CSIZE ) {
|
|
+#ifndef __HAIKU__
|
|
case CS5: return JDATABITS_5;
|
|
case CS6: return JDATABITS_6;
|
|
+#endif
|
|
case CS7: return JDATABITS_7;
|
|
case CS8: return JDATABITS_8;
|
|
default: return(-1);
|
|
@@ -3962,9 +3971,10 @@ void check_tiocmget_changes( struct event_info_struct * eis )
|
|
send_event( eis, SPE_DSR, change );
|
|
}
|
|
|
|
+#ifndef __HAIKU__
|
|
change = (mflags&TIOCM_RNG) - (eis->omflags&TIOCM_RNG);
|
|
if( eis && change ) send_event( eis, SPE_RI, change );
|
|
-
|
|
+#endif
|
|
change = (mflags&TIOCM_CD) - (eis->omflags&TIOCM_CD);
|
|
if( eis && change ) send_event( eis, SPE_CD, change );
|
|
|
|
diff --git a/src/SerialImp.h b/src/SerialImp.h
|
|
index 2677c28..f0820e1 100644
|
|
--- a/src/SerialImp.h
|
|
+++ b/src/SerialImp.h
|
|
@@ -271,6 +271,12 @@ Trent
|
|
# define LOCKFILEPREFIX ""
|
|
# define UUCP
|
|
#endif /* __BEOS__ */
|
|
+#if defined(__HAIKU__)
|
|
+# define DEVICEDIR "/dev/ports/"
|
|
+# define LOCKDIR "/var"
|
|
+# define LOCKFILEPREFIX ""
|
|
+# define UUCP
|
|
+#endif /* __BEOS__ */
|
|
#if defined(WIN32)
|
|
# define DEVICEDIR "//./"
|
|
# define LOCKDIR ""
|
|
diff --git a/src/gnu/io/RXTXCommDriver.java b/src/gnu/io/RXTXCommDriver.java
|
|
index 75929c1..0ce9333 100644
|
|
--- a/src/gnu/io/RXTXCommDriver.java
|
|
+++ b/src/gnu/io/RXTXCommDriver.java
|
|
@@ -848,7 +848,14 @@ public class RXTXCommDriver implements CommDriver
|
|
};
|
|
CandidatePortPrefixes=Temp;
|
|
}
|
|
-
|
|
+ else if(osName.equals("Haiku"))
|
|
+ {
|
|
+ String[] Temp = {
|
|
+ "serial",
|
|
+ "usb"
|
|
+ };
|
|
+ CandidatePortPrefixes=Temp;
|
|
+ }
|
|
else if(osName.equals("BeOS"))
|
|
{
|
|
String[] Temp = {
|
|
--
|
|
2.2.2
|
|
|