| 1 |
Description: Defines FreeBSD for kFreeBSD systems, also makes sure kfreeBSD is set to use FHS |
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=585089 |
| 10 |
Author: Scott Howard <[email protected]> |
| 11 |
|
| 12 |
Index: rxtx/src/RS485Imp.c |
| 13 |
=================================================================== |
| 14 |
--- rxtx.orig/src/RS485Imp.c 2011-02-23 22:53:43.393378664 -0500 |
| 15 |
+++ rxtx/src/RS485Imp.c 2011-02-23 22:53:52.663072550 -0500 |
| 16 |
@@ -120,11 +120,11 @@ |
| 17 |
threads, because it slows things down. Go figure. */ |
| 18 |
|
| 19 |
/* POSIX signal handling functions */ |
| 20 |
|
| 21 |
+#if !defined(__FreeBSD_kernel___) |
| 22 |
struct sigaction handler; |
| 23 |
sigaction( SIGIO, NULL, &handler ); |
| 24 |
if( !handler.sa_handler ) signal( SIGIO, SIG_IGN ); |
| 25 |
|
| 26 |
+#endif /* !__FreeBSD_kernel__ */ |
| 27 |
#if defined(__linux__) |
| 28 |
/* Lets let people who upgraded kernels know they may have problems */ |
| 29 |
if (uname (&name) == -1) |
| 30 |
@@ -178,7 +178,7 @@ |
| 31 |
ttyset.c_cc[ VMIN ] = 0; |
| 32 |
ttyset.c_cc[ VTIME ] = 0; |
| 33 |
|
| 34 |
|
| 35 |
+#ifdef __FreeBSD_kernel__ |
| 36 |
if( cfsetspeed( &ttyset, B9600 ) < 0 ) goto fail; |
| 37 |
#else |
| 38 |
if( cfsetispeed( &ttyset, B9600 ) < 0 ) goto fail; |
| 39 |
@@ -238,7 +238,7 @@ |
| 40 |
if( !translate_data_bits( env, (int *)&(ttyset.c_cflag), dataBits ) ) return; /* dima c_cflag in darwin is unsigned long */ |
| 41 |
if( !translate_stop_bits( env, (int *)&(ttyset.c_cflag), stopBits ) ) return; /* dima c_cflag in darwin is unsigned long */ |
| 42 |
if( !translate_parity( env, (int *)&(ttyset.c_cflag), parity ) ) return;/* dima c_cflag in darwin is unsigned long */ |
| 43 |
|
| 44 |
+#ifdef __FreeBSD_kernel__ |
| 45 |
if( cfsetspeed( &ttyset, cspeed ) < 0 ) goto fail; |
| 46 |
#else |
| 47 |
if( cfsetispeed( &ttyset, cspeed ) < 0 ) goto fail; |
| 48 |
@@ -1290,7 +1290,7 @@ |
| 49 |
return(JNI_FALSE); |
| 50 |
} |
| 51 |
#endif |
| 52 |
|
| 53 |
+#if defined(__FreeBSD_kernel__) |
| 54 |
if(!strcmp(name,"tty0")|| !strcmp(name,"ttyd")|| |
| 55 |
!strcmp(name,"ttyq")|| !strcmp(name,"ttym")|| |
| 56 |
!strcmp(name,"ttyf")|| !strcmp(name,"ttyS")|| |
| 57 |
Index: rxtx/src/RawImp.c |
| 58 |
=================================================================== |
| 59 |
--- rxtx.orig/src/RawImp.c 2011-02-23 22:53:43.413378002 -0500 |
| 60 |
+++ rxtx/src/RawImp.c 2011-02-23 22:53:52.663072550 -0500 |
| 61 |
@@ -265,11 +265,11 @@ |
| 62 |
threads, because it slows things down. Go figure. */ |
| 63 |
|
| 64 |
/* POSIX signal handling functions */ |
| 65 |
|
| 66 |
+#if !defined(__FreeBSD_kernel___) |
| 67 |
struct sigaction handler; |
| 68 |
sigaction( SIGIO, NULL, &handler ); |
| 69 |
if( !handler.sa_handler ) signal( SIGIO, SIG_IGN ); |
| 70 |
|
| 71 |
+#endif /* !__FreeBSD_kernel__ */ |
| 72 |
#if defined(__linux__) |
| 73 |
/* Lets let people who upgraded kernels know they may have problems */ |
| 74 |
if (uname (&name) == -1) |
| 75 |
@@ -307,7 +307,7 @@ |
| 76 |
if( !translate_data_bits( env, (int *)&(ttyset.c_cflag), dataBits ) ) return; /* dima c_flag darwin unsigned long */ |
| 77 |
if( !translate_stop_bits( env, (int *)&(ttyset.c_cflag), stopBits ) ) return; /* dima c_flag darwin unsigned long */ |
| 78 |
if( !translate_parity( env, (int *)&(ttyset.c_cflag), parity ) ) return;/* dima c_flag darwin unsigned long */ |
| 79 |
|
| 80 |
+#ifdef __FreeBSD_kernel__ |
| 81 |
if( cfsetspeed( &ttyset, cspeed ) < 0 ) goto fail; |
| 82 |
#else |
| 83 |
if( cfsetispeed( &ttyset, cspeed ) < 0 ) goto fail; |
| 84 |
@@ -1289,7 +1289,7 @@ |
| 85 |
return(JNI_FALSE); |
| 86 |
} |
| 87 |
#endif |
| 88 |
|
| 89 |
+#if defined(__FreeBSD_kernel__) |
| 90 |
if(!strcmp(name,"tty0")|| !strcmp(name,"ttyd")|| |
| 91 |
!strcmp(name,"ttyq")|| !strcmp(name,"ttym")|| |
| 92 |
!strcmp(name,"ttyf")|| !strcmp(name,"ttyS")|| |
| 93 |
Index: rxtx/src/SerialImp.h |
| 94 |
=================================================================== |
| 95 |
--- rxtx.orig/src/SerialImp.h 2011-02-23 22:53:43.423377671 -0500 |
| 96 |
+++ rxtx/src/SerialImp.h 2011-02-23 22:55:45.573475048 -0500 |
| 97 |
@@ -97,7 +97,7 @@ |
| 98 |
|
| 99 |
/* glue for unsupported linux speeds see also win32termios.h */ |
| 100 |
|
| 101 |
|
| 102 |
+#if !defined(__APPLE__) && !defined(__FreeBSD_kernel__) /* dima */ |
| 103 |
/* this is now handled in SerialImp.c |
| 104 |
#define B14400 1010001 |
| 105 |
#define B28800 1010002 |
| 106 |
@@ -147,7 +147,7 @@ |
| 107 |
}; |
| 108 |
|
| 109 |
/* Ports known on the OS */ |
| 110 |
|
| 111 |
+#if defined(__linux__) || defined(__FreeBSD_kernel__) |
| 112 |
/* |
| 113 |
This is a small hack to get mark and space parity working on older systems |
| 114 |
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=147533 |
| 115 |
Index: rxtx/src/SerialImp.c |
| 116 |
=================================================================== |
| 117 |
--- rxtx.orig/src/SerialImp.c 2011-02-23 22:53:43.443377009 -0500 |
| 118 |
+++ rxtx/src/SerialImp.c 2011-02-23 22:53:52.663072550 -0500 |
| 119 |
@@ -423,7 +423,7 @@ |
| 120 |
ttyset.c_cc[ VMIN ] = 0; |
| 121 |
ttyset.c_cc[ VTIME ] = 0; |
| 122 |
|
| 123 |
|
| 124 |
+#ifdef __FreeBSD_kernel__ |
| 125 |
if( cfsetspeed( &ttyset, B9600 ) < 0 ) goto fail; |
| 126 |
#else |
| 127 |
if( cfsetispeed( &ttyset, B9600 ) < 0 ) goto fail; |
| 128 |
@@ -844,13 +844,13 @@ |
| 129 |
return(1); |
| 130 |
} |
| 131 |
|
| 132 |
|
| 133 |
+#ifdef __FreeBSD_kernel__ |
| 134 |
if( cfsetspeed( &ttyset, cspeed ) < 0 ) |
| 135 |
{ |
| 136 |
report( "set_port_params: Cannot Set Speed\n" ); |
| 137 |
return( 1 ); |
| 138 |
} |
| 139 |
|
| 140 |
+#endif /* __FreeBSD_kernel__ */ |
| 141 |
if( !cspeed ) |
| 142 |
{ |
| 143 |
/* hang up the modem aka drop DTR */ |
| 144 |
@@ -4705,7 +4705,7 @@ |
| 145 |
stat(teststring,&mystat); |
| 146 |
#endif /* __sun__ */ |
| 147 |
/* XXX the following hoses freebsd when it tries to open the port later on */ |
| 148 |
|
| 149 |
+#ifndef __FreeBSD_kernel__ |
| 150 |
if(S_ISCHR(mystat.st_mode)){ |
| 151 |
fd=OPEN(teststring,O_RDONLY|O_NONBLOCK); |
| 152 |
if (fd>0){ |
| 153 |
Index: rxtx/src/ParallelImp.c |
| 154 |
=================================================================== |
| 155 |
--- rxtx.orig/src/ParallelImp.c 2011-02-23 22:53:43.463376347 -0500 |
| 156 |
+++ rxtx/src/ParallelImp.c 2011-02-23 22:53:52.663072550 -0500 |
| 157 |
@@ -111,7 +111,7 @@ |
| 158 |
#if defined(__linux__) |
| 159 |
# include <linux/lp.h> |
| 160 |
#endif |
| 161 |
|
| 162 |
+#if defined(__FreeBSD_kernel__) |
| 163 |
/* # include <machine/lpt.h> ? is this changed or wrong */ |
| 164 |
# include <dev/ppbus/lpt.h> |
| 165 |
#endif |
| 166 |
@@ -265,7 +265,7 @@ |
| 167 |
#if defined(__linux__) |
| 168 |
return( status & LP_BUSY ? JNI_TRUE : JNI_FALSE ); |
| 169 |
#endif |
| 170 |
|
| 171 |
+#if defined(__FreeBSD_kernel__) |
| 172 |
return( status & EBUSY ? JNI_TRUE : JNI_FALSE ); |
| 173 |
#endif |
| 174 |
return(JNI_FALSE); |
| 175 |
@@ -341,7 +341,7 @@ |
| 176 |
ioctl(fd, LPGETSTATUS, &status); |
| 177 |
return( status & LP_BUSY ? JNI_TRUE : JNI_FALSE ); |
| 178 |
#endif |
| 179 |
|
| 180 |
+#if defined(__FreeBSD_kernel__) |
| 181 |
printf("ParallelImp.c LPGETSTATUS not defined\n"); |
| 182 |
/* |
| 183 |
return( status & EBUSY ? JNI_TRUE : JNI_FALSE ); |
| 184 |
Index: rxtx/src/I2CImp.c |
| 185 |
=================================================================== |
| 186 |
--- rxtx.orig/src/I2CImp.c 2011-02-23 22:53:43.483375685 -0500 |
| 187 |
+++ rxtx/src/I2CImp.c 2011-02-23 22:53:52.663072550 -0500 |
| 188 |
@@ -120,11 +120,11 @@ |
| 189 |
threads, because it slows things down. Go figure. */ |
| 190 |
|
| 191 |
/* POSIX signal handling functions */ |
| 192 |
|
| 193 |
+#if !defined(__FreeBSD_kernel___) |
| 194 |
struct sigaction handler; |
| 195 |
sigaction( SIGIO, NULL, &handler ); |
| 196 |
if( !handler.sa_handler ) signal( SIGIO, SIG_IGN ); |
| 197 |
|
| 198 |
+#endif /* !__FreeBSD_kernel__ */ |
| 199 |
#if defined(__linux__) |
| 200 |
/* Lets let people who upgraded kernels know they may have problems */ |
| 201 |
if (uname (&name) == -1) |
| 202 |
@@ -178,7 +178,7 @@ |
| 203 |
ttyset.c_cc[ VMIN ] = 0; |
| 204 |
ttyset.c_cc[ VTIME ] = 0; |
| 205 |
|
| 206 |
|
| 207 |
+#ifdef __FreeBSD_kernel__ |
| 208 |
if( cfsetspeed( &ttyset, B9600 ) < 0 ) goto fail; |
| 209 |
#else |
| 210 |
if( cfsetispeed( &ttyset, B9600 ) < 0 ) goto fail; |
| 211 |
@@ -238,7 +238,7 @@ |
| 212 |
if( !translate_data_bits( env, (int *)&(ttyset.c_cflag), dataBits ) ) return; /* dima darwin defime c_cflag as unsigned long */ |
| 213 |
if( !translate_stop_bits( env, (int *)&(ttyset.c_cflag), stopBits ) ) return; /* dima darwin defime c_cflag as unsigned long */ |
| 214 |
if( !translate_parity( env, (int *)&(ttyset.c_cflag), parity ) ) return;/* dima darwin defime c_cflag as unsigned long */ |
| 215 |
|
| 216 |
+#ifdef __FreeBSD_kernel__ |
| 217 |
if( cfsetspeed( &ttyset, cspeed ) < 0 ) goto fail; |
| 218 |
#else |
| 219 |
if( cfsetispeed( &ttyset, cspeed ) < 0 ) goto fail; |
| 220 |
@@ -1220,7 +1220,7 @@ |
| 221 |
return(JNI_FALSE); |
| 222 |
} |
| 223 |
#endif |
| 224 |
|
| 225 |
+#if defined(__FreeBSD_kernel__) |
| 226 |
if(!strcmp(name,"tty0")|| !strcmp(name,"ttyd")|| |
| 227 |
!strcmp(name,"ttyq")|| !strcmp(name,"ttym")|| |
| 228 |
!strcmp(name,"ttyf")|| !strcmp(name,"ttyS")|| |
| 229 |
Index: rxtx/src/SerialImp.cpp |
| 230 |
=================================================================== |
| 231 |
--- rxtx.orig/src/SerialImp.cpp 2011-02-23 22:53:43.503375023 -0500 |
| 232 |
+++ rxtx/src/SerialImp.cpp 2011-02-23 22:53:52.663072550 -0500 |
| 233 |
@@ -135,11 +135,11 @@ |
| 234 |
threads, because it slows things down. Go figure. */ |
| 235 |
|
| 236 |
/* POSIX signal handling functions */ |
| 237 |
|
| 238 |
+#if !defined(__FreeBSD_kernel___) |
| 239 |
struct sigaction handler; |
| 240 |
sigaction( SIGIO, NULL, &handler ); |
| 241 |
if( !handler.sa_handler ) signal( SIGIO, SIG_IGN ); |
| 242 |
|
| 243 |
+#endif /* !__FreeBSD_kernel__ */ |
| 244 |
#ifdef DEBUG |
| 245 |
/* Lets let people who upgraded kernels know they may have problems */ |
| 246 |
if (uname (&name) == -1) |
| 247 |
Index: rxtx/CNI/SerialImp.h |
| 248 |
=================================================================== |
| 249 |
--- rxtx.orig/CNI/SerialImp.h 2011-02-23 22:53:43.523374359 -0500 |
| 250 |
+++ rxtx/CNI/SerialImp.h 2011-02-23 22:53:52.663072550 -0500 |
| 251 |
@@ -97,7 +97,7 @@ |
| 252 |
|
| 253 |
/* glue for unsupported linux speeds see also win32termios.h */ |
| 254 |
|
| 255 |
|
| 256 |
+#if !defined(__APPLE__) && !defined(__FreeBSD_kernel__) /* dima */ |
| 257 |
/* this is now handled in SerialImp.c |
| 258 |
#define B14400 1010001 |
| 259 |
#define B28800 1010002 |
| 260 |
@@ -165,7 +165,7 @@ |
| 261 |
# define LOCKFILEPREFIX "LK." |
| 262 |
# define UUCP |
| 263 |
#endif /* __sgi__ || sgi */ |
| 264 |
|
| 265 |
+#if defined(__FreeBSD_kernel__) |
| 266 |
# define DEVICEDIR "/dev/" |
| 267 |
# define LOCKDIR "/var/spool/uucp" |
| 268 |
# define LOCKFILEPREFIX "LK." |
| 269 |
@@ -176,7 +176,7 @@ |
| 270 |
# define LOCKDIR "/var/spool/uucp" |
| 271 |
# define LOCKFILEPREFIX "LK." |
| 272 |
# define UUCP |
| 273 |
|
| 274 |
+#endif /* __FreeBSD_kernel__ */ |
| 275 |
#if defined(__NetBSD__) |
| 276 |
# define DEVICEDIR "/dev/" |
| 277 |
# define LOCKDIR "/usr/spool/uucp" |
| 278 |
Index: rxtx/CNI/SerialImp.c |
| 279 |
=================================================================== |
| 280 |
--- rxtx.orig/CNI/SerialImp.c 2011-02-23 22:53:43.543373697 -0500 |
| 281 |
+++ rxtx/CNI/SerialImp.c 2011-02-23 22:53:52.663072550 -0500 |
| 282 |
@@ -382,7 +382,7 @@ |
| 283 |
ttyset.c_cc[ VMIN ] = 0; |
| 284 |
ttyset.c_cc[ VTIME ] = 0; |
| 285 |
|
| 286 |
|
| 287 |
+#ifdef __FreeBSD_kernel__ |
| 288 |
if( cfsetspeed( &ttyset, B9600 ) < 0 ) goto fail; |
| 289 |
#else |
| 290 |
if( cfsetispeed( &ttyset, B9600 ) < 0 ) goto fail; |
| 291 |
@@ -686,13 +686,13 @@ |
| 292 |
return(1); |
| 293 |
} |
| 294 |
|
| 295 |
|
| 296 |
+#ifdef __FreeBSD_kernel__ |
| 297 |
if( cfsetspeed( &ttyset, cspeed ) < 0 ) |
| 298 |
{ |
| 299 |
report( "set_port_params: Cannot Set Speed\n" ); |
| 300 |
return( 1 ); |
| 301 |
} |
| 302 |
|
| 303 |
+#endif /* __FreeBSD_kernel__ */ |
| 304 |
if( !cspeed ) |
| 305 |
{ |
| 306 |
/* hang up the modem aka drop DTR */ |
| 307 |
@@ -4257,7 +4257,7 @@ |
| 308 |
stat(teststring,&mystat); |
| 309 |
#endif /* __sun__ */ |
| 310 |
/* XXX the following hoses freebsd when it tries to open the port later on */ |
| 311 |
|
| 312 |
+#ifndef __FreeBSD_kernel__ |
| 313 |
if(S_ISCHR(mystat.st_mode)){ |
| 314 |
fd=::OPEN(teststring,O_RDONLY|O_NONBLOCK); |
| 315 |
if (fd>0){ |