File: 18_setserial_c.patch

package info (click to toggle)
setserial 2.17-58
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 840 kB
  • sloc: sh: 2,127; ansic: 1,011; makefile: 148; csh: 2
file content (174 lines) | stat: -rw-r--r-- 5,351 bytes parent folder | download | duplicates (6)
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
From: Jonas Genannt <jonas.genannt@capi2name.de>
Subject: setserial setserial.c patch


diff -Naurp setserial-2.17.orig/setserial.c setserial-2.17/setserial.c
--- setserial-2.17.orig/setserial.c	2008-09-26 21:59:11.000000000 +0000
+++ setserial-2.17/setserial.c	2008-09-26 21:59:26.000000000 +0000
@@ -15,6 +15,7 @@
 #include <termios.h>
 #include <string.h>
 #include <errno.h>
+#include "pcmcia.c"
 
 #ifdef HAVE_ASM_IOCTLS_H
 #include <asm/ioctls.h>
@@ -22,7 +23,21 @@
 #ifdef HAVE_LINUX_HAYESESP_H
 #include <linux/hayesesp.h>
 #endif
+/* Patch from Roman Hodek
+ *   - g.russell
+ *
+ *   - g.russell 14 June 2002
+ *       small but powerful hack to fix m68k build problems - not the ideal
+ *       solution...
+ */
+#include "gorhack.h"
+
+#ifndef __mc68000__
 #include <linux/serial.h>
+#else
+#include <linux/m68kserial.h>
+#include "safety.h"
+#endif
 
 #include "version.h"
 
@@ -55,6 +70,16 @@ struct serial_type_struct {
 	PORT_16C950,	"16954",
 	PORT_16654,	"16654",
 	PORT_16850,	"16850",
+#ifdef __mc68000__
+        SER_SCC_NORM,   "SCC w/o DMA",
+        SER_SCC_DMA,    "SCC w/ DMA",
+        SER_MFP_CTRL,   "MFP",
+        SER_MFP_BARE,   "MFP w/o ctrl lines",
+        SER_MIDI,       "MIDI",
+        SER_AMIGA,      "Amiga builtin",
+        SER_IOEXT,      "GVP IO-Extender (16c552)",
+        SER_MFC_III,    "BSC MultiFaceCard III",
+#endif
 	PORT_UNKNOWN,	"none",
 	-1,		NULL
 };
@@ -77,6 +102,7 @@ struct serial_type_struct {
 #define CMD_FLOW_ON     16
 #define CMD_RX_TMOUT    17
 #define CMD_DMA_CHAN    18
+#define CMD_WMSR        19
 
 #define FLAG_CAN_INVERT	0x0001
 #define FLAG_NEED_ARG	0x0002
@@ -126,9 +152,15 @@ struct flag_type_table {
 	CMD_RX_TMOUT,   "rx_timeout",   0,              0,              0, FLAG_NEED_ARG,
 	CMD_DMA_CHAN,   "dma_channel",  0,              0,              0, FLAG_NEED_ARG,
 #endif
+	CMD_WMSR,	"wmsr",		0,		0,		0, FLAG_NEED_ARG,
 	0,		0,		0,		0,		0, 0,
 };
 	
+/* Kernel header will take ages before beeing updated in distributions */
+#ifndef TIOCSERSETWMSR
+#define TIOCSERSETWMSR  0x5461	/* Set custom write in Modem Status Register */
+#endif	/* TIOCSERSETWMSR */
+
 char *serial_type(int id)
 {
 	int i;
@@ -198,7 +230,7 @@ void print_flags(struct serial_struct *s
 		printf("%s", postfix);
 }
 
-#ifdef TIOCSERGETMULTI
+#if defined (TIOCSERGETMULTI) && !(__mc68000__)
 void print_multiport(char *device, int fd)
 {
 	struct serial_multiport_struct multi;
@@ -417,7 +449,7 @@ void get_serial(char *device)
 	struct serial_struct serinfo;
 	int	fd;
 	char	buf1[40];
-
+	
 	if ((fd = open(device, O_RDWR|O_NONBLOCK)) < 0) {
 		perror(device);
 		return;
@@ -435,6 +467,7 @@ void get_serial(char *device)
 		       serial_type(serinfo.type), serinfo.port,
 		       serinfo.irq, serinfo.baud_base);
 		print_flags(&serinfo, ", Flags: ", "");
+		printf("%s",pcmcia_check(device,serinfo.port));
 		printf("\n");
 	} else if (verbosity==2) {
 		printf("%s, Line %d, UART: %s, Port: 0x%.4x, IRQ: %d\n",
@@ -444,7 +477,7 @@ void get_serial(char *device)
 		       serinfo.baud_base, serinfo.close_delay,
 		       serinfo.custom_divisor);
 		if (serinfo.closing_wait == ASYNC_CLOSING_WAIT_INF)
-			strcpy(buf1, "infinte");
+			strcpy(buf1, "infinite");
 		else if (serinfo.closing_wait == ASYNC_CLOSING_WAIT_NONE)
 			strcpy(buf1, "none");
 		else
@@ -484,8 +517,13 @@ void set_serial(char *device, char ** ar
 	
 
 	if ((fd = open(device, O_RDWR|O_NONBLOCK)) < 0) {
+#ifdef __mc68000__
+                if (verbosity==0 && (errno==ENOENT || errno==ENODEV))
+                        return;
+#else
 		if (verbosity==0 && errno==ENOENT)
 			exit(201);
+#endif
 		perror(device);
 		exit(201);
 	}
@@ -507,6 +545,7 @@ void set_serial(char *device, char ** ar
 			if (!strcasecmp(p->name, word))
 				break;
 		}
+		if (strcasecmp("pcmcia",word)!=0) {
 		if (!p->name) {
 			fprintf(stderr, "Invalid flag: %s\n", word);
 			exit(1);
@@ -537,7 +576,7 @@ void set_serial(char *device, char ** ar
 		case CMD_TYPE:
 			new_serinfo.type = uart_type(*arg++);
 			if (new_serinfo.type < 0) {
-				fprintf(stderr, "Illegal UART type: %s", *--arg);
+				fprintf(stderr, "Illegal UART type: %s\n", *--arg);
 				exit(1);
 			}
 			break;
@@ -603,10 +642,20 @@ void set_serial(char *device, char ** ar
 			set_hayesesp(fd, p->cmd, atonum(*arg++));
 			break;
 #endif
+		case CMD_WMSR:
+			{
+				unsigned char wmsr = atonum(*arg++);
+				if (ioctl(fd, TIOCSERSETWMSR, &wmsr) < 0) {
+					perror("Cannot set wmsr");
+					exit(1);
+				}
+			}
+			break;
 		default:
 			fprintf(stderr, "Internal error: unhandled cmd #%d\n", p->cmd);
 			exit(1);
 		}
+		} /* pcmcia */
 	}
 	if (ioctl(fd, TIOCSSERIAL, &new_serinfo) < 0) {
 		perror("Cannot set serial info");
@@ -707,7 +756,7 @@ fprintf(stderr, "\t* port\t\tset the I/O
 	fprintf(stderr, "\t  spd_warp\tuse 460kb instead of 38.4kb\n");
 	fprintf(stderr, "\t  spd_cust\tuse the custom divisor to set the speed at 38.4kb\n");
 	fprintf(stderr, "\t\t\t\t(baud rate = baud_base / custom_divisor)\n");
-	fprintf(stderr, "\t  spd_normal\tuse 38.4kb when a buad rate of 38.4kb is selected\n");
+	fprintf(stderr, "\t  spd_normal\tuse 38.4kb when a baud rate of 38.4kb is selected\n");
 	fprintf(stderr, "\n");
 	fprintf(stderr, "Use a leading '0x' for hex numbers.\n");
 	fprintf(stderr, "CAUTION: Using an invalid port can lock up your machine!\n");