| 1 |
From: Steven Chamberlain <[email protected]> |
| 2 |
Subject: use FreeBSD USB I/O code on GNU/kFreeBSD |
| 3 |
|
| 4 |
Use the FreeBSD USB I/O code not just on __FreeBSD__ itself, |
| 5 |
but on any system having __FreeBSD_kernel__ (such as GNU/kFreeBSD). |
| 6 |
|
| 7 |
--- a/spectro/usbio.c |
| 8 |
+++ b/spectro/usbio.c |
| 9 |
@@ -94,7 +94,7 @@ |
| 10 |
# include "usbio_ox.c" |
| 11 |
# endif |
| 12 |
# if defined(UNIX_X11) |
| 13 |
-# if defined(__FreeBSD__) |
| 14 |
+# if defined(__FreeBSD_kernel__) |
| 15 |
# include "usbio_bsd.c" |
| 16 |
# else |
| 17 |
# include "usbio_lx.c" |
| 18 |
--- a/spectro/usbio_bsd.c |
| 19 |
+++ b/spectro/usbio_bsd.c |
| 20 |
@@ -37,7 +37,7 @@ |
| 21 |
#include <fcntl.h> |
| 22 |
#include <glob.h> |
| 23 |
#include <sys/ioctl.h> |
| 24 |
-#if defined(__FreeBSD__) |
| 25 |
+#if defined(__FreeBSD_kernel__) |
| 26 |
# include <dev/usb/usb_ioctl.h> /* Not sure what's going on with FreeBSD... */ |
| 27 |
#else |
| 28 |
# include <dev/usb/usb.h> /* The usual include for BSD */ |
| 29 |
@@ -59,7 +59,7 @@ |
| 30 |
) { |
| 31 |
int i, j; |
| 32 |
char *paths[] = { |
| 33 |
-#if defined(__FreeBSD__) |
| 34 |
+#if defined(__FreeBSD_kernel__) |
| 35 |
"/dev/usb/[0-9]*.*.0", /* FreeBSD >= 8 */ |
| 36 |
"/dev/ugen[0-9]*", /* FreeBSD < 8, but no .E */ |
| 37 |
#else |
| 38 |
@@ -94,7 +94,7 @@ |
| 39 |
/* For all the nodes found by the glob */ |
| 40 |
for (i = 0; i < g.gl_pathc; i++) { |
| 41 |
|
| 42 |
-#if defined(__FreeBSD__) |
| 43 |
+#if defined(__FreeBSD_kernel__) |
| 44 |
/* Skip anything with an end point number */ |
| 45 |
if (j == 1 && strchr(g.gl_pathv[i], '.') != NULL) |
| 46 |
continue; |
| 47 |
@@ -141,7 +141,7 @@ |
| 48 |
|
| 49 |
/* Create the base device path */ |
| 50 |
dpath = g.gl_pathv[i]; |
| 51 |
-#if defined(__FreeBSD__) |
| 52 |
+#if defined(__FreeBSD_kernel__) |
| 53 |
if (j == 0) { /* Remove .0 */ |
| 54 |
if ((cp = strrchr(dpath, '.')) != NULL |
| 55 |
&& cp[1] == '0' && cp[2] == '\000') |