summaryrefslogtreecommitdiff
path: root/print/cups/patches/patch-ac
blob: 9e555f73b844fe4c81b98a67bce12febf2f7b827 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
$NetBSD: patch-ac,v 1.4 2000/12/21 14:59:38 jlam Exp $

--- backend/serial.c.orig	Wed Dec  6 17:56:08 2000
+++ backend/serial.c
@@ -48,9 +48,9 @@
 #  include <unistd.h>
 #  include <fcntl.h>
 #  include <termios.h>
-#  ifdef __linux
+#  ifdef HAVE_SYS_IOCTL_H
 #    include <sys/ioctl.h>
-#  endif /* __linux */
+#  endif /* HAVE_SYS_IOCTL_H */
 #endif /* WIN32 || __EMX__ */
 
 #ifdef __sgi
@@ -484,10 +484,10 @@
 void
 list_devices(void)
 {
-#if defined(__hpux) || defined(__sgi) || defined(__sun)
+#if defined(__hpux) || defined(__sgi) || defined(__sun) || defined(__FreeBSD__) || defined(__OpenBSD__)
   static char	*funky_hex = "0123456789abcdefghijklmnopqrstuvwxyz";
 				/* Funky hex numbering used for some devices */
-#endif /* __hpux || __sgi || __sun */
+#endif /* __hpux || __sgi || __sun || __FreeBSD__ || __OpenBSD__ */
 
 #ifdef __linux
   int	i;		/* Looping var */
@@ -718,7 +718,7 @@
       printf("serial serial:%s?baud=38400 \"Unknown\" \"Serial Port #%d\"\n",
              device, i + 1);
   }
-#elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__)
+#elif defined(__FreeBSD__) || defined(__OpenBSD__)
   int	i, j;		/* Looping vars */
   int	fd;		/* File descriptor */
   char	device[255];	/* Device filename */
@@ -800,6 +800,42 @@
              device, i + 1);
     }
   }
+#elif defined(__NetBSD__)
+  int	i, j;		/* Looping vars */
+  int	fd;		/* File descriptor */
+  char	device[255];	/* Device filename */
+
+
+ /*
+  * Standard serial ports...
+  */
+
+  for (i = 0; i < 4; i ++)
+  {
+    sprintf(device, "/dev/tty%02d", i);
+    if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+    {
+      close(fd);
+      printf("serial serial:%s?baud=115200 \"Unknown\" \"Serial Port #%d\"\n",
+             device, i + 1);
+    }
+  }
+
+ /*
+  * Cyclades-Z ports...
+  */
+
+  for (i = 0; i < 16; i ++) /* Should be up to 65536 boards... */
+    for (j = 0; j < 64; j ++)
+    {
+      sprintf(device, "/dev/ttyCZ%02d%02d", i, j);
+      if ((fd = open(device, O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0)
+      {
+	close(fd);
+	printf("serial serial:%s?baud=115200 \"Unknown\" \"Cyclades #%d Serial Port #%d\"\n",
+               device, i, j + 1);
+      }
+    }
 #endif
 }