Lines 1-13
Link Here
|
1 |
--- src/bsd_mouse.c.orig 2012-07-27 08:10:56.000000000 +0200 |
1 |
--- src/bsd_mouse.c.orig 2012-10-08 03:40:07.000000000 +0200 |
2 |
+++ src/bsd_mouse.c 2012-07-30 00:49:09.000000000 +0200 |
2 |
+++ src/bsd_mouse.c 2013-07-03 01:00:50.897361950 +0200 |
3 |
@@ -71,15 +71,20 @@ |
3 |
@@ -26,6 +26,24 @@ |
4 |
static const char *FindDevice(InputInfoPtr, const char *, int); |
4 |
* authorization from the copyright holder(s) and author(s). |
|
|
5 |
*/ |
5 |
|
6 |
|
6 |
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) |
7 |
+ |
|
|
8 |
+/* |
9 |
+ * XXX - Should this be autoconf'd instead? |
10 |
+ */ |
11 |
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) |
12 |
+ |
13 |
+#if !defined(USBMOUSE_SUPPORT) |
14 |
+#define USBMOUSE_SUPPORT |
15 |
+#endif |
16 |
+#if !defined(HAS_LIB_USB_HID) |
17 |
+#define HAS_LIB_USB_HID |
18 |
+#endif |
7 |
+#if !defined(XPS2_SUPPORT) |
19 |
+#if !defined(XPS2_SUPPORT) |
8 |
+#define XPS2_SUPPORT |
20 |
+#define XPS2_SUPPORT |
9 |
+#endif |
21 |
+#endif |
10 |
/* These are for FreeBSD and DragonFly */ |
22 |
+ |
|
|
23 |
+#endif /* defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) */ |
24 |
+ |
25 |
#include <xorg-server.h> |
26 |
|
27 |
#include <X11/X.h> |
28 |
@@ -33,9 +51,23 @@ |
29 |
#include "xf86Priv.h" |
30 |
#include "xf86_OSlib.h" |
31 |
#include "xf86Xinput.h" |
32 |
+#include <exevents.h> |
33 |
#include "mouse.h" |
34 |
#include "xisb.h" |
35 |
#include "mipointer.h" |
36 |
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3 |
37 |
+#define HAVE_PROPERTIES 1 |
38 |
+#endif |
39 |
+#ifdef HAVE_PROPERTIES |
40 |
+#include <X11/Xatom.h> |
41 |
+#include <xserver-properties.h> |
42 |
+/* 1.6 has properties, but no labels */ |
43 |
+#ifdef AXIS_LABEL_PROP |
44 |
+#define HAVE_LABELS |
45 |
+#else |
46 |
+#undef HAVE_LABELS |
47 |
+#endif |
48 |
+#endif |
49 |
#ifdef WSCONS_SUPPORT |
50 |
#include <dev/wscons/wsconsio.h> |
51 |
#endif |
52 |
@@ -47,9 +79,6 @@ |
53 |
#endif |
54 |
|
55 |
#include <dev/usb/usb.h> |
56 |
-#ifdef USB_GET_REPORT_ID |
57 |
-#define USB_NEW_HID |
58 |
-#endif |
59 |
|
60 |
#define HUP_GENERIC_DESKTOP 0x0001 |
61 |
#define HUP_BUTTON 0x0009 |
62 |
@@ -75,11 +104,13 @@ |
11 |
#define DEFAULT_MOUSE_DEV "/dev/mouse" |
63 |
#define DEFAULT_MOUSE_DEV "/dev/mouse" |
12 |
#define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse" |
64 |
#define DEFAULT_SYSMOUSE_DEV "/dev/sysmouse" |
13 |
#define DEFAULT_PS2_DEV "/dev/psm0" |
65 |
#define DEFAULT_PS2_DEV "/dev/psm0" |
Lines 21-27
Link Here
|
21 |
NULL |
73 |
NULL |
22 |
}; |
74 |
}; |
23 |
#elif (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT) |
75 |
#elif (defined(__OpenBSD__) || defined(__NetBSD__)) && defined(WSCONS_SUPPORT) |
24 |
@@ -100,7 +105,11 @@ |
76 |
@@ -100,7 +131,11 @@ |
25 |
#if defined(__NetBSD__) |
77 |
#if defined(__NetBSD__) |
26 |
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO; |
78 |
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO; |
27 |
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) |
79 |
#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) |
Lines 34-40
Link Here
|
34 |
#else |
86 |
#else |
35 |
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO | MSE_MISC; |
87 |
return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_XPS2 | MSE_AUTO | MSE_MISC; |
36 |
#endif |
88 |
#endif |
37 |
@@ -180,9 +189,30 @@ |
89 |
@@ -180,9 +215,30 @@ |
38 |
{ MOUSE_PROTO_SYSMOUSE, "SysMouse" } |
90 |
{ MOUSE_PROTO_SYSMOUSE, "SysMouse" } |
39 |
}; |
91 |
}; |
40 |
|
92 |
|
Lines 41-47
Link Here
|
41 |
+#ifdef XPS2_SUPPORT |
93 |
+#ifdef XPS2_SUPPORT |
42 |
+static struct { |
94 |
+static struct { |
43 |
+ int dmodel; |
95 |
+ int dmodel; |
44 |
+ char *name; |
96 |
+ const char *name; |
45 |
+} ps2proto[] = { |
97 |
+} ps2proto[] = { |
46 |
+ { MOUSE_MODEL_NETSCROLL, "NetScrollPS/2" }, |
98 |
+ { MOUSE_MODEL_NETSCROLL, "NetScrollPS/2" }, |
47 |
+ { MOUSE_MODEL_NET, "NetMousePS/2" }, |
99 |
+ { MOUSE_MODEL_NET, "NetMousePS/2" }, |
Lines 59-71
Link Here
|
59 |
SetupAuto(InputInfoPtr pInfo, int *protoPara) |
111 |
SetupAuto(InputInfoPtr pInfo, int *protoPara) |
60 |
{ |
112 |
{ |
61 |
+#ifdef XPS2_SUPPORT |
113 |
+#ifdef XPS2_SUPPORT |
62 |
+ char *dev; |
114 |
+ const char *dev; |
63 |
+#endif |
115 |
+#endif |
64 |
+ const char *proto; |
116 |
+ const char *proto; |
65 |
int i; |
117 |
int i; |
66 |
mousehw_t hw; |
118 |
mousehw_t hw; |
67 |
mousemode_t mode; |
119 |
mousemode_t mode; |
68 |
@@ -190,7 +220,13 @@ |
120 |
@@ -190,7 +246,13 @@ |
69 |
if (pInfo->fd == -1) |
121 |
if (pInfo->fd == -1) |
70 |
return NULL; |
122 |
return NULL; |
71 |
|
123 |
|
Lines 79-85
Link Here
|
79 |
i = 1; |
131 |
i = 1; |
80 |
ioctl(pInfo->fd, MOUSE_SETLEVEL, &i); |
132 |
ioctl(pInfo->fd, MOUSE_SETLEVEL, &i); |
81 |
|
133 |
|
82 |
@@ -209,9 +245,18 @@ |
134 |
@@ -209,9 +271,18 @@ |
83 |
protoPara[0] = mode.syncmask[0]; |
135 |
protoPara[0] = mode.syncmask[0]; |
84 |
protoPara[1] = mode.syncmask[1]; |
136 |
protoPara[1] = mode.syncmask[1]; |
85 |
} |
137 |
} |
Lines 100-106
Link Here
|
100 |
} |
152 |
} |
101 |
} |
153 |
} |
102 |
} |
154 |
} |
103 |
@@ -234,41 +279,41 @@ |
155 |
@@ -234,41 +305,41 @@ |
104 |
(protocol && xf86NameCmp(protocol, "SysMouse") == 0)) { |
156 |
(protocol && xf86NameCmp(protocol, "SysMouse") == 0)) { |
105 |
/* |
157 |
/* |
106 |
* As the FreeBSD sysmouse driver defaults to protocol level 0 |
158 |
* As the FreeBSD sysmouse driver defaults to protocol level 0 |
Lines 159-165
Link Here
|
159 |
} |
211 |
} |
160 |
return FALSE; |
212 |
return FALSE; |
161 |
} |
213 |
} |
162 |
@@ -276,17 +321,17 @@ |
214 |
@@ -276,17 +347,17 @@ |
163 |
static const char * |
215 |
static const char * |
164 |
FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) |
216 |
FindDevice(InputInfoPtr pInfo, const char *protocol, int flags) |
165 |
{ |
217 |
{ |
Lines 181-187
Link Here
|
181 |
#endif |
233 |
#endif |
182 |
} else { |
234 |
} else { |
183 |
/* |
235 |
/* |
184 |
@@ -295,28 +340,32 @@ |
236 |
@@ -295,28 +366,32 @@ |
185 |
* the test for whether /dev/sysmouse is usable can be made. |
237 |
* the test for whether /dev/sysmouse is usable can be made. |
186 |
*/ |
238 |
*/ |
187 |
if (!strcmp(*pdev, DEFAULT_MOUSE_DEV)) { |
239 |
if (!strcmp(*pdev, DEFAULT_MOUSE_DEV)) { |
Lines 227-233
Link Here
|
227 |
break; |
279 |
break; |
228 |
} |
280 |
} |
229 |
} |
281 |
} |
230 |
@@ -764,7 +813,9 @@ |
282 |
@@ -468,30 +543,78 @@ |
|
|
283 |
|
284 |
#if defined(USBMOUSE_SUPPORT) |
285 |
|
286 |
+#define MAXRIDS 64 |
287 |
+#define MAXACOLS 8 |
288 |
+#define MAXLCOLS 16 |
289 |
typedef struct _UsbMseRec { |
290 |
int packetSize; |
291 |
- int iid; |
292 |
- hid_item_t loc_x; /* x locator item */ |
293 |
- hid_item_t loc_y; /* y locator item */ |
294 |
- hid_item_t loc_z; /* z (wheel) locator item */ |
295 |
- hid_item_t loc_w; /* z (wheel) locator item */ |
296 |
- hid_item_t loc_btn[MSE_MAXBUTTONS]; /* buttons locator items */ |
297 |
- unsigned char *buffer; |
298 |
+ int iid, nrids, nacols, opened; |
299 |
+ struct { |
300 |
+ int32_t rid; |
301 |
+ int size; |
302 |
+ } rids[MAXRIDS]; |
303 |
+ struct UsbMseAcol { |
304 |
+ InputInfoPtr pInfo; |
305 |
+ int nlcols, nbuttons, hasZ, hasW; |
306 |
+ int xmin, xmax, ymin, ymax, pmin, pmax, px, py; |
307 |
+ int cxmin, cxmax, cymin, cymax, cpmin, cpmax; |
308 |
+ struct UsbMseLcol { |
309 |
+ hid_item_t loc_x; /* x locator item */ |
310 |
+ hid_item_t loc_y; /* y locator item */ |
311 |
+ hid_item_t loc_z; /* z (wheel) locator item */ |
312 |
+ hid_item_t loc_w; /* w (hwheel) locator item */ |
313 |
+ hid_item_t loc_p; /* Tip Pressure */ |
314 |
+ hid_item_t loc_valid; /* Touch Valid */ |
315 |
+ hid_item_t loc_in_range; /* In Range */ |
316 |
+ hid_item_t loc_btn[MSE_MAXBUTTONS]; /* buttons locator items */ |
317 |
+ } lcols[MAXLCOLS]; |
318 |
+ hid_item_t loc_cc; /* contact count */ |
319 |
+ } acols[MAXACOLS]; |
320 |
+ unsigned char *buffer; |
321 |
} UsbMseRec, *UsbMsePtr; |
322 |
|
323 |
+static int * |
324 |
+usbGetReportSizePtr(UsbMsePtr pUsbMse, int32_t rid) |
325 |
+{ |
326 |
+ int i; |
327 |
+ |
328 |
+ for (i = 0; i < pUsbMse->nrids; i++) { |
329 |
+ if (pUsbMse->rids[i].rid == rid) |
330 |
+ return (&pUsbMse->rids[i].size); |
331 |
+ } |
332 |
+ for (i = 0; i < MAXRIDS; i++) { |
333 |
+ if (pUsbMse->rids[i].size == 0) { |
334 |
+ pUsbMse->rids[i].rid = rid; |
335 |
+ pUsbMse->nrids = max(pUsbMse->nrids, i + 1); |
336 |
+ return (&pUsbMse->rids[i].size); |
337 |
+ } |
338 |
+ } |
339 |
+ return (NULL); |
340 |
+} |
341 |
+ |
342 |
static int |
343 |
usbMouseProc(DeviceIntPtr pPointer, int what) |
344 |
{ |
345 |
InputInfoPtr pInfo; |
346 |
MouseDevPtr pMse; |
347 |
UsbMsePtr pUsbMse; |
348 |
+ struct UsbMseAcol *acol; |
349 |
unsigned char map[MSE_MAXBUTTONS + 1]; |
350 |
- int nbuttons; |
351 |
+ int nacol, nbuttons; |
352 |
+#ifdef HAVE_LABELS |
353 |
+ Atom btn_labels[MSE_MAXBUTTONS] = {0}; |
354 |
+ Atom axes_labels[3] = { 0, 0, 0 }; |
355 |
+#endif |
356 |
|
357 |
pInfo = pPointer->public.devicePrivate; |
358 |
pMse = pInfo->private; |
359 |
pMse->device = pPointer; |
360 |
pUsbMse = pMse->mousePriv; |
361 |
+ for (nacol = 0; nacol < (pUsbMse->nacols - 1); nacol++) { |
362 |
+ if (pUsbMse->acols[nacol].pInfo == pInfo) |
363 |
+ break; |
364 |
+ } |
365 |
+ acol = &pUsbMse->acols[nacol]; |
366 |
|
367 |
switch (what) { |
368 |
case DEVICE_INIT: |
369 |
@@ -500,38 +623,96 @@ |
370 |
for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons) |
371 |
map[nbuttons + 1] = nbuttons + 1; |
372 |
|
373 |
- InitPointerDeviceStruct((DevicePtr)pPointer, |
374 |
- map, |
375 |
- min(pMse->buttons, MSE_MAXBUTTONS), |
376 |
- miPointerGetMotionEvents, |
377 |
- pMse->Ctrl, |
378 |
- miPointerGetMotionBufferSize()); |
379 |
+#ifdef HAVE_LABELS |
380 |
+ btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT); |
381 |
+ btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE); |
382 |
+ btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT); |
383 |
+ axes_labels[0] = XIGetKnownProperty((acol->xmin != acol->xmax) |
384 |
+ ? AXIS_LABEL_PROP_ABS_X : AXIS_LABEL_PROP_REL_X); |
385 |
+ axes_labels[1] = XIGetKnownProperty((acol->xmin != acol->xmax) |
386 |
+ ? AXIS_LABEL_PROP_ABS_Y : AXIS_LABEL_PROP_REL_Y); |
387 |
+ axes_labels[2] = XIGetKnownProperty(AXIS_LABEL_PROP_ABS_PRESSURE); |
388 |
+#endif |
389 |
+ |
390 |
+ InitButtonClassDeviceStruct(pPointer, min(pMse->buttons, MSE_MAXBUTTONS), |
391 |
+#ifdef HAVE_LABELS |
392 |
+ btn_labels, |
393 |
+#endif |
394 |
+ map); |
395 |
+ InitValuatorClassDeviceStruct(pPointer, (acol->pmin != acol->pmax) ? 3 : 2, |
396 |
+#ifdef HAVE_LABELS |
397 |
+ axes_labels, |
398 |
+#endif |
399 |
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) == 0 |
400 |
+ miPointerGetMotionEvents, |
401 |
+#elif GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 3 |
402 |
+ GetMotionHistory, |
403 |
+#endif |
404 |
+ GetMotionHistorySize(), |
405 |
+ (acol->xmin != acol->xmax || acol->ymin != acol->ymax) ? |
406 |
+ Absolute : Relative); |
407 |
+ InitPtrFeedbackClassDeviceStruct(pPointer, pMse->Ctrl); |
408 |
|
409 |
/* X valuator */ |
410 |
- xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1); |
411 |
+ xf86InitValuatorAxisStruct(pPointer, 0, |
412 |
+#ifdef HAVE_LABELS |
413 |
+ axes_labels[0], |
414 |
+#endif |
415 |
+ (acol->xmin != acol->xmax) ? acol->xmin : -1, |
416 |
+ (acol->xmin != acol->xmax) ? acol->xmax : -1, |
417 |
+ 1, 0, 1 |
418 |
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 |
419 |
+ , (acol->xmin != acol->xmax) ? Absolute : Relative |
420 |
+#endif |
421 |
+ ); |
422 |
xf86InitValuatorDefaults(pPointer, 0); |
423 |
/* Y valuator */ |
424 |
- xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1); |
425 |
+ xf86InitValuatorAxisStruct(pPointer, 1, |
426 |
+#ifdef HAVE_LABELS |
427 |
+ axes_labels[1], |
428 |
+#endif |
429 |
+ (acol->ymin != acol->ymax) ? acol->ymin : -1, |
430 |
+ (acol->ymin != acol->ymax) ? acol->ymax : -1, |
431 |
+ 1, 0, 1 |
432 |
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 |
433 |
+ , (acol->ymin != acol->ymax) ? Absolute : Relative |
434 |
+#endif |
435 |
+ ); |
436 |
xf86InitValuatorDefaults(pPointer, 1); |
437 |
+ /* Pressure valuator */ |
438 |
+ if (acol->pmin != acol->pmax) { |
439 |
+ xf86InitValuatorAxisStruct(pPointer, 2, |
440 |
+#ifdef HAVE_LABELS |
441 |
+ axes_labels[2], |
442 |
+#endif |
443 |
+ acol->pmin, acol->pmax, 1, 0, 1 |
444 |
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 12 |
445 |
+ , Absolute |
446 |
+#endif |
447 |
+ ); |
448 |
+ xf86InitValuatorDefaults(pPointer, 2); |
449 |
+ } |
450 |
xf86MotionHistoryAllocate(pInfo); |
451 |
break; |
452 |
|
453 |
case DEVICE_ON: |
454 |
- pInfo->fd = xf86OpenSerial(pInfo->options); |
455 |
- if (pInfo->fd == -1) |
456 |
- xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); |
457 |
- else { |
458 |
- pMse->buffer = XisbNew(pInfo->fd, pUsbMse->packetSize); |
459 |
- if (!pMse->buffer) { |
460 |
- free(pMse); |
461 |
- xf86CloseSerial(pInfo->fd); |
462 |
- pInfo->fd = -1; |
463 |
- } else { |
464 |
- xf86FlushInput(pInfo->fd); |
465 |
- if (!xf86InstallSIGIOHandler (pInfo->fd, usbSigioReadInput, |
466 |
- pInfo)) |
467 |
- AddEnabledDevice(pInfo->fd); |
468 |
- } |
469 |
+ if (pUsbMse->opened++ == 0) { |
470 |
+ pInfo->fd = xf86OpenSerial(pInfo->options); |
471 |
+ if (pInfo->fd == -1) |
472 |
+ xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); |
473 |
+ else { |
474 |
+ pMse->buffer = XisbNew(pInfo->fd, pUsbMse->packetSize); |
475 |
+ if (!pMse->buffer) { |
476 |
+ free(pMse); |
477 |
+ xf86CloseSerial(pInfo->fd); |
478 |
+ pInfo->fd = -1; |
479 |
+ } else { |
480 |
+ xf86FlushInput(pInfo->fd); |
481 |
+ if (!xf86InstallSIGIOHandler (pInfo->fd, usbSigioReadInput, |
482 |
+ pInfo)) |
483 |
+ AddEnabledDevice(pInfo->fd); |
484 |
+ } |
485 |
+ } |
486 |
} |
487 |
pMse->lastButtons = 0; |
488 |
pMse->lastMappedButtons = 0; |
489 |
@@ -553,6 +734,7 @@ |
490 |
xf86CloseSerial(pInfo->fd); |
491 |
pInfo->fd = -1; |
492 |
} |
493 |
+ pUsbMse->opened--; |
494 |
pPointer->public.on = FALSE; |
495 |
usleep(300000); |
496 |
break; |
497 |
@@ -568,45 +750,154 @@ |
498 |
{ |
499 |
MouseDevPtr pMse; |
500 |
UsbMsePtr pUsbMse; |
501 |
- int buttons = pMse->lastButtons; |
502 |
- int dx = 0, dy = 0, dz = 0, dw = 0; |
503 |
- int n, c; |
504 |
+ int buttons, cc; |
505 |
+ int dx, dy, dz, dw, dp, upd, v, nx, ny, np, in_range; |
506 |
+ int n, c, rid, *sizep, nacol, nlcol; |
507 |
unsigned char *pBuf; |
508 |
+ struct UsbMseAcol *acol; |
509 |
+ struct UsbMseLcol *lcol; |
510 |
|
511 |
pMse = pInfo->private; |
512 |
pUsbMse = pMse->mousePriv; |
513 |
|
514 |
XisbBlockDuration(pMse->buffer, -1); |
515 |
+next: |
516 |
pBuf = pUsbMse->buffer; |
517 |
n = 0; |
518 |
- while ((c = XisbRead(pMse->buffer)) >= 0 && n < pUsbMse->packetSize) { |
519 |
+ if (pUsbMse->iid) { |
520 |
+ rid = XisbRead(pMse->buffer); |
521 |
+ if (rid < 0) |
522 |
+ return; |
523 |
+ pBuf[n++] = (unsigned char)rid; |
524 |
+ } else |
525 |
+ rid = 0; |
526 |
+ sizep = usbGetReportSizePtr(pUsbMse, rid); |
527 |
+ if (sizep == NULL || *sizep == 0) { |
528 |
+ xf86Msg(X_WARNING, "%s: unknown report ID %d\n", pInfo->name, rid); |
529 |
+ goto next; |
530 |
+ } |
531 |
+ while (n < *sizep && (c = XisbRead(pMse->buffer)) >= 0) { |
532 |
pBuf[n++] = (unsigned char)c; |
533 |
} |
534 |
if (n == 0) |
535 |
return; |
536 |
- if (n != pUsbMse->packetSize) { |
537 |
+// xf86MsgVerb(X_INFO, 3, "pkt: %d %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", |
538 |
+// n, pBuf[0], pBuf[1], pBuf[2], pBuf[3], pBuf[4], pBuf[5], pBuf[6], pBuf[7], pBuf[8], pBuf[9]); |
539 |
+ if (n != *sizep) { |
540 |
LogMessageVerbSigSafe(X_WARNING, -1, |
541 |
"%s: incomplete packet, size %d\n", |
542 |
pInfo->name, n); |
543 |
} |
544 |
- /* discard packets with an id that don't match the mouse */ |
545 |
- /* XXX this is probably not the right thing */ |
546 |
- if (pUsbMse->iid != 0) { |
547 |
- if (*pBuf++ != pUsbMse->iid) |
548 |
- return; |
549 |
- } |
550 |
- dx = hid_get_data(pBuf, &pUsbMse->loc_x); |
551 |
- dy = hid_get_data(pBuf, &pUsbMse->loc_y); |
552 |
- dz = hid_get_data(pBuf, &pUsbMse->loc_z); |
553 |
- dw = hid_get_data(pBuf, &pUsbMse->loc_w); |
554 |
- |
555 |
- buttons = 0; |
556 |
- for (n = 0; n < pMse->buttons; n++) { |
557 |
- if (hid_get_data(pBuf, &pUsbMse->loc_btn[n])) |
558 |
- buttons |= (1 << UMS_BUT(n)); |
559 |
+ for (nacol = 0; nacol < pUsbMse->nacols; nacol++) { |
560 |
+ acol = &pUsbMse->acols[nacol]; |
561 |
+ if (acol->pInfo == NULL) |
562 |
+ continue; |
563 |
+ nx = ny = np = upd = 0; |
564 |
+ buttons = cc = 0; |
565 |
+ dx = dy = dz = dw = dp = 0; |
566 |
+ for (nlcol = 0; nlcol < pUsbMse->acols[nacol].nlcols; nlcol++) { |
567 |
+ lcol = &acol->lcols[nlcol]; |
568 |
+ |
569 |
+ if (lcol->loc_valid.usage != 0 && rid == lcol->loc_valid.report_ID && |
570 |
+ hid_get_data(pBuf, &lcol->loc_valid) == 0) |
571 |
+ continue; |
572 |
+ if (lcol->loc_in_range.usage != 0 && rid == lcol->loc_in_range.report_ID) |
573 |
+ in_range = hid_get_data(pBuf, &lcol->loc_in_range); |
574 |
+ else |
575 |
+ in_range = 1; |
576 |
+ if (in_range && lcol->loc_x.usage != 0 && rid == lcol->loc_x.report_ID && nx == 0) { |
577 |
+ v = hid_get_data(pBuf, &lcol->loc_x); |
578 |
+ if (acol->xmin != acol->xmax) { |
579 |
+ v = xf86ScaleAxis(v, acol->xmax, acol->xmin, |
580 |
+ lcol->loc_x.logical_maximum, lcol->loc_x.logical_minimum); |
581 |
+ if (acol->cxmin != acol->cxmax) |
582 |
+ v = xf86ScaleAxis(v, acol->xmax, acol->xmin, |
583 |
+ acol->cxmax, acol->cxmin); |
584 |
+ } |
585 |
+ dx += v; |
586 |
+ nx++; |
587 |
+ } |
588 |
+ if (in_range && lcol->loc_y.usage != 0 && rid == lcol->loc_y.report_ID && ny == 0) { |
589 |
+ v = hid_get_data(pBuf, &lcol->loc_y); |
590 |
+ if (acol->xmin != acol->xmax) { |
591 |
+ v = xf86ScaleAxis(v, acol->ymax, acol->ymin, |
592 |
+ lcol->loc_y.logical_maximum, lcol->loc_y.logical_minimum); |
593 |
+ if (acol->cymin != acol->cymax) |
594 |
+ v = xf86ScaleAxis(v, acol->ymax, acol->ymin, |
595 |
+ acol->cymax, acol->cymin); |
596 |
+ } |
597 |
+ dy += v; |
598 |
+ ny++; |
599 |
+ } |
600 |
+ if (lcol->loc_z.usage != 0 && rid == lcol->loc_z.report_ID) { |
601 |
+ dz -= hid_get_data(pBuf, &lcol->loc_z); |
602 |
+ upd = 1; |
603 |
+ } |
604 |
+ if (lcol->loc_w.usage != 0 && rid == lcol->loc_w.report_ID) { |
605 |
+ dw += hid_get_data(pBuf, &lcol->loc_w); |
606 |
+ upd = 1; |
607 |
+ } |
608 |
+ if (lcol->loc_p.usage != 0 && rid == lcol->loc_p.report_ID && np == 0) { |
609 |
+ v = hid_get_data(pBuf, &lcol->loc_p); |
610 |
+ v = xf86ScaleAxis(v, acol->pmax, acol->pmin, |
611 |
+ lcol->loc_p.logical_maximum, lcol->loc_p.logical_minimum); |
612 |
+ if (acol->cpmin != acol->cpmax) |
613 |
+ v = xf86ScaleAxis(v, acol->pmax, acol->pmin, |
614 |
+ acol->cpmax, acol->cpmin); |
615 |
+ dp += v; |
616 |
+ np++; |
617 |
+ } |
618 |
+ |
619 |
+ for (n = 0; n < acol->nbuttons; n++) { |
620 |
+ if (lcol->loc_btn[n].usage != 0 && rid == lcol->loc_btn[n].report_ID) { |
621 |
+ if (hid_get_data(pBuf, &lcol->loc_btn[n])) |
622 |
+ buttons |= (1 << UMS_BUT(n)); |
623 |
+ upd = 1; |
624 |
+ } |
625 |
+ } |
626 |
+ } |
627 |
+ if (acol->loc_cc.usage != 0 && rid == acol->loc_cc.report_ID) |
628 |
+ cc = hid_get_data(pBuf, &acol->loc_cc); |
629 |
+ else |
630 |
+ cc = (nx || ny) ? 1 : 0; |
631 |
+ if (cc > 1) |
632 |
+ buttons = (1 << UMS_BUT(1)); |
633 |
+ if (nx != 0 && acol->xmin != acol->xmax) |
634 |
+ dx /= nx; |
635 |
+ if (ny != 0 && acol->ymin != acol->ymax) |
636 |
+ dy /= ny; |
637 |
+ if (np != 0 && acol->pmin != acol->pmax) |
638 |
+ dp /= np; |
639 |
+// if (upd || nx || ny || np) |
640 |
+// xf86MsgVerb(X_INFO, 3, "%d cc %d dx %d dy %d dz %d dw %d press %d buttons %02x\n", |
641 |
+// nacol, cc, dx, dy, dz, dw, dp, buttons); |
642 |
+ if (nx != 0 || ny != 0) { |
643 |
+ if (acol->pmin != acol->pmax) { |
644 |
+ xf86PostMotionEvent(acol->pInfo->dev, |
645 |
+ /* is_absolute: */ TRUE, |
646 |
+ /* first_valuator: */ 0, |
647 |
+ /* num_valuators: */ 3, |
648 |
+ dx, dy, dp); |
649 |
+ } else if (acol->xmin != acol->xmax || acol->ymin != acol->ymax) { |
650 |
+ xf86PostMotionEvent(acol->pInfo->dev, |
651 |
+ /* is_absolute: */ TRUE, |
652 |
+ /* first_valuator: */ 0, |
653 |
+ /* num_valuators: */ 2, |
654 |
+ dx, dy); |
655 |
+ } |
656 |
+ } |
657 |
+ if (upd || (nx != 0) || (ny != 0)) { |
658 |
+ ((MouseDevPtr)acol->pInfo->private)->PostEvent(acol->pInfo, buttons, |
659 |
+ ((acol->xmin != acol->xmax) ? dx - acol->px : dx), |
660 |
+ ((acol->ymin != acol->ymax) ? dy - acol->py : dy), |
661 |
+ dz, dw); |
662 |
+ } |
663 |
+ if (nx > 0) |
664 |
+ acol->px = dx; |
665 |
+ if (ny > 0) |
666 |
+ acol->py = dy; |
667 |
} |
668 |
- pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw); |
669 |
- return; |
670 |
+ goto next; |
671 |
} |
672 |
|
673 |
static void |
674 |
@@ -615,14 +906,17 @@ |
675 |
usbReadInput ((InputInfoPtr) closure); |
676 |
} |
677 |
|
678 |
-/* This function is called when the protocol is "usb". */ |
679 |
static Bool |
680 |
-usbPreInit(InputInfoPtr pInfo, const char *protocol, int flags) |
681 |
+usbInitFirst(InputInfoPtr pInfo) |
682 |
{ |
683 |
MouseDevPtr pMse = pInfo->private; |
684 |
UsbMsePtr pUsbMse; |
685 |
report_desc_t reportDesc; |
686 |
- int i; |
687 |
+ hid_data_t d; |
688 |
+ hid_item_t h; |
689 |
+ struct UsbMseAcol *acol; |
690 |
+ struct UsbMseLcol *lcol; |
691 |
+ int mdepth, rsize, *rsizep, acolused, lcolused, used; |
692 |
|
693 |
pUsbMse = malloc(sizeof(UsbMseRec)); |
694 |
if (pUsbMse == NULL) { |
695 |
@@ -631,12 +925,7 @@ |
696 |
return FALSE; |
697 |
} |
698 |
|
699 |
- pMse->protocol = protocol; |
700 |
- xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); |
701 |
- |
702 |
- /* Collect the options, and process the common options. */ |
703 |
- COLLECT_INPUT_OPTIONS(pInfo, NULL); |
704 |
- xf86ProcessCommonOptions(pInfo, pInfo->options); |
705 |
+ bzero(pUsbMse, sizeof(UsbMseRec)); |
706 |
|
707 |
/* Check if the device can be opened. */ |
708 |
pInfo->fd = xf86OpenSerial(pInfo->options); |
709 |
@@ -652,19 +941,134 @@ |
710 |
} |
711 |
/* Get USB informations */ |
712 |
reportDesc = hid_get_report_desc(pInfo->fd); |
713 |
- /* Get packet size & iid */ |
714 |
-#ifdef USB_NEW_HID |
715 |
- if (ioctl(pInfo->fd, USB_GET_REPORT_ID, &pUsbMse->iid) == -1) { |
716 |
- xf86Msg(X_ERROR, "Error ioctl USB_GET_REPORT_ID on %s : %s\n", |
717 |
- pInfo->name, strerror(errno)); |
718 |
- return FALSE; |
719 |
- } |
720 |
- pUsbMse->packetSize = hid_report_size(reportDesc, hid_input, |
721 |
- pUsbMse->iid); |
722 |
-#else |
723 |
- pUsbMse->packetSize = hid_report_size(reportDesc, hid_input, |
724 |
- &pUsbMse->iid); |
725 |
-#endif |
726 |
+ mdepth = 0; |
727 |
+ pUsbMse->nacols = 0; |
728 |
+ acol = &pUsbMse->acols[pUsbMse->nacols]; |
729 |
+ lcol = &acol->lcols[acol->nlcols]; |
730 |
+ acolused = 0; |
731 |
+ lcolused = 0; |
732 |
+ d = hid_start_parse(reportDesc, (1 << hid_input) | |
733 |
+ (1 << hid_collection) | (1 << hid_endcollection), -1); |
734 |
+ while (hid_get_item(d, &h)) { |
735 |
+ switch (h.kind) { |
736 |
+ case hid_collection: |
737 |
+ if (mdepth != 0) |
738 |
+ mdepth++; |
739 |
+ else if (h.collection == 1 && |
740 |
+ (h.usage == 0x00010001 || h.usage == 0x00010002 || |
741 |
+ (h.usage >= 0x000d0001 && h.usage <= 0x000d000d))) { |
742 |
+ mdepth++; |
743 |
+ if (acolused) { |
744 |
+ if (lcolused) { |
745 |
+ acol->nlcols++; |
746 |
+ lcolused = 0; |
747 |
+ } |
748 |
+ pUsbMse->nacols++; |
749 |
+ acolused = 0; |
750 |
+ acol = &pUsbMse->acols[pUsbMse->nacols]; |
751 |
+ lcol = &acol->lcols[acol->nlcols]; |
752 |
+ } |
753 |
+ } |
754 |
+ if (lcolused && (h.collection == 0 || |
755 |
+ h.collection == 2 || h.collection == 3)) { |
756 |
+ acol->nlcols++; |
757 |
+ lcolused = 0; |
758 |
+ lcol = &acol->lcols[acol->nlcols]; |
759 |
+ } |
760 |
+ break; |
761 |
+ case hid_endcollection: |
762 |
+ if (mdepth != 0) |
763 |
+ mdepth--; |
764 |
+ break; |
765 |
+ case hid_input: |
766 |
+ if (h.report_ID != 0) |
767 |
+ pUsbMse->iid = 1; |
768 |
+ rsize = pUsbMse->iid + |
769 |
+ (h.pos + (h.report_size * h.report_count) + 7) / 8; |
770 |
+ if ((rsizep = usbGetReportSizePtr(pUsbMse, h.report_ID)) != NULL) |
771 |
+ *rsizep = max(*rsizep, rsize); |
772 |
+ pUsbMse->packetSize = max(pUsbMse->packetSize, rsize); |
773 |
+ if (mdepth == 0) |
774 |
+ break; |
775 |
+ used = 1; |
776 |
+ if (h.usage == 0x00010030) { /* X */ |
777 |
+ lcol->loc_x = h; |
778 |
+ if ((h.flags & 0x04) == 0) { |
779 |
+ if (acol->xmin == acol->xmax) { |
780 |
+ acol->xmin = h.logical_minimum; |
781 |
+ acol->xmax = h.logical_maximum; |
782 |
+ } else { |
783 |
+ acol->xmin = min(acol->xmin, h.logical_minimum); |
784 |
+ acol->xmax = max(acol->xmax, h.logical_maximum); |
785 |
+ } |
786 |
+ } |
787 |
+ } else if (h.usage == 0x00010031) { /* Y */ |
788 |
+ lcol->loc_y = h; |
789 |
+ if ((h.flags & 0x04) == 0) { |
790 |
+ if (acol->ymin == acol->ymax) { |
791 |
+ acol->ymin = h.logical_minimum; |
792 |
+ acol->ymax = h.logical_maximum; |
793 |
+ } else { |
794 |
+ acol->ymin = min(acol->ymin, h.logical_minimum); |
795 |
+ acol->ymax = max(acol->ymax, h.logical_maximum); |
796 |
+ } |
797 |
+ } |
798 |
+ } else if (h.usage == 0x00010038) { /* Z */ |
799 |
+ lcol->loc_z = h; |
800 |
+ acol->hasZ = 1; |
801 |
+ } else if (h.usage == 0x000c0238) { /* W */ |
802 |
+ lcol->loc_w = h; |
803 |
+ acol->hasW = 1; |
804 |
+ } else if (h.usage == 0x000d0030) { /* Press */ |
805 |
+ lcol->loc_p = h; |
806 |
+ if ((h.flags & 0x04) == 0) { |
807 |
+ if (acol->pmin == acol->pmax) { |
808 |
+ acol->pmin = h.logical_minimum; |
809 |
+ acol->pmax = h.logical_maximum; |
810 |
+ } else { |
811 |
+ acol->pmin = min(acol->pmin, h.logical_minimum); |
812 |
+ acol->pmax = max(acol->pmax, h.logical_maximum); |
813 |
+ } |
814 |
+ } |
815 |
+ } else if (h.usage == 0x000d0032) /* In Range */ |
816 |
+ lcol->loc_in_range = h; |
817 |
+ else if (h.usage == 0x000d0047) /* Valid */ |
818 |
+ lcol->loc_valid = h; |
819 |
+ else if (h.usage > 0x00090000 && |
820 |
+ h.usage <= 0x00090000 + MSE_MAXBUTTONS) { /* Buttons */ |
821 |
+ lcol->loc_btn[(h.usage & 0xffff) - 1] = h; |
822 |
+ acol->nbuttons = max(acol->nbuttons, h.usage & 0xffff); |
823 |
+ } else if (h.usage == 0x000d0042) { /* Tip Switch */ |
824 |
+ lcol->loc_btn[0] = h; |
825 |
+ acol->nbuttons = max(acol->nbuttons, 1); |
826 |
+ } else if (h.usage == 0x000d0044) { /* Barrel Switch */ |
827 |
+ lcol->loc_btn[1] = h; |
828 |
+ acol->nbuttons = max(acol->nbuttons, 2); |
829 |
+ } else if (h.usage == 0x000d0045) { /* Eraser */ |
830 |
+ lcol->loc_btn[3] = h; |
831 |
+ acol->nbuttons = max(acol->nbuttons, 4); |
832 |
+ } else if (h.usage == 0x000d0046) { /* Tablet Pick */ |
833 |
+ lcol->loc_btn[2] = h; |
834 |
+ acol->nbuttons = max(acol->nbuttons, 3); |
835 |
+ } else if (h.usage == 0x000d0054) /* Contact Count */ |
836 |
+ acol->loc_cc = h; |
837 |
+ else |
838 |
+ used = 0; |
839 |
+ lcolused += used; |
840 |
+ acolused += used; |
841 |
+ break; |
842 |
+ default: |
843 |
+ break; |
844 |
+ } |
845 |
+ } |
846 |
+ if (lcolused) |
847 |
+ acol->nlcols++; |
848 |
+ if (acolused) |
849 |
+ pUsbMse->nacols++; |
850 |
+ hid_end_parse(d); |
851 |
+ xf86Msg(X_DEFAULT, "%s: Found %d usable logical collections\n", |
852 |
+ pInfo->name, pUsbMse->nacols); |
853 |
+ |
854 |
/* Allocate buffer */ |
855 |
if (pUsbMse->packetSize <= 8) { |
856 |
pUsbMse->buffer = pMse->protoBuf; |
857 |
@@ -674,56 +1078,129 @@ |
858 |
if (pUsbMse->buffer == NULL) { |
859 |
xf86Msg(X_ERROR, "%s: cannot allocate buffer\n", pInfo->name); |
860 |
free(pUsbMse); |
861 |
- free(pMse); |
862 |
xf86CloseSerial(pInfo->fd); |
863 |
return FALSE; |
864 |
} |
865 |
-#ifdef USB_NEW_HID |
866 |
- if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), |
867 |
- hid_input, &pUsbMse->loc_x, pUsbMse->iid) < 0) { |
868 |
- xf86Msg(X_WARNING, "%s: no x locator\n", pInfo->name); |
869 |
- } |
870 |
- if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), |
871 |
- hid_input, &pUsbMse->loc_y, pUsbMse->iid) < 0) { |
872 |
- xf86Msg(X_WARNING, "%s: no y locator\n", pInfo->name); |
873 |
- } |
874 |
- if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), |
875 |
- hid_input, &pUsbMse->loc_z, pUsbMse->iid) < 0) { |
876 |
- } |
877 |
-#else |
878 |
- if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_X), |
879 |
- hid_input, &pUsbMse->loc_x) < 0) { |
880 |
- xf86Msg(X_WARNING, "%s: no x locator\n", pInfo->name); |
881 |
- } |
882 |
- if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_Y), |
883 |
- hid_input, &pUsbMse->loc_y) < 0) { |
884 |
- xf86Msg(X_WARNING, "%s: no y locator\n", pInfo->name); |
885 |
- } |
886 |
- if (hid_locate(reportDesc, HID_USAGE2(HUP_GENERIC_DESKTOP, HUG_WHEEL), |
887 |
- hid_input, &pUsbMse->loc_z) < 0) { |
888 |
- } |
889 |
-#endif |
890 |
- /* Probe for number of buttons */ |
891 |
- for (i = 1; i <= MSE_MAXBUTTONS; i++) { |
892 |
- if (!hid_locate(reportDesc, HID_USAGE2(HUP_BUTTON, i), |
893 |
- hid_input, &pUsbMse->loc_btn[i-1] |
894 |
-#ifdef USB_NEW_HID |
895 |
- , pUsbMse->iid |
896 |
-#endif |
897 |
- )) |
898 |
- break; |
899 |
- } |
900 |
- pMse->buttons = i-1; |
901 |
|
902 |
xf86CloseSerial(pInfo->fd); |
903 |
pInfo->fd = -1; |
904 |
|
905 |
/* Private structure */ |
906 |
pMse->mousePriv = pUsbMse; |
907 |
+ return TRUE; |
908 |
+} |
909 |
+ |
910 |
+/* This function is called when the protocol is "usb". */ |
911 |
+static Bool |
912 |
+usbPreInit(InputInfoPtr pInfo, const char *protocol, int flags) |
913 |
+{ |
914 |
+ InputInfoPtr pMatch; |
915 |
+ MouseDevPtr pMse = pInfo->private; |
916 |
+ UsbMsePtr pUsbMse; |
917 |
+ struct UsbMseAcol *acol; |
918 |
+ char *str; |
919 |
+ int i, colopt; |
920 |
+ |
921 |
+ pMse->protocol = protocol; |
922 |
+ xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); |
923 |
+ |
924 |
+ /* Collect the options, and process the common options. */ |
925 |
+ COLLECT_INPUT_OPTIONS(pInfo, NULL); |
926 |
+ xf86ProcessCommonOptions(pInfo, pInfo->options); |
927 |
+ |
928 |
+ /* Check if this HID device is already opened. */ |
929 |
+ for (pMatch = xf86FirstLocalDevice(); pMatch != NULL; pMatch = pMatch->next) { |
930 |
+ if ((pInfo != pMatch) && strstr(pMatch->drv->driverName, "mouse")) { |
931 |
+ char *dev1, *dev2; |
932 |
+ |
933 |
+ dev1 = xf86SetStrOption(pInfo->options, "Device", NULL); |
934 |
+ dev2 = xf86SetStrOption(pMatch->options, "Device", NULL); |
935 |
+ if (strcmp(dev1, dev2) == 0) { |
936 |
+ free(dev1); |
937 |
+ free(dev2); |
938 |
+ break; |
939 |
+ } |
940 |
+ free(dev1); |
941 |
+ free(dev2); |
942 |
+ } |
943 |
+ } |
944 |
+ if (pMatch == NULL) { |
945 |
+ xf86Msg(X_DEFAULT, "%s: Opening new HID device\n", pInfo->name); |
946 |
+ if (!usbInitFirst(pInfo)) { |
947 |
+ free(pMse); |
948 |
+ return FALSE; |
949 |
+ } |
950 |
+ } else { |
951 |
+ pMse->mousePriv = ((MouseDevPtr)pMatch->private)->mousePriv; |
952 |
+ xf86Msg(X_DEFAULT, "%s: Attaching to already opened HID device\n", |
953 |
+ pInfo->name); |
954 |
+ } |
955 |
+ pUsbMse = pMse->mousePriv; |
956 |
+ |
957 |
+ /* Attach to collection, respecting "Collection" option. */ |
958 |
+ colopt = xf86SetIntOption(pInfo->options, "Collection", 0); |
959 |
+ for (i = 0; i < pUsbMse->nacols; i++) { |
960 |
+ if (pUsbMse->acols[i].pInfo == NULL && |
961 |
+ (colopt == 0 || i == colopt - 1)) { |
962 |
+ pUsbMse->acols[i].pInfo = pInfo; |
963 |
+ break; |
964 |
+ } |
965 |
+ } |
966 |
+ xf86Msg(colopt == 0 ? X_DEFAULT : X_CONFIG, |
967 |
+ "%s: Collection: %d\n", pInfo->name, |
968 |
+ i == pUsbMse->nacols ? colopt : i + 1); |
969 |
+ if (i == pUsbMse->nacols) { |
970 |
+ xf86Msg(X_ERROR, |
971 |
+ "%s: Application collection not found or already handled\n", |
972 |
+ pInfo->name); |
973 |
+ free(pMse); |
974 |
+ return FALSE; |
975 |
+ } |
976 |
+ |
977 |
+ acol = &pUsbMse->acols[i]; |
978 |
+ pMse->buttons = acol->nbuttons; |
979 |
+ if (pMse->buttons == 2) |
980 |
+ pMse->buttons = 3; |
981 |
+ if (acol->xmin != acol->xmax || acol->ymin != acol->ymax) |
982 |
+ pMse->disableXY = TRUE; |
983 |
+ pMse->hasZ = acol->hasZ; |
984 |
+ pMse->hasW = acol->hasW; |
985 |
|
986 |
/* Process common mouse options (like Emulate3Buttons, etc). */ |
987 |
pMse->CommonOptions(pInfo); |
988 |
|
989 |
+ /* Process "Calibration" option. */ |
990 |
+ str = xf86CheckStrOption(pInfo->options, "Calibration", NULL); |
991 |
+ if (str != NULL && (acol->xmin != acol->xmax || acol->ymin != acol->ymax)) { |
992 |
+ int j, xmin, xmax, ymin, ymax, pmin, pmax; |
993 |
+ |
994 |
+ j = sscanf(str, "%d %d %d %d %d %d", &xmin, &xmax, &ymin, &ymax, &pmin, &pmax); |
995 |
+ if (j == 4) { |
996 |
+ xf86Msg(X_CONFIG, "%s: Calibration: %d %d %d %d\n", |
997 |
+ pInfo->name, xmin, xmax, ymin, ymax); |
998 |
+ acol->cxmin = xmin; |
999 |
+ acol->cxmax = xmax; |
1000 |
+ acol->cymin = ymin; |
1001 |
+ acol->cymax = ymax; |
1002 |
+ } else if (j == 6) { |
1003 |
+ xf86Msg(X_CONFIG, "%s: Calibration: %d %d %d %d %d %d\n", |
1004 |
+ pInfo->name, xmin, xmax, ymin, ymax, pmin, pmax); |
1005 |
+ acol->cxmin = xmin; |
1006 |
+ acol->cxmax = xmax; |
1007 |
+ acol->cymin = ymin; |
1008 |
+ acol->cymax = ymax; |
1009 |
+ acol->cpmin = pmin; |
1010 |
+ acol->cpmax = pmax; |
1011 |
+ } else |
1012 |
+ xf86Msg(X_WARNING, "%s: Calibration: Invalid arguments\n", |
1013 |
+ pInfo->name); |
1014 |
+ free(str); |
1015 |
+ } else if (acol->xmin != acol->xmax || acol->ymin != acol->ymax) { |
1016 |
+ xf86Msg(X_DEFAULT, "%s: Calibration: %d %d %d %d %d %d\n", |
1017 |
+ pInfo->name, acol->xmin, acol->xmax, acol->ymin, acol->ymax, |
1018 |
+ acol->pmin, acol->pmax); |
1019 |
+ } |
1020 |
+ |
1021 |
/* Setup the local procs. */ |
1022 |
pInfo->device_control = usbMouseProc; |
1023 |
pInfo->read_input = usbReadInput; |
1024 |
@@ -766,7 +1243,9 @@ |
231 |
p->CheckProtocol = CheckProtocol; |
1025 |
p->CheckProtocol = CheckProtocol; |
232 |
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE) |
1026 |
#if (defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)) && defined(MOUSE_PROTO_SYSMOUSE) |
233 |
p->SetupAuto = SetupAuto; |
1027 |
p->SetupAuto = SetupAuto; |