File: setserial_16C950-2.diff

package info (click to toggle)
setserial 2.17-47
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 744 kB
  • sloc: sh: 2,119; ansic: 1,008; makefile: 131; csh: 2
file content (45 lines) | stat: -rw-r--r-- 1,382 bytes parent folder | download | duplicates (10)
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
http://www.hpl.hp.com/personal/Jean_Tourrilhes/bt/setserial_16C950-2.diff

diff -u -p setserial.brain.c setserial.c
--- setserial.brain.c	Mon Oct 29 16:49:10 2001
+++ setserial.c	Mon Oct 29 17:01:54 2001
@@ -77,6 +77,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 +127,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;
@@ -603,6 +610,15 @@ 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);