Diffstat (limited to 'qt/qt-2.3.10.patch/simpad.patch') (more/less context) (show whitespace changes)
-rw-r--r-- | qt/qt-2.3.10.patch/simpad.patch | 413 |
1 files changed, 413 insertions, 0 deletions
diff --git a/qt/qt-2.3.10.patch/simpad.patch b/qt/qt-2.3.10.patch/simpad.patch new file mode 100644 index 0000000..1777a94 --- a/dev/null +++ b/qt/qt-2.3.10.patch/simpad.patch | |||
@@ -0,0 +1,413 @@ | |||
1 | |||
2 | # | ||
3 | # Patch managed by http://www.holgerschurig.de/patcher.html | ||
4 | # | ||
5 | |||
6 | --- qt-2.3.10-snapshot-20050131/src/kernel/qkeyboard_qws.cpp~simpad | ||
7 | +++ qt-2.3.10-snapshot-20050131/src/kernel/qkeyboard_qws.cpp | ||
8 | @@ -37,6 +37,7 @@ | ||
9 | #include <qapplication.h> | ||
10 | #include <qsocketnotifier.h> | ||
11 | #include <qnamespace.h> | ||
12 | +#include <qdatetime.h> | ||
13 | #include <qtimer.h> | ||
14 | |||
15 | #include <stdlib.h> | ||
16 | @@ -80,6 +81,60 @@ | ||
17 | #include <sys/vt.h> | ||
18 | #endif | ||
19 | |||
20 | +/* | ||
21 | + * SIMpad switches handler | ||
22 | + * (C) 2003-2005 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
23 | + */ | ||
24 | + | ||
25 | + | ||
26 | + | ||
27 | +#include <linux/switches.h> | ||
28 | +#define SIMPAD_SWITCHES_DEVICE "/dev/misc/switches" | ||
29 | + | ||
30 | +// switches from left top to right down over the SIMpad surface | ||
31 | + | ||
32 | +#define SIMPAD_SWITCH_POWER 0x02 | ||
33 | +#define SIMPAD_SWITCH_UPPER 0x10 | ||
34 | +#define SIMPAD_SWITCH_UP 0x20 | ||
35 | +#define SIMPAD_SWITCH_DOWN 0x40 | ||
36 | +#define SIMPAD_SWITCH_LEFT 0x80 | ||
37 | +#define SIMPAD_SWITCH_RIGHT 0x100 | ||
38 | +#define SIMPAD_SWITCH_LOWER 0x8 | ||
39 | + | ||
40 | +class QWSsimpadButtonsHandler : public QWSKeyboardHandler | ||
41 | +{ | ||
42 | + Q_OBJECT | ||
43 | + | ||
44 | + public: | ||
45 | + QWSsimpadButtonsHandler(); | ||
46 | + virtual ~QWSsimpadButtonsHandler(); | ||
47 | + | ||
48 | + bool isOpen() { return fd > 0; } | ||
49 | + | ||
50 | + private slots: | ||
51 | + void readSwitchesData(); | ||
52 | + void autoRepeat(); | ||
53 | + | ||
54 | + private: | ||
55 | + switches_mask_t switches; | ||
56 | + | ||
57 | + int fd; | ||
58 | + int repeatdelay; | ||
59 | + int repeatperiod; | ||
60 | + | ||
61 | + int lastCode; // last native code | ||
62 | + int lastPress; // last press/release state | ||
63 | + | ||
64 | + int k; // last emitted Qt key code | ||
65 | + int shiftKeyPressed; // true if one of the SHIFT keys has been pressed and not yet released | ||
66 | + bool shiftUsed; // true if SHIFT has been used | ||
67 | + | ||
68 | + QTime eventTimer; // tracks time between raw events | ||
69 | + QTimer* repeater; | ||
70 | + QSocketNotifier *notifier; | ||
71 | +}; | ||
72 | + | ||
73 | + | ||
74 | #ifdef QT_QWS_SL5XXX | ||
75 | #include <asm/sharp_char.h> | ||
76 | #endif | ||
77 | @@ -165,9 +220,9 @@ | ||
78 | current = 0; | ||
79 | } | ||
80 | |||
81 | - void setAutoRepeat(int d, int p) { if ( d > 0 ) repeatdelay=d; | ||
82 | + void setAutoRepeat(int d, int p) { if ( d > 0 ) repeatdelay=d; | ||
83 | if ( p > 0 ) repeatperiod=p;} | ||
84 | - void getAutoRepeat(int *d ,int *p ) { if (d) *d=repeatdelay; | ||
85 | + void getAutoRepeat(int *d ,int *p ) { if (d) *d=repeatdelay; | ||
86 | if (p) *p=repeatperiod; } | ||
87 | |||
88 | void stop() | ||
89 | @@ -551,9 +606,9 @@ | ||
90 | |||
91 | void doKey(uchar scancode); | ||
92 | |||
93 | - | ||
94 | + | ||
95 | void restoreLeds(); | ||
96 | - | ||
97 | + | ||
98 | private: | ||
99 | bool shift; | ||
100 | bool alt; | ||
101 | @@ -809,7 +864,7 @@ | ||
102 | |||
103 | #if !defined(QT_QWS_SL5XXX) | ||
104 | if (code == 224 | ||
105 | -#if defined(QT_QWS_IPAQ) | ||
106 | +#if defined(QT_QWS_IPAQ) | ||
107 | && !ipaq_return_pressed | ||
108 | #endif | ||
109 | ) { | ||
110 | @@ -1775,9 +1830,11 @@ | ||
111 | } else { | ||
112 | type = spec; | ||
113 | } | ||
114 | - | ||
115 | if ( type == "Buttons" ) { | ||
116 | -#if defined(QT_QWS_YOPY) | ||
117 | +#if defined(QT_QWS_SIMPAD) | ||
118 | +qDebug( "QWSKeyboardHandler: using SIMpad switches handler..." ); | ||
119 | +handler = new QWSsimpadButtonsHandler(); | ||
120 | +#elif defined(QT_QWS_YOPY) | ||
121 | handler = new QWSyopyButtonsHandler(); | ||
122 | #elif defined(QT_QWS_CASSIOPEIA) | ||
123 | handler = new QWSVr41xxButtonsHandler(); | ||
124 | @@ -1812,6 +1869,218 @@ | ||
125 | return keyM; | ||
126 | } | ||
127 | |||
128 | -#endif // QT_NO_QWS_KEYBOARD | ||
129 | |||
130 | +/* | ||
131 | + * SIMpad switches handler | ||
132 | + * (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
133 | + */ | ||
134 | + | ||
135 | + | ||
136 | +QWSsimpadButtonsHandler::QWSsimpadButtonsHandler() | ||
137 | + :QWSKeyboardHandler(), fd( -1 ), | ||
138 | + repeatdelay( 700 ), repeatperiod( 80 ), | ||
139 | + lastCode( 0 ), lastPress( 0 ), | ||
140 | + k( -1 ), shiftKeyPressed( 0 ), shiftUsed( false ) | ||
141 | +{ | ||
142 | + qDebug( "SimpadButtonsHandler() - V4.1" ); | ||
143 | + fd = ::open( SIMPAD_SWITCHES_DEVICE, O_RDWR | O_NDELAY, 0 ); | ||
144 | + if ( fd < 0 ) | ||
145 | + { | ||
146 | + qWarning( "SimpadButtonsHandler(): can't open %s", SIMPAD_SWITCHES_DEVICE ); | ||
147 | + return; | ||
148 | + } | ||
149 | + | ||
150 | + notifier = new QSocketNotifier( fd, QSocketNotifier::Read, this ); | ||
151 | + connect( notifier, SIGNAL( activated(int) ),this, SLOT( readSwitchesData() ) ); | ||
152 | + | ||
153 | + repeater = new QTimer(this); | ||
154 | + connect(repeater, SIGNAL(timeout()), this, SLOT(autoRepeat())); | ||
155 | + | ||
156 | +} | ||
157 | |||
158 | + | ||
159 | +QWSsimpadButtonsHandler::~QWSsimpadButtonsHandler() | ||
160 | +{ | ||
161 | + qDebug( "~SimpadButtonsHandler()" ); | ||
162 | + if ( fd > 0 ) | ||
163 | + { | ||
164 | + ::close( fd ); | ||
165 | + fd = -1; | ||
166 | + } | ||
167 | +} | ||
168 | + | ||
169 | + | ||
170 | +void QWSsimpadButtonsHandler::readSwitchesData() | ||
171 | +{ | ||
172 | + qDebug( "SimpadButtonsHandler() - detected switches action" ); | ||
173 | + | ||
174 | + if ( ::read( fd, &switches, sizeof switches ) < 0 ) | ||
175 | + { | ||
176 | + qWarning( "SimpadButtonsHandler() - switches read error!" ); | ||
177 | + return; | ||
178 | + } | ||
179 | + | ||
180 | + qDebug( "SimpadButtonsHandler() - Shift: %0x [used: %0x] + Event = %0x | %0x", | ||
181 | + shiftKeyPressed, shiftUsed, switches.events[0], switches.states[0] ); | ||
182 | + | ||
183 | + bool press = switches.states[0]; // == switches.event[0]; | ||
184 | + int code = switches.events[0]; | ||
185 | + | ||
186 | + //========================================================================= | ||
187 | + | ||
188 | + /** | ||
189 | + * Work around a bug in the kernel keyboard driver emitting | ||
190 | + * bogus events when pressing multiple switches at once | ||
191 | + **/ | ||
192 | + | ||
193 | + if ( lastCode == 0 ) | ||
194 | + { | ||
195 | + // first press ever | ||
196 | + eventTimer.start(); | ||
197 | + lastPress = press; | ||
198 | + lastCode = code; | ||
199 | + } | ||
200 | + else | ||
201 | + { | ||
202 | + int interval = eventTimer.restart(); | ||
203 | + qDebug( "event interval = %d", interval ); | ||
204 | + if ( code == lastCode && interval < 10 ) | ||
205 | + { | ||
206 | + qDebug( "event interval too small - ignoring bogus event" ); | ||
207 | + qDebug( "did I say i hate buggy kernel drivers? :-D" ); | ||
208 | + return; | ||
209 | + } | ||
210 | + | ||
211 | + lastPress = press; | ||
212 | + lastCode = code; | ||
213 | + } | ||
214 | + | ||
215 | + /** | ||
216 | + * Actually it may also be a hardware problem, but I really don't like | ||
217 | + * to review kernel code for further inquiry. So just being lazy and | ||
218 | + * do the workaround in user space :-D | ||
219 | + **/ | ||
220 | + | ||
221 | + //===================================================================== | ||
222 | + | ||
223 | + if ( shiftKeyPressed ) | ||
224 | + { | ||
225 | + // a shift key obviously is being held | ||
226 | + qDebug( "while shift key is being held..." ); | ||
227 | + | ||
228 | + if ( code != shiftKeyPressed ) | ||
229 | + { | ||
230 | + // another key is being touched - that means shift mode for us! | ||
231 | + qDebug( " another key is being touched -> shift use now = true" ); | ||
232 | + | ||
233 | + shiftUsed = true; | ||
234 | + | ||
235 | + if ( shiftKeyPressed == SIMPAD_SWITCH_LOWER ) // SHIFT 1 | ||
236 | + { | ||
237 | + qDebug( " shift mode 1" ); | ||
238 | + switch(code) | ||
239 | + { | ||
240 | + case SIMPAD_SWITCH_UP: k = Qt::Key_F9; break; // Shift1-Up = Calendar | ||
241 | + case SIMPAD_SWITCH_DOWN: k = Qt::Key_F10; break; // Shift1-Down = Contacts | ||
242 | + case SIMPAD_SWITCH_LEFT: k = Qt::Key_F13; break; // Shift1-Left = Mail | ||
243 | + case SIMPAD_SWITCH_RIGHT: k = Qt::Key_F11; break; // Shift1-Up = Menu | ||
244 | + case SIMPAD_SWITCH_UPPER: k = Qt::Key_F12; break; // Shift1-Upper = Home | ||
245 | + default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event for Shift 1 !" ); break; | ||
246 | + } | ||
247 | + } | ||
248 | + else if ( shiftKeyPressed == SIMPAD_SWITCH_UPPER ) // SHIFT 2 | ||
249 | + { | ||
250 | + qDebug( " shift mode 2" ); | ||
251 | + switch(code) | ||
252 | + { | ||
253 | + case SIMPAD_SWITCH_UP: k = Qt::Key_F5; break; // Shift2-Up = F5 | ||
254 | + case SIMPAD_SWITCH_DOWN: k = Qt::Key_F6; break; // Shift2-Down = F6 | ||
255 | + case SIMPAD_SWITCH_LEFT: k = Qt::Key_F7; break; // Shift2-Left = F7 | ||
256 | + case SIMPAD_SWITCH_RIGHT: k = Qt::Key_F8; break; // Shift2-Up = F8 | ||
257 | + case SIMPAD_SWITCH_LOWER: k = Qt::Key_F9; break; // Shift2-Lower = F9 | ||
258 | + default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event for Shift 2!" ); break; | ||
259 | + } | ||
260 | + } | ||
261 | + } | ||
262 | + else | ||
263 | + { | ||
264 | + qDebug( " shift key has been released. checking if being used..." ); | ||
265 | + shiftKeyPressed = 0; | ||
266 | + | ||
267 | + if ( !shiftUsed ) | ||
268 | + { | ||
269 | + qDebug( " ... has _not_ being used -> really emit the key" ); | ||
270 | + k = ( code == SIMPAD_SWITCH_UPPER ? Qt::Key_Escape : Qt::Key_Return ); | ||
271 | + qDebug( "Emitting key = %d (pressed)", k ); | ||
272 | + processKeyEvent( 0, k, 0, true, true ); | ||
273 | + qDebug( "Emitting key = %d (released)", k ); | ||
274 | + processKeyEvent( 0, k, 0, false, true ); | ||
275 | + return; | ||
276 | + } | ||
277 | + else | ||
278 | + { | ||
279 | + qDebug( " ... has being used -> doing nothing" ); | ||
280 | + return; | ||
281 | + } | ||
282 | + } | ||
283 | + } | ||
284 | + else | ||
285 | + { | ||
286 | + qDebug( "standard mode - no shift yet..." ); | ||
287 | + | ||
288 | + switch(code) | ||
289 | + { | ||
290 | + case SIMPAD_SWITCH_UP: k = Qt::Key_Up; break; | ||
291 | + case SIMPAD_SWITCH_DOWN: k = Qt::Key_Down; break; | ||
292 | + case SIMPAD_SWITCH_LEFT: k = Qt::Key_Left; break; | ||
293 | + case SIMPAD_SWITCH_RIGHT: k = Qt::Key_Right; break; | ||
294 | + case SIMPAD_SWITCH_POWER: k = Qt::Key_F34; break; // Power Button | ||
295 | + | ||
296 | + case SIMPAD_SWITCH_UPPER: k=-1; shiftKeyPressed = press? code:0; shiftUsed = false; qDebug( "shiftkey pressed now = %d", shiftKeyPressed ); return; | ||
297 | + case SIMPAD_SWITCH_LOWER: k=-1; shiftKeyPressed = press? code:0; shiftUsed = false; qDebug( "shiftkey pressed now = %d", shiftKeyPressed ); return; | ||
298 | + | ||
299 | + default: k=-1; qWarning( "SimpadButtonsHandler() - unhandled event!" ); break; | ||
300 | + } | ||
301 | + } | ||
302 | + | ||
303 | + if ( k == -1 ) | ||
304 | + { | ||
305 | + qDebug( "no key to emit - returning." ); | ||
306 | + return; | ||
307 | + } | ||
308 | + | ||
309 | + bool repeatable = ( k == Qt::Key_Up || k == Qt::Key_Down || | ||
310 | + k == Qt::Key_Right || k == Qt::Key_Left ); | ||
311 | + | ||
312 | + qDebug( "key to emit = %d [%s] [repeat=%s]", k, | ||
313 | + press ? "press" : "release", | ||
314 | + repeatable ? "true":"false" ); | ||
315 | + | ||
316 | + if ( qt_screen->isTransformed() && k >= Qt::Key_Left && k <= Qt::Key_Down ) | ||
317 | + { | ||
318 | + qDebug( "SimpadButtonsHandler() - We are transformed! Correcting..." ); | ||
319 | + int oldK = k; | ||
320 | + k = xform_dirkey( k ); | ||
321 | + qDebug( "SimpadButtonsHandler() - Old Key: %d - New Key %d", oldK, k ); | ||
322 | + } | ||
323 | + | ||
324 | + if ( repeatable && press ) | ||
325 | + repeater->start( repeatdelay, true ); | ||
326 | + else | ||
327 | + repeater->stop(); | ||
328 | + | ||
329 | + qwsServer->processKeyEvent( 0, k, 0, press, false ); | ||
330 | +} | ||
331 | + | ||
332 | + | ||
333 | +void QWSsimpadButtonsHandler::autoRepeat() | ||
334 | +{ | ||
335 | + qDebug( "Emitting key = %d (released)", k ); | ||
336 | + processKeyEvent( 0, k, 0, false, true ); | ||
337 | + qDebug( "Emitting key = %d (pressed)", k ); | ||
338 | + processKeyEvent( 0, k, 0, true, true ); | ||
339 | + repeater->start(repeatperiod); | ||
340 | +} | ||
341 | + | ||
342 | + | ||
343 | +#endif // QT_NO_QWS_KEYBOARD | ||
344 | --- qt-2.3.10-snapshot-20050131/src/kernel/qsoundqss_qws.cpp~simpad | ||
345 | +++ qt-2.3.10-snapshot-20050131/src/kernel/qsoundqss_qws.cpp | ||
346 | @@ -53,8 +53,8 @@ | ||
347 | |||
348 | extern int errno; | ||
349 | |||
350 | -#define QT_QWS_SOUND_16BIT 1 // or 0, or undefined for always 0 | ||
351 | -#define QT_QWS_SOUND_STEREO 1 // or 0, or undefined for always 0 | ||
352 | +#define QT_QWS_SOUND_16BIT 0 // or 0, or undefined for always 0 | ||
353 | +#define QT_QWS_SOUND_STEREO 0 // or 0, or undefined for always 0 | ||
354 | |||
355 | // Zaurus SL5000D doesn't seem to return any error if setting to 44000 and it fails, | ||
356 | // however 44100 works, 44100 is more common that 44000. | ||
357 | --- qt-2.3.10-snapshot-20050131/src/kernel/qwsmouse_qws.cpp~simpad | ||
358 | +++ qt-2.3.10-snapshot-20050131/src/kernel/qwsmouse_qws.cpp | ||
359 | @@ -47,6 +47,7 @@ | ||
360 | #include <stdlib.h> | ||
361 | #include <stdio.h> | ||
362 | #include <sys/ioctl.h> | ||
363 | +#include <sys/time.h> | ||
364 | #include <sys/types.h> | ||
365 | #include <sys/stat.h> | ||
366 | #include <fcntl.h> | ||
367 | @@ -73,6 +74,7 @@ | ||
368 | unsigned short x; | ||
369 | unsigned short y; | ||
370 | unsigned short pad; | ||
371 | + struct timeval stamp; | ||
372 | } TS_EVENT; | ||
373 | #elif defined(QT_QWS_SL5XXX) | ||
374 | #define QT_QWS_SL5XXX_RAW | ||
375 | @@ -1310,6 +1312,11 @@ | ||
376 | return; | ||
377 | } | ||
378 | # endif | ||
379 | +#elif defined(QT_QWS_SIMPAD ) | ||
380 | + if ((mouseFD = open( "/dev/touchscreen/ucb1x00", O_RDONLY | O_NONBLOCK )) < 0) { | ||
381 | + qWarning( "Cannot open /dev/touchscreen/ucb1x00 (%s)", strerror(errno)); | ||
382 | + return; | ||
383 | + } | ||
384 | #endif | ||
385 | |||
386 | QSocketNotifier *mouseNotifier; | ||
387 | @@ -1323,7 +1330,7 @@ | ||
388 | |||
389 | QTPanelHandlerPrivate::~QTPanelHandlerPrivate() | ||
390 | { | ||
391 | -#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) | ||
392 | +#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD) | ||
393 | if (mouseFD >= 0) | ||
394 | close(mouseFD); | ||
395 | #endif | ||
396 | @@ -1331,7 +1338,7 @@ | ||
397 | |||
398 | void QTPanelHandlerPrivate::readMouseData() | ||
399 | { | ||
400 | -#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) | ||
401 | +#if defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD) | ||
402 | if(!qt_screen) | ||
403 | return; | ||
404 | |||
405 | @@ -2014,7 +2021,7 @@ | ||
406 | handler = new QTSLibHandlerPrivate(); | ||
407 | #elif defined(QT_QWS_YOPY) | ||
408 | handler = new QYopyTPanelHandlerPrivate(mouseProtocol,mouseDev); | ||
409 | -#elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) | ||
410 | +#elif defined(QT_QWS_IPAQ) || defined(QT_QWS_SL5XXX) || defined(QT_QWS_K2) || defined(QT_QWS_SLC700) || defined(QT_QWS_SIMPAD) | ||
411 | handler = new QTPanelHandlerPrivate(mouseProtocol,mouseDev); | ||
412 | #elif defined(QT_QWS_CASSIOPEIA) | ||
413 | handler = new QVrTPanelHandlerPrivate( mouseProtocol, mouseDev ); | ||