summaryrefslogtreecommitdiff
path: root/tools/pkg/5/xorg-modules/diff/xkeyboard.diff
blob: f3cbff56514b42e8c4c89be97f4b03049c915fa7 (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
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
diff --git xf86-input-keyboard-clean/configure xf86-input-keyboard-workdir/configure
index 76f1212..c2b8867 100755
--- xf86-input-keyboard-clean/configure
+++ xf86-input-keyboard-workdir/configure
@@ -664,6 +664,8 @@ SOLARIS_FALSE
 SOLARIS_TRUE
 BSD_FALSE
 BSD_TRUE
+ORANGE_FALSE
+ORANGE_TRUE
 OS_FLAGS
 inputdir
 XORG_LIBS
@@ -19840,6 +19842,10 @@ inputdir=${moduledir}/input
 
 # The keyboard driver code is O/S specific
 case $host_os in
+  orange*)
+    IS_ORANGE="yes"
+    ;;
+
   linux*)
     as_fn_error $? "This is not the keyboard driver you are looking for. Use evdev or libinput." "$LINENO" 5
     ;;
@@ -19878,6 +19884,14 @@ case $host_os in
 esac
 
 
+ if test "x$IS_ORANGE" = xyes; then
+  ORANGE_TRUE=
+  ORANGE_FALSE='#'
+else
+  ORANGE_TRUE='#'
+  ORANGE_FALSE=
+fi
+
  if test "x$IS_BSD" = xyes; then
   BSD_TRUE=
   BSD_FALSE='#'
@@ -20053,6 +20067,10 @@ if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
   as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
+if test -z "${ORANGE_TRUE}" && test -z "${ORANGE_FALSE}"; then
+  as_fn_error $? "conditional \"ORANGE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${BSD_TRUE}" && test -z "${BSD_FALSE}"; then
   as_fn_error $? "conditional \"BSD\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
diff --git xf86-input-keyboard-clean/src/Makefile.in xf86-input-keyboard-workdir/src/Makefile.in
index 6daf679..9a63513 100644
--- xf86-input-keyboard-clean/src/Makefile.in
+++ xf86-input-keyboard-workdir/src/Makefile.in
@@ -113,6 +113,7 @@ host_triplet = @host@
 @BSD_TRUE@am__append_1 = $(BSD_SRCS)
 @SOLARIS_TRUE@am__append_2 = $(SOLARIS_SRCS)
 @HURD_TRUE@am__append_3 = $(HURD_SRCS)
+@ORANGE_TRUE@am__append_4 = $(ORANGE_SRCS)
 subdir = src
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/configure.ac
@@ -155,15 +156,17 @@ am__DEPENDENCIES_1 =
 kbd_drv_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
 am__kbd_drv_la_SOURCES_DIST = kbd.c xf86OSKbd.h xf86Keymap.h \
 	atKeynames.h bsd_KbdMap.c bsd_kbd.c bsd_kbd.h at_scancode.c \
-	sun_kbd.c sun_kbd.h sun_kbdMap.c hurd_kbd.c
+	sun_kbd.c sun_kbd.h sun_kbdMap.c hurd_kbd.c orange_kbd.c
 am__objects_1 = bsd_KbdMap.lo bsd_kbd.lo at_scancode.lo
 @BSD_TRUE@am__objects_2 = $(am__objects_1)
 am__objects_3 = sun_kbd.lo sun_kbdMap.lo
 @SOLARIS_TRUE@am__objects_4 = $(am__objects_3)
 am__objects_5 = hurd_kbd.lo at_scancode.lo
 @HURD_TRUE@am__objects_6 = $(am__objects_5)
+am__objects_7 = orange_kbd.lo at_scancode.lo
+@ORANGE_TRUE@am__objects_8 = $(am__objects_7)
 am_kbd_drv_la_OBJECTS = kbd.lo $(am__objects_2) $(am__objects_4) \
-	$(am__objects_6)
+	$(am__objects_6) $(am__objects_8)
 kbd_drv_la_OBJECTS = $(am_kbd_drv_la_OBJECTS)
 AM_V_lt = $(am__v_lt_@AM_V@)
 am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
@@ -189,7 +192,7 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
 am__maybe_remake_depfiles = depfiles
 am__depfiles_remade = ./$(DEPDIR)/at_scancode.Plo \
 	./$(DEPDIR)/bsd_KbdMap.Plo ./$(DEPDIR)/bsd_kbd.Plo \
-	./$(DEPDIR)/hurd_kbd.Plo ./$(DEPDIR)/kbd.Plo \
+	./$(DEPDIR)/hurd_kbd.Plo ./$(DEPDIR)/orange_kbd.Plo ./$(DEPDIR)/kbd.Plo \
 	./$(DEPDIR)/sun_kbd.Plo ./$(DEPDIR)/sun_kbdMap.Plo
 am__mv = mv -f
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
@@ -388,13 +391,14 @@ AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS) $(OS_FLAGS)
 kbd_drv_la_LTLIBRARIES = kbd_drv.la
 kbd_drv_la_LDFLAGS = -avoid-version -module
 kbd_drv_la_SOURCES = kbd.c xf86OSKbd.h xf86Keymap.h atKeynames.h \
-	$(am__append_1) $(am__append_2) $(am__append_3)
+	$(am__append_1) $(am__append_2) $(am__append_3) $(am__append_4)
 kbd_drv_la_LIBADD = $(XORG_LIBS)
 kbd_drv_ladir = @inputdir@
+ORANGE_SRCS = orange_kbd.c at_scancode.c
 BSD_SRCS = bsd_KbdMap.c bsd_kbd.c bsd_kbd.h at_scancode.c
 HURD_SRCS = hurd_kbd.c at_scancode.c
 SOLARIS_SRCS = sun_kbd.c sun_kbd.h sun_kbdMap.c
-EXTRA_DIST = $(BSD_SRCS) $(HURD_SRCS) $(SOLARIS_SRCS)
+EXTRA_DIST = $(ORANGE_SRCS) $(BSD_SRCS) $(HURD_SRCS) $(SOLARIS_SRCS)
 all: all-am
 
 .SUFFIXES:
@@ -475,6 +479,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_KbdMap.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bsd_kbd.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hurd_kbd.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/orange_kbd.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kbd.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_kbd.Plo@am__quote@ # am--include-marker
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sun_kbdMap.Plo@am__quote@ # am--include-marker
@@ -643,6 +648,7 @@ distclean: distclean-am
 	-rm -f ./$(DEPDIR)/bsd_KbdMap.Plo
 	-rm -f ./$(DEPDIR)/bsd_kbd.Plo
 	-rm -f ./$(DEPDIR)/hurd_kbd.Plo
+	-rm -f ./$(DEPDIR)/orange_kbd.Plo
 	-rm -f ./$(DEPDIR)/kbd.Plo
 	-rm -f ./$(DEPDIR)/sun_kbd.Plo
 	-rm -f ./$(DEPDIR)/sun_kbdMap.Plo
@@ -695,6 +701,7 @@ maintainer-clean: maintainer-clean-am
 	-rm -f ./$(DEPDIR)/bsd_KbdMap.Plo
 	-rm -f ./$(DEPDIR)/bsd_kbd.Plo
 	-rm -f ./$(DEPDIR)/hurd_kbd.Plo
+	-rm -f ./$(DEPDIR)/orange_kbd.Plo
 	-rm -f ./$(DEPDIR)/kbd.Plo
 	-rm -f ./$(DEPDIR)/sun_kbd.Plo
 	-rm -f ./$(DEPDIR)/sun_kbdMap.Plo
diff --git xf86-input-keyboard-workdir/src/orange_kbd.c xf86-input-keyboard-workdir/src/orange_kbd.c
new file mode 100644
index 0000000..3f20d5c
--- /dev/null
+++ xf86-input-keyboard-workdir/src/orange_kbd.c
@@ -0,0 +1,108 @@
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <X11/X.h>
+#include <xorg-server.h>
+
+#include "compiler.h"
+
+#include "xf86.h"
+#include "xf86Priv.h"
+#include "xf86_OSlib.h"
+
+#include "atKeynames.h"
+#include "xf86Keymap.h"
+#include "xf86OSKbd.h"
+#include "xf86Xinput.h"
+
+#include <assert.h>
+#include <errno.h>
+#include <stdio.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+
+static int KbdOn(InputInfoPtr pInfo, int what) {
+    return Success;
+}
+
+static int KbdOff(InputInfoPtr pInfo, int what) {
+    printf("kbdOff is a stub!\n");
+    return -1;
+}
+
+static void SoundKbdBell(InputInfoPtr pInfo, int loudness, int pitch, int duration) {
+    printf("SoundKbdBell is a stub!\n");
+}
+
+static void SetKbdLeds(InputInfoPtr pInfo, int leds) {
+    printf("SetKbdLeds: is a stub!\n");
+}
+
+static int GetKbdLeds(InputInfoPtr pInfo) {
+    printf("GetKbdLeds is a stub!\n");
+    return -1;
+}
+
+// Save the initial keyboard state. This function is called at the start
+// of each server generation.
+static int KbdInit(InputInfoPtr pInfo, int what) {
+    return Success;
+}
+
+static void KbdGetMapping(InputInfoPtr pInfo, KeySymsPtr pKeySyms, CARD8 *pModMap) {
+    printf("KbdGetMapping is a stub!\n");
+}
+
+static void ReadInput(InputInfoPtr pInfo) {
+    KbdDevPtr pKbd = (KbdDevPtr) pInfo->private;
+
+    uint8_t scancodes[64];
+    ssize_t result = read(pInfo->fd, scancodes, sizeof(scancodes));
+    if (result > 0) {
+        for (ssize_t i = 0; i < result; i++) {
+            pKbd->PostEvent(pInfo, scancodes[i] & 0x7f, scancodes[i] & 0x80 ? FALSE : TRUE);
+        }
+    }
+}
+
+static Bool OpenKeyboard(InputInfoPtr pInfo) {
+    char *kbdPath = xf86SetStrOption(pInfo->options, "Device", "/dev/ps2keyboard");
+    Bool ret;
+
+    pInfo->fd = open(kbdPath, O_RDONLY | O_NONBLOCK);
+
+    if (pInfo->fd == -1) {
+        xf86Msg(X_ERROR, "%s: cannot open \"%s\"\n", pInfo->name, kbdPath);
+        ret = FALSE;
+    } else {
+        xf86MsgVerb(X_INFO, 3, "%s: opened device \"%s\"\n", pInfo->name, kbdPath);
+        pInfo->read_input = ReadInput;
+        ret = TRUE;
+
+        // in case it wasn't set and we fell back to default.
+        xf86ReplaceStrOption(pInfo->options, "Device", kbdPath);
+    }
+
+    free(kbdPath);
+    return ret;
+}
+
+Bool xf86OSKbdPreInit(InputInfoPtr pInfo) {
+    KbdDevPtr pKbd = pInfo->private;
+
+    pKbd->KbdInit       = KbdInit;
+    pKbd->KbdOn         = KbdOn;
+    pKbd->KbdOff        = KbdOff;
+    pKbd->Bell          = SoundKbdBell;
+    pKbd->SetLeds       = SetKbdLeds;
+    pKbd->GetLeds       = GetKbdLeds;
+    pKbd->KbdGetMapping = KbdGetMapping;
+    pKbd->OpenKeyboard = OpenKeyboard;
+
+    pKbd->RemapScanCode = NULL;
+    pKbd->private = NULL;
+
+    return TRUE;
+}