3 * Copyright (c) 1997 Metro Link Incorporated
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
19 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
20 * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23 * Except as contained in this notice, the name of the Metro Link shall not be
24 * used in advertising or otherwise to promote the sale, use or other dealings
25 * in this Software without prior written authorization from Metro Link.
29 * Copyright (c) 1997-2003 by The XFree86 Project, Inc.
31 * Permission is hereby granted, free of charge, to any person obtaining a
32 * copy of this software and associated documentation files (the "Software"),
33 * to deal in the Software without restriction, including without limitation
34 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
35 * and/or sell copies of the Software, and to permit persons to whom the
36 * Software is furnished to do so, subject to the following conditions:
38 * The above copyright notice and this permission notice shall be included in
39 * all copies or substantial portions of the Software.
41 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
42 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
43 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
44 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
45 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
46 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
47 * OTHER DEALINGS IN THE SOFTWARE.
49 * Except as contained in this notice, the name of the copyright holder(s)
50 * and author(s) shall not be used in advertising or otherwise to promote
51 * the sale, use or other dealings in this Software without prior written
52 * authorization from the copyright holder(s) and author(s).
55 #ifdef HAVE_XORG_CONFIG_H
56 #include <xorg-config.h>
59 #include "xf86Parser.h"
60 #include "xf86tokens.h"
61 #include "Configint.h"
66 static xf86ConfigSymTabRec PointerTab
[] = {
67 {PROTOCOL
, "protocol"},
68 {EMULATE3
, "emulate3buttons"},
69 {EM3TIMEOUT
, "emulate3timeout"},
70 {ENDSUBSECTION
, "endsubsection"},
71 {ENDSECTION
, "endsection"},
74 {BAUDRATE
, "baudrate"},
75 {SAMPLERATE
, "samplerate"},
76 {CLEARDTR
, "cleardtr"},
77 {CLEARRTS
, "clearrts"},
78 {CHORDMIDDLE
, "chordmiddle"},
79 {PRESOLUTION
, "resolution"},
80 {DEVICE_NAME
, "devicename"},
81 {ALWAYSCORE
, "alwayscore"},
82 {PBUTTONS
, "buttons"},
83 {ZAXISMAPPING
, "zaxismapping"},
87 static xf86ConfigSymTabRec ZMapTab
[] = {
93 #define CLEANUP xf86freeInputList
96 xf86parsePointerSection(void)
102 parsePrologue(XF86ConfInputPtr
, XF86ConfInputRec
)
104 while ((token
= xf86getToken(PointerTab
)) != ENDSECTION
) {
107 ptr
->inp_comment
= xf86addComment(ptr
->inp_comment
, val
.str
);
110 if (xf86getSubToken(&(ptr
->inp_comment
)) != STRING
)
111 Error(QUOTE_MSG
, "Protocol");
112 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
113 strdup("Protocol"), val
.str
);
116 if (xf86getSubToken(&(ptr
->inp_comment
)) != STRING
)
117 Error(QUOTE_MSG
, "Device");
118 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
119 strdup("Device"), val
.str
);
122 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
123 strdup("Emulate3Buttons"),
127 if (xf86getSubToken(&(ptr
->inp_comment
)) != NUMBER
|| val
.num
< 0)
128 Error(POSITIVE_INT_MSG
, "Emulate3Timeout");
129 s
= xf86uLongToString(val
.num
);
130 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
131 strdup("Emulate3Timeout"),
135 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
136 strdup("ChordMiddle"), NULL
);
139 if (xf86getSubToken(&(ptr
->inp_comment
)) != NUMBER
|| val
.num
< 0)
140 Error(POSITIVE_INT_MSG
, "Buttons");
141 s
= xf86uLongToString(val
.num
);
142 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
143 strdup("Buttons"), s
);
146 if (xf86getSubToken(&(ptr
->inp_comment
)) != NUMBER
|| val
.num
< 0)
147 Error(POSITIVE_INT_MSG
, "BaudRate");
148 s
= xf86uLongToString(val
.num
);
149 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
150 strdup("BaudRate"), s
);
153 if (xf86getSubToken(&(ptr
->inp_comment
)) != NUMBER
|| val
.num
< 0)
154 Error(POSITIVE_INT_MSG
, "SampleRate");
155 s
= xf86uLongToString(val
.num
);
156 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
157 strdup("SampleRate"), s
);
160 if (xf86getSubToken(&(ptr
->inp_comment
)) != NUMBER
|| val
.num
< 0)
161 Error(POSITIVE_INT_MSG
, "Resolution");
162 s
= xf86uLongToString(val
.num
);
163 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
164 strdup("Resolution"), s
);
167 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
168 strdup("ClearDTR"), NULL
);
171 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
172 strdup("ClearRTS"), NULL
);
175 switch (xf86getToken(ZMapTab
)) {
178 Error(ZAXISMAPPING_MSG
);
180 if (xf86getSubToken(&(ptr
->inp_comment
)) != NUMBER
||
182 Error(ZAXISMAPPING_MSG
);
184 if (asprintf(&s
, "%lu %u", val1
, val
.num
) == -1)
194 Error(ZAXISMAPPING_MSG
);
197 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
198 strdup("ZAxisMapping"), s
);
203 Error(UNEXPECTED_EOF_MSG
);
206 Error(INVALID_KEYWORD_MSG
, xf86tokenString());
211 ptr
->inp_identifier
= strdup(CONF_IMPLICIT_POINTER
);
212 ptr
->inp_driver
= strdup("mouse");
213 ptr
->inp_option_lst
= xf86addNewOption(ptr
->inp_option_lst
,
214 strdup("CorePointer"), NULL
);
217 printf("Pointer section parsed\n");