Commit bdc40d1a769229082cf91f8fd344f230996a6440

  • avatar
  • Peter Hutterer <peter.hutterer @wh…t.net>
  • Thu Dec 24 00:01:01 CET 2009
common and priv both have debugLevel, just pass them in as-is.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  
5757{
5858 WacomDevicePtr priv = (WacomDevicePtr) local->private;
5959
60 DBG(10, priv->debugLevel, "\n"); /* just prints function name */
60 DBG(10, priv, "\n"); /* just prints function name */
6161
6262 xf86WcmVirtualTabletSize(local);
6363
8181 if (priv->currentScreen == -1) /* tool on the tablet */
8282 priv->currentScreen = 0;
8383
84 DBG(10, priv->debugLevel,
84 DBG(10, priv,
8585 "Active tablet area x=%d y=%d (virtual tablet area x=%d y=%d) map"
8686 " to maxWidth =%d maxHeight =%d\n",
8787 priv->bottomX, priv->bottomY, priv->sizeX, priv->sizeY,
8989
9090 priv->factorX = (double)priv->maxWidth / (double)priv->sizeX;
9191 priv->factorY = (double)priv->maxHeight / (double)priv->sizeY;
92 DBG(2, priv->debugLevel, "X factor = %.3g, Y factor = %.3g\n",
92 DBG(2, priv, "X factor = %.3g, Y factor = %.3g\n",
9393 priv->factorX, priv->factorY);
9494}
9595
106106 WacomDevicePtr priv = (WacomDevicePtr) local->private;
107107 int screenToSet = -1, i, j, x, y, tabletSize = 0;
108108
109 DBG(6, priv->debugLevel, "v0=%d v1=%d "
109 DBG(6, priv, "v0=%d v1=%d "
110110 "currentScreen=%d\n", v0, v1, priv->currentScreen);
111111
112112 if (priv->screen_no != -1 && priv->screen_no >= priv->numScreen)
152152 if (v0 > priv->topY && v0 <= priv->topY + priv->tvoffsetY)
153153 priv->currentScreen = 1;
154154 }
155 DBG(10, priv->debugLevel, "TwinView setup screenToSet=%d\n",
155 DBG(10, priv, "TwinView setup screenToSet=%d\n",
156156 priv->currentScreen);
157157 }
158158
194194
195195 if (screenToSet == -1)
196196 {
197 DBG(3, priv->debugLevel, "Error: "
197 DBG(3, priv, "Error: "
198198 "Can not find valid screen (currentScreen=%d)\n",
199199 priv->currentScreen);
200200 return;
210210 y = screenInfo.screens[screenToSet]->height - 1;
211211
212212 xf86XInputSetScreen(local, screenToSet, x, y);
213 DBG(10, priv->debugLevel, "current=%d ToSet=%d\n",
213 DBG(10, priv, "current=%d ToSet=%d\n",
214214 priv->currentScreen, screenToSet);
215215 priv->currentScreen = screenToSet;
216216}
227227 int button, mask;
228228 WacomDevicePtr priv = (WacomDevicePtr) local->private;
229229 WacomCommonPtr common = priv->common;
230 DBG(6, priv->debugLevel, "buttons=%d for %s\n", buttons, local->name);
230 DBG(6, priv, "buttons=%d for %s\n", buttons, local->name);
231231
232232 /* Tablet PC buttons only apply to penabled devices */
233233 if (common->wcmTPCButton && (priv->flags & STYLUS_ID))
460460 if (!priv->button[button]) /* ignore this button event */
461461 return;
462462
463 DBG(4, priv->debugLevel, "TPCButton(%s) button=%d state=%d "
463 DBG(4, priv, "TPCButton(%s) button=%d state=%d "
464464 "code=%08x, for %s coreEvent=%s \n",
465465 common->wcmTPCButton ? "on" : "off",
466466 button, mask, priv->button[button],
577577 unsigned *keyP = 0;
578578 int is_absolute = priv->flags & ABSOLUTE_FLAG;
579579
580 DBG(10, priv->debugLevel, "strip events for %s \n", local->name);
580 DBG(10, priv, "strip events for %s \n", local->name);
581581
582582 /* emulate events for relative wheel */
583583 if ( ds->relwheel )
667667
668668 if (!fakeButton) return;
669669
670 DBG(10, priv->debugLevel, "send fakeButton %x with value = %d \n",
670 DBG(10, priv, "send fakeButton %x with value = %d \n",
671671 fakeButton, value);
672672
673673 switch (fakeButton & AC_TYPE)
745745
746746 if (priv->serial && serial != priv->serial)
747747 {
748 DBG(10, priv->debugLevel, "[%s] serial number"
748 DBG(10, priv, "[%s] serial number"
749749 " is %u but your system configured %u",
750750 local->name, serial, (int)priv->serial);
751751 return;
765765 ty = ds->stripy;
766766 }
767767
768 DBG(7, priv->debugLevel, "[%s] o_prox=%s x=%d y=%d z=%d "
768 DBG(7, priv, "[%s] o_prox=%s x=%d y=%d z=%d "
769769 "b=%s b=%d tx=%d ty=%d wl=%d rot=%d th=%d\n",
770770 (type == STYLUS_ID) ? "stylus" :
771771 (type == CURSOR_ID) ? "cursor" :
820820 }
821821 v5 = wheel;
822822
823 DBG(6, priv->debugLevel, "[%s] %s prox=%d\tx=%d"
823 DBG(6, priv, "[%s] %s prox=%d\tx=%d"
824824 "\ty=%d\tz=%d\tv3=%d\tv4=%d\tv5=%d\tid=%d"
825825 "\tserial=%u\tbutton=%s\tbuttons=%d\n",
826826 local->name,
10661066 dsNew->y = dsOrig->y;
10671067 }
10681068
1069 DBG(10, common->debugLevel, "level = %d"
1069 DBG(10, common, "level = %d"
10701070 " return value = %d\n", suppress, returnV);
10711071 return returnV;
10721072}
11011101 pChannel = common->wcmChannel + channel;
11021102 pLast = &pChannel->valid.state;
11031103
1104 DBG(10, common->debugLevel, "channel = %d\n", channel);
1104 DBG(10, common, "channel = %d\n", channel);
11051105
11061106 /* sanity check the channel */
11071107 if (channel >= MAX_CHANNELS)
11131113
11141114 /* timestamp the state for velocity and acceleration analysis */
11151115 ds.sample = (int)GetTimeInMillis();
1116 DBG(10, common->debugLevel,
1116 DBG(10, common,
11171117 "c=%d i=%d t=%d s=%u x=%d y=%d b=%d "
11181118 "p=%d rz=%d tx=%d ty=%d aw=%d rw=%d "
11191119 "t=%d df=%d px=%d st=%d cs=%d \n",
11311131 if ( (pChannel->nSamples < 2) && (common->wcmDevCls == &gWacomUSBDevice) &&
11321132 ds.device_type != PAD_ID && (ds.device_type != TOUCH_ID) )
11331133 {
1134 DBG(11, common->debugLevel,
1134 DBG(11, common,
11351135 "discarded %dth USB data.\n",
11361136 pChannel->nSamples);
11371137 ++pChannel->nSamples;
11471147 fs = &pChannel->rawFilter;
11481148 if (!fs->npoints && ds.proximity)
11491149 {
1150 DBG(11, common->debugLevel, "initialize Channel data.\n");
1150 DBG(11, common, "initialize Channel data.\n");
11511151 /* store channel device state for later use */
11521152 for (i=common->wcmRawSample - 1; i>=0; i--)
11531153 {
11801180 {
11811181 if (common->wcmModel->FilterRaw(common,pChannel,&ds))
11821182 {
1183 DBG(10, common->debugLevel,
1183 DBG(10, common,
11841184 "Raw filtering discarded data.\n");
11851185 resetSampleCounter(pChannel);
11861186 return; /* discard */
13351335 }
13361336 }
13371337
1338 DBG(10, common->debugLevel, "device type = %d\n", ds->device_type);
1338 DBG(10, common, "device type = %d\n", ds->device_type);
13391339 /* Find the device the current events are meant for */
13401340 /* 1: Find the tool (the one with correct serial or in second
13411341 * hand, the one with serial set to 0 if no match with the
13981398 LocalDevicePtr oDev = outprox->device;
13991399 WacomDeviceState out = { 0 };
14001400 out.device_type = DEVICE_ID(((WacomDevicePtr)(oDev->private))->flags);
1401 DBG(2, common->debugLevel, "Soft prox-out for %s\n",
1401 DBG(2, common, "Soft prox-out for %s\n",
14021402 outprox->device->name);
14031403 xf86WcmSendEvents(oDev, &out);
14041404 }
14101410 if(tool->current)
14111411 {
14121412 pDev = tool->current->device;
1413 DBG(11, common->debugLevel, "tool id=%d for %s\n",
1413 DBG(11, common, "tool id=%d for %s\n",
14141414 ds->device_type, pDev->name);
14151415 }
14161416 }
14681468 /* Send soft prox-out for touch first */
14691469 WacomDeviceState out = { 0 };
14701470 out.device_type = DEVICE_ID(temppriv->flags);
1471 DBG(2, common->debugLevel,
1471 DBG(2, common,
14721472 "Send soft prox-out for %s first\n",
14731473 localDevices->name);
14741474 xf86WcmSendEvents(localDevices, &out);
15411541 }
15421542 else /* no other events to send */
15431543 {
1544 DBG(10, common->debugLevel, "Ignore non-movement relative data \n");
1544 DBG(10, common, "Ignore non-movement relative data \n");
15451545 return;
15461546 }
15471547 }
15701570 if (common->wcmMaxCursorDist < filtered.distance)
15711571 common->wcmMaxCursorDist = filtered.distance;
15721572 }
1573 DBG(10, common->debugLevel, "Distance over"
1573 DBG(10, common, "Distance over"
15741574 " the tablet: %d, ProxoutDist: %d current"
15751575 " min/max %d hard prox: %d\n",
15761576 filtered.distance,
16041604 /* otherwise, if no device matched... */
16051605 else
16061606 {
1607 DBG(11, common->debugLevel, "no device matches with"
1607 DBG(11, common, "no device matches with"
16081608 " id=%d, serial=%u\n",
16091609 ds->device_type, ds->serial_num);
16101610 }
18021802 priv->screenBottomY[1] = priv->tvResolution[1];
18031803 }
18041804
1805 DBG(10, priv->debugLevel, "\"%s\":"
1805 DBG(10, priv, "\"%s\":"
18061806 "topX0=%d topY0=%d bottomX0=%d bottomY0=%d "
18071807 "topX1=%d topY1=%d bottomX1=%d bottomY1=%d \n",
18081808 local->name, priv->screenTopX[0], priv->screenTopY[0],
18201820 WacomDevicePtr priv = (WacomDevicePtr)local->private;
18211821 int i;
18221822
1823 DBG(2, priv->debugLevel, "\"%s\":"
1823 DBG(2, priv, "\"%s\":"
18241824 "number of screen=%d \n", local->name, screenInfo.numScreens);
18251825 priv->tvoffsetX = 0;
18261826 priv->tvoffsetY = 0;
18451845 priv->screenBottomX[i] = dixScreenOrigins[i].x;
18461846 priv->screenBottomY[i] = dixScreenOrigins[i].y;
18471847
1848 DBG(10, priv->debugLevel, "from dix for \"%s\" "
1848 DBG(10, priv, "from dix for \"%s\" "
18491849 "ScreenOrigins[%d].x=%d ScreenOrigins[%d].y=%d \n",
18501850 local->name, i, priv->screenTopX[i], i,
18511851 priv->screenTopY[i]);
18541854 priv->screenBottomX[i] += screenInfo.screens[i]->width;
18551855 priv->screenBottomY[i] += screenInfo.screens[i]->height;
18561856
1857 DBG(10, priv->debugLevel, "\"%s\":"
1857 DBG(10, priv, "\"%s\":"
18581858 "topX[%d]=%d topY[%d]=%d bottomX[%d]=%d bottomY[%d]=%d \n",
18591859 local->name, i, priv->screenTopX[i], i, priv->screenTopY[i],
18601860 i, priv->screenBottomX[i], i, priv->screenBottomY[i]);
18711871 WacomToolAreaPtr area = priv->toolarea;
18721872 int tmpTopX, tmpTopY, tmpBottomX, tmpBottomY, oldMaxX, oldMaxY;
18731873
1874 DBG(10, priv->debugLevel, "\"%s\"", priv->local->name);
1874 DBG(10, priv, "\"%s\"", priv->local->name);
18751875
18761876 if (!IsTouch(priv))
18771877 {
19481948 int oldRotation;
19491949 int tmpTopX, tmpTopY, tmpBottomX, tmpBottomY, oldMaxX, oldMaxY;
19501950
1951 DBG(10, priv->debugLevel, "\"%s\":\n", local->name);
1951 DBG(10, priv, "\"%s\":\n", local->name);
19521952
19531953 if (common->wcmRotate == value) /* initialization */
19541954 {
  
229229 WacomDevicePtr dev;
230230 WacomDevicePtr *prev;
231231
232 DBG(1, priv->debugLevel, "\n");
232 DBG(1, priv, "\n");
233233
234234 if (priv->isParent)
235235 {
289289 strstr(pMatch->drv->driverName, "wacom") &&
290290 !strcmp(privMatch->common->wcmDevice, common->wcmDevice))
291291 {
292 DBG(2, priv->debugLevel,
293 "port share between"
292 DBG(2, priv, "port share between"
294293 " %s and %s\n", pLocal->name, pMatch->name);
295294 type = xf86FindOptionValue(pMatch->options, "Type");
296295 if ( type && (strstr(type, "eraser")) )
  
248248 WacomDeviceState *pLast;
249249 int *x, *y, i;
250250
251 DBG(10, common->debugLevel,
252 "common->wcmRawSample = %d \n", common->wcmRawSample);
251 DBG(10, common, "common->wcmRawSample = %d \n", common->wcmRawSample);
253252 x = pChannel->rawFilter.x;
254253 y = pChannel->rawFilter.y;
255254
  
123123 WacomDevicePtr priv = (WacomDevicePtr)local->private;
124124 WacomCommonPtr common = priv->common;
125125
126 DBG(1, priv->debugLevel, "initializing ISDV4 tablet\n");
126 DBG(1, priv, "initializing ISDV4 tablet\n");
127127
128128 /* Initial baudrate is 38400 */
129129 if (xf86SetSerialSpeed(local->fd, common->wcmISDV4Speed) < 0)
150150 WacomDevicePtr priv = (WacomDevicePtr)local->private;
151151 WacomCommonPtr common = priv->common;
152152
153 DBG(1, priv->debugLevel, "Querying ISDV4 tablet\n");
153 DBG(1, priv, "Querying ISDV4 tablet\n");
154154
155155 /* Send stop command to the tablet */
156156 err = xf86WriteSerial(local->fd, WC_ISDV4_STOP, strlen(WC_ISDV4_STOP));
256256 WacomCommonPtr common = priv->common;
257257 int ret = Success;
258258
259 DBG(2, priv->debugLevel, "getting ISDV4 Ranges\n");
259 DBG(2, priv, "getting ISDV4 Ranges\n");
260260
261261 /* Send query command to the tablet */
262262 ret = isdv4Query(local, WC_ISDV4_QUERY, data);
281281 if (!common->wcmMaxX || !common->wcmMaxY)
282282 common->tablet_id = 0xE2;
283283
284 DBG(2, priv->debugLevel, "Pen speed=%d "
284 DBG(2, priv, "Pen speed=%d "
285285 "maxX=%d maxY=%d maxZ=%d resX=%d resY=%d \n",
286286 common->wcmISDV4Speed, common->wcmMaxX, common->wcmMaxY,
287287 common->wcmMaxZ, common->wcmResolX, common->wcmResolY);
367367 common->wcmVersion = ( data[10] | (data[9] << 7) );
368368 ret = Success;
369369
370 DBG(2, priv->debugLevel, "touch speed=%d "
370 DBG(2, priv, "touch speed=%d "
371371 "maxTouchX=%d maxTouchY=%d TouchresX=%d TouchresY=%d \n",
372372 common->wcmISDV4Speed, common->wcmMaxTouchX,
373373 common->wcmMaxTouchY, common->wcmTouchResolX,
401401 WacomDeviceState* ds;
402402 int n, cur_type, channel = 0;
403403
404 DBG(10, common->debugLevel, "\n");
404 DBG(10, common, "\n");
405405
406406 /* determine the type of message (touch or stylus) */
407407 if (data[0] & 0x10) /* a touch data */
484484 }
485485 }
486486
487 DBG(8, priv->debugLevel, "MultiTouch "
487 DBG(8, priv, "MultiTouch "
488488 "%s proximity \n", ds->proximity ? "in" : "out of");
489489 }
490490 else
536536 ds->device_id = ERASER_DEVICE_ID;
537537 }
538538
539 DBG(8, priv->debugLevel, "%s\n",
539 DBG(8, priv, "%s\n",
540540 ds->device_type == ERASER_ID ? "ERASER " :
541541 ds->device_type == STYLUS_ID ? "STYLUS" : "NONE");
542542 }
  
129129 secondChannel->valid.states[1] };
130130 int direction = 0;
131131
132 DBG(10, priv->debugLevel, "\n");
132 DBG(10, priv, "\n");
133133
134134 /* skip initial second finger event */
135135 if (!dsLast[1].proximity)
316316 int gesture = 0;
317317 WacomFilterState filterd; /* borrow this struct */
318318
319 DBG(10, priv->debugLevel, "\n");
319 DBG(10, priv, "\n");
320320
321321 /* initialize the points so we can rotate them */
322322 filterd.x[0] = ds[0].x;
391391 int dist = touchDistance(common->wcmGestureState[0],
392392 common->wcmGestureState[1]);
393393
394 DBG(10, priv->debugLevel, "\n");
394 DBG(10, priv, "\n");
395395
396396 dist = touchDistance(ds[0], ds[1]) - dist;
397397
src/wcmUSB.c
(17 / 17)
  
372372#ifdef DEBUG
373373 WacomDevicePtr priv = (WacomDevicePtr)local->private;
374374
375 DBG(1, priv->debugLevel, "\n");
375 DBG(1, priv, "\n");
376376#endif
377377
378378 SYSCALL(err = ioctl(local->fd, EVIOCGVERSION, &version));
508508 WacomDevicePtr priv = (WacomDevicePtr)local->private;
509509 WacomCommonPtr common = priv->common;
510510
511 DBG(1, priv->debugLevel, "initializing USB tablet\n");
511 DBG(1, priv, "initializing USB tablet\n");
512512 *version = 0.0;
513513
514514 /* fetch vendor, product, and model name */
722722 WacomDevicePtr priv = (WacomDevicePtr)local->private;
723723 WacomCommonPtr common = priv->common;
724724
725 DBG(10, common->debugLevel, "\n");
725 DBG(10, common, "\n");
726726 if (IsPad (priv))
727727 priv->nbuttons = common->npadkeys;
728728 else
813813 wcmEvent(common, i, &common->wcmChannel[i].work);
814814 }
815815 }
816 DBG(1, common->debugLevel, "device with serial number: %u"
816 DBG(1, common, "device with serial number: %u"
817817 " at %d: Exceeded channel count; ignoring the events.\n",
818818 serial, (int)GetTimeInMillis());
819819 }
830830 WacomDevicePtr priv = (WacomDevicePtr)local->private;
831831 WacomCommonPtr common = priv->common;
832832
833 DBG(10, common->debugLevel, "\n");
833 DBG(10, common, "\n");
834834 /* store events until we receive the MSC_SERIAL containing
835835 * the serial number; without it we cannot determine the
836836 * correct channel. */
890890 /* ignore events without information */
891891 if (common->wcmEventCnt <= 2)
892892 {
893 DBG(3, common->debugLevel, "%s: dropping empty event"
893 DBG(3, common, "%s: dropping empty event"
894894 " for serial %d\n", local->name, common->wcmLastToolSerial);
895895 goto skipEvent;
896896 }
923923 WacomDevicePtr priv = (WacomDevicePtr)local->private;
924924 WacomCommonPtr common = priv->common;
925925
926 DBG(6, common->debugLevel, "%d events received\n", common->wcmEventCnt);
926 DBG(6, common, "%d events received\n", common->wcmEventCnt);
927927 #define MOD_BUTTONS(bit, value) do { \
928928 shift = 1<<bit; \
929929 ds->buttons = (((value) != 0) ? \
931931 } while (0)
932932
933933 if (common->wcmEventCnt == 1 && !common->wcmEvents->type) {
934 DBG(6, common->debugLevel, "no real events received\n");
934 DBG(6, common, "no real events received\n");
935935 return;
936936 }
937 DBG(6, common->debugLevel, "%d events received\n", common->wcmEventCnt);
937 DBG(6, common, "%d events received\n", common->wcmEventCnt);
938938
939939 /* all USB data operates from previous context except relative values*/
940940 ds = &common->wcmChannel[channel].work;
945945 for (i=0; i<common->wcmEventCnt; ++i)
946946 {
947947 event = common->wcmEvents + i;
948 DBG(11, common->debugLevel,
948 DBG(11, common,
949949 "event[%d]->type=%d code=%d value=%d\n",
950950 i, event->type, event->code, event->value);
951951
10021002 if (common->wcmProtocolLevel == 4)
10031003 ds->device_id = STYLUS_DEVICE_ID;
10041004 ds->proximity = (event->value != 0);
1005 DBG(6, common->debugLevel,
1005 DBG(6, common,
10061006 "USB stylus detected %x\n",
10071007 event->code);
10081008 }
10151015 ds->proximity = (event->value != 0);
10161016 if (ds->proximity)
10171017 ds->proximity = ERASER_PROX;
1018 DBG(6, common->debugLevel,
1018 DBG(6, common,
10191019 "USB eraser detected %x (value=%d)\n",
10201020 event->code, event->value);
10211021 }
10221022 else if ((event->code == BTN_TOOL_MOUSE) ||
10231023 (event->code == BTN_TOOL_LENS))
10241024 {
1025 DBG(6, common->debugLevel,
1025 DBG(6, common,
10261026 "USB mouse detected %x (value=%d)\n",
10271027 event->code, event->value);
10281028 ds->device_type = CURSOR_ID;
10331033 }
10341034 else if (event->code == BTN_TOOL_FINGER)
10351035 {
1036 DBG(6, common->debugLevel,
1036 DBG(6, common,
10371037 "USB Pad detected %x (value=%d)\n",
10381038 event->code, event->value);
10391039 ds->device_type = PAD_ID;
10441044 {
10451045 WacomChannelPtr pChannel = common->wcmChannel + channel;
10461046 WacomDeviceState dslast = pChannel->valid.state;
1047 DBG(6, common->debugLevel,
1047 DBG(6, common,
10481048 "USB Touch detected %x (value=%d)\n",
10491049 event->code, event->value);
10501050 ds->device_type = TOUCH_ID;
10661066 {
10671067 WacomChannelPtr pChannel = common->wcmChannel + channel;
10681068 WacomDeviceState dslast = pChannel->valid.state;
1069 DBG(6, common->debugLevel,
1069 DBG(6, common,
10701070 "USB Touch second finger detected %x (value=%d)\n",
10711071 event->code, event->value);
10721072 ds->device_type = TOUCH_ID;
11151115 if (((common->tablet_id == 0xC0) || (common->tablet_id == 0xC2)) &&
11161116 (ds->device_type == ERASER_ID))
11171117 {
1118 DBG(10, common->debugLevel,
1118 DBG(10, common,
11191119 "DTF 720 doesn't support eraser ");
11201120 return;
11211121 }
  
5050 /* Pad is always in relative mode when it's a core device.
5151 * Always in absolute mode when it is not a core device.
5252 */
53 DBG(10, priv->debugLevel, "%p"
53 DBG(10, priv, "%p"
5454 " is always in %s mode when it %s core device\n",
5555 (void *)local->dev,
5656 !is_core ? "absolute" : "relative",
7171 WacomDevicePtr priv = (WacomDevicePtr)local->private;
7272 int is_absolute = priv->flags & ABSOLUTE_FLAG;
7373
74 DBG(3, priv->debugLevel, "%s to mode=%d\n",
74 DBG(3, priv, "%s to mode=%d\n",
7575 local->name, mode);
7676
7777 /* Pad is always in relative mode when it's a core device.
9696 }
9797 else if ( (mode != Absolute) && (mode != Relative))
9898 {
99 DBG(10, priv->debugLevel,
99 DBG(10, priv,
100100 "%s invalid mode=%d\n", local->name, mode);
101101 return BadMatch;
102102 }
114114#ifdef DEBUG
115115 WacomDevicePtr priv = (WacomDevicePtr)local->private;
116116
117 DBG(3, priv->debugLevel, "dev=%p mode=%d\n",
117 DBG(3, priv, "dev=%p mode=%d\n",
118118 (void *)dev, mode);
119119#endif
120120 /* Share this call with sendAButton in wcmCommon.c */
211211 WacomCommonPtr common = priv->common;
212212 int values[WCM_MAX_MOUSE_BUTTONS];
213213
214 DBG(10, priv->debugLevel, "%s\n", local->name);
214 DBG(10, priv, "%s\n", local->name);
215215
216216 values[0] = priv->topX;
217217 values[1] = priv->topY;
299299 WacomDevicePtr priv = (WacomDevicePtr) local->private;
300300 WacomCommonPtr common = priv->common;
301301
302 DBG(10, priv->debugLevel, "%s\n", local->name);
302 DBG(10, priv, "%s\n", local->name);
303303
304304 if (property == prop_tablet_area)
305305 {
497497 {
498498 screen = -1;
499499 priv->currentScreen = 0;
500 DBG(10, priv->debugLevel, "TwinView sets to "
500 DBG(10, priv, "TwinView sets to "
501501 "TV_NONE: can't change screen_no. \n");
502502 }
503503 xf86WcmChangeScreen(local, screen);
  
148148 double screenRatio, tabletRatio;
149149 int bottomx = common->wcmMaxX, bottomy = common->wcmMaxY;
150150
151 DBG(10, priv->debugLevel, "\n");
151 DBG(10, priv, "\n");
152152
153153 if (IsTouch(priv))
154154 {
208208 tabletRatio = ((double)(bottomx - priv->topX) /
209209 (double)(bottomy - priv->topY));
210210
211 DBG(2, priv->debugLevel, "screenRatio = %.3g, "
211 DBG(2, priv, "screenRatio = %.3g, "
212212 "tabletRatio = %.3g\n", screenRatio, tabletRatio);
213213
214214 if (screenRatio > tabletRatio)
296296 priv->topPadding = (int)((double)(priv->screenTopY[i] * priv->topPadding)
297297 / ((double)(priv->screenBottomY[i] - priv->screenTopY[i])) + 0.5);
298298 }
299 DBG(10, priv->debugLevel, "\"%s\" "
299 DBG(10, priv, "\"%s\" "
300300 "x=%d y=%d \n", local->name, priv->leftPadding, priv->topPadding);
301301 return;
302302}
336336 priv->sizeY += (int)((double)((priv->maxHeight - priv->screenBottomY[i])
337337 * tabletSize) / ((double)(priv->screenBottomY[i] - priv->screenTopY[i])) + 0.5);
338338 }
339 DBG(10, priv->debugLevel, "\"%s\" "
339 DBG(10, priv, "\"%s\" "
340340 "x=%d y=%d \n", local->name, priv->sizeX, priv->sizeY);
341341 return;
342342}
656656 * This is only a workaround.
657657 */
658658
659 DBG(10, priv->debugLevel,
659 DBG(10, priv,
660660 "(%s) %d buttons, %d keys, %d axes\n",
661661 IsStylus(priv) ? "stylus" :
662662 IsCursor(priv) ? "cursor" :
976976 int rc;
977977 struct serial_struct ser;
978978
979 DBG(1, priv->debugLevel, "opening %s\n", common->wcmDevice);
979 DBG(1, priv, "opening %s\n", common->wcmDevice);
980980
981981 local->fd = xf86OpenSerial(local->options);
982982 if (local->fd < 0)
10351035 WacomCommonPtr common = priv->common;
10361036 struct stat st;
10371037
1038 DBG(10, priv->debugLevel, "\n");
1038 DBG(10, priv, "\n");
10391039
10401040 /* Device has been open and not autoprobed */
10411041 if (priv->wcmDevOpenCount)
10521052 if ((xf86WcmOpen (local) != Success) || (local->fd < 0) ||
10531053 !common->wcmDevice)
10541054 {
1055 DBG(1, priv->debugLevel, "Failed to open "
1055 DBG(1, priv, "Failed to open "
10561056 "device (fd=%d)\n", local->fd);
10571057 if (local->fd >= 0)
10581058 {
1059 DBG(1, priv->debugLevel, "Closing device\n");
1059 DBG(1, priv, "Closing device\n");
10601060 xf86CloseSerial(local->fd);
10611061 }
10621062 local->fd = -1;
10661066 if (fstat(local->fd, &st) == -1)
10671067 {
10681068 /* can not access major/minor */
1069 DBG(1, priv->debugLevel, "%s: stat failed (%s). "
1069 DBG(1, priv, "%s: stat failed (%s). "
10701070 "cannot check status.\n", local->name, strerror(errno));
10711071
10721072 /* older systems don't support the required ioctl.
10981098 WacomDevicePtr priv = (WacomDevicePtr)local->private;
10991099#endif
11001100 int n = xf86WaitForInput(local->fd, 0);
1101 DBG(10, priv->debugLevel, "%s with %d numbers of data\n", local->name, n);
1101 DBG(10, priv, "%s with %d numbers of data\n", local->name, n);
11021102
11031103 if (n >= 0) return n ? 1 : 0;
11041104 xf86Msg(X_ERROR, "%s: select error: %s\n", local->name, strerror(errno));
11301130
11311131 /* report how well we're doing */
11321132 if (loop >= MAX_READ_LOOPS)
1133 DBG(1, priv->debugLevel, "Can't keep up!!!\n");
1133 DBG(1, priv, "Can't keep up!!!\n");
11341134 else if (loop > 0)
1135 DBG(10, priv->debugLevel, "Read (%d)\n",loop);
1135 DBG(10, priv, "Read (%d)\n",loop);
11361136}
11371137
11381138void wcmReadPacket(LocalDevicePtr local)
11421142 int len, pos, cnt, remaining;
11431143 unsigned char * data;
11441144
1145 DBG(10, common->debugLevel, "device=%s"
1145 DBG(10, common, "device=%s"
11461146 " fd=%d \n", common->wcmDevice, local->fd);
11471147
11481148 remaining = sizeof(common->buffer) - common->bufpos;
11491149
1150 DBG(1, common->debugLevel, "pos=%d"
1150 DBG(1, common, "pos=%d"
11511151 " remaining=%d\n", common->bufpos, remaining);
11521152
11531153 /* fill buffer with as much data as we can handle */
11711171
11721172 /* account for new data */
11731173 common->bufpos += len;
1174 DBG(10, common->debugLevel, "buffer has %d bytes\n",
1174 DBG(10, common, "buffer has %d bytes\n",
11751175 common->bufpos);
11761176
11771177 pos = 0;
12031203 cnt = common->wcmModel->Parse(local, common->buffer + pos);
12041204 if (cnt <= 0)
12051205 {
1206 DBG(1, common->debugLevel, "Misbehaving parser returned %d\n",cnt);
1206 DBG(1, common, "Misbehaving parser returned %d\n",cnt);
12071207 break;
12081208 }
12091209 pos += cnt;
12141214 /* if half a packet remains, move it down */
12151215 if (pos < common->bufpos)
12161216 {
1217 DBG(7, common->debugLevel, "MOVE %d bytes\n", common->bufpos - pos);
1217 DBG(7, common, "MOVE %d bytes\n", common->bufpos - pos);
12181218 memmove(common->buffer,common->buffer+pos,
12191219 common->bufpos-pos);
12201220 common->bufpos -= pos;
12321232{
12331233#ifdef DEBUG
12341234 WacomDevicePtr priv = (WacomDevicePtr)local->private;
1235 DBG(3, priv->debugLevel, "\n");
1235 DBG(3, priv, "\n");
12361236#endif
12371237 return Success;
12381238}
12471247 LocalDevicePtr local = (LocalDevicePtr)device->public.devicePrivate;
12481248 WacomDevicePtr priv = (WacomDevicePtr)local->private;
12491249
1250 DBG(4, priv->debugLevel, "called\n");
1250 DBG(4, priv, "called\n");
12511251#endif
12521252 return;
12531253}
12611261 WacomDevicePtr priv = (WacomDevicePtr)local->private;
12621262 WacomCommonPtr common = priv->common;
12631263
1264 DBG(4, priv->debugLevel, "Wacom number of open devices = %d\n", common->fd_refs);
1264 DBG(4, priv, "Wacom number of open devices = %d\n", common->fd_refs);
12651265
12661266 if (local->fd >= 0)
12671267 {
12681268 local->fd = -1;
12691269 if (!--common->fd_refs)
12701270 {
1271 DBG(1, common->debugLevel, "Closing device; uninitializing.\n");
1271 DBG(1, common, "Closing device; uninitializing.\n");
12721272 xf86CloseSerial (common->fd);
12731273 }
12741274 }
12841284 LocalDevicePtr local = (LocalDevicePtr)pWcm->public.devicePrivate;
12851285 WacomDevicePtr priv = (WacomDevicePtr)local->private;
12861286
1287 DBG(2, priv->debugLevel, "BEGIN dev=%p priv=%p "
1287 DBG(2, priv, "BEGIN dev=%p priv=%p "
12881288 "type=%s(%s) flags=%d fd=%d what=%s\n",
12891289 (void *)pWcm, (void *)priv,
12901290 IsStylus(priv) ? "stylus" :
13061306 priv->wcmInitKeyClassCount = 0;
13071307 if (!xf86WcmDevOpen(pWcm))
13081308 {
1309 DBG(1, priv->debugLevel, "INIT FAILED\n");
1309 DBG(1, priv, "INIT FAILED\n");
13101310 return !Success;
13111311 }
13121312 priv->wcmInitKeyClassCount++;
13161316 case DEVICE_ON:
13171317 if (!xf86WcmDevOpen(pWcm))
13181318 {
1319 DBG(1, priv->debugLevel, "ON FAILED\n");
1319 DBG(1, priv, "ON FAILED\n");
13201320 return !Success;
13211321 }
13221322 priv->wcmDevOpenCount++;
13411341 break;
13421342 } /* end switch */
13431343
1344 DBG(2, priv->debugLevel, "END Success \n");
1344 DBG(2, priv, "END Success \n");
13451345 return Success;
13461346}
13471347
13561356{
13571357 WacomDevicePtr priv = (WacomDevicePtr) local->private;
13581358
1359 DBG(6, priv->debugLevel, "v0=%d v1=%d on screen %d \n",
1359 DBG(6, priv, "v0=%d v1=%d on screen %d \n",
13601360 v0, v1, priv->currentScreen);
13611361
13621362 if (first != 0 || num == 1)
13921392 if (*y < 0) *y = 0;
13931393
13941394 }
1395 DBG(6, priv->debugLevel, "v0=%d v1=%d to x=%d y=%d\n", v0, v1, *x, *y);
1395 DBG(6, priv, "v0=%d v1=%d to x=%d y=%d\n", v0, v1, *x, *y);
13961396 return TRUE;
13971397}
13981398
14091409 WacomDevicePtr priv = (WacomDevicePtr) local->private;
14101410 int i = 0;
14111411
1412 DBG(6, priv->debugLevel, "x=%d y=%d \n", x, y);
1412 DBG(6, priv, "x=%d y=%d \n", x, y);
14131413 priv->currentSX = x;
14141414 priv->currentSY = y;
14151415
14301430 priv->devReverseCount = 0;
14311431 }
14321432
1433 DBG(6, priv->debugLevel, "Wacom converted x=%d y=%d"
1433 DBG(6, priv, "Wacom converted x=%d y=%d"
14341434 " to v0=%d v1=%d v2=%d v3=%d v4=%d v5=%d\n", x, y,
14351435 valuators[0], valuators[1], valuators[2],
14361436 valuators[3], valuators[4], valuators[5]);
  
7474#endif
7575
7676#if DEBUG
77#define DBG(lvl, dLevel, ...) \
77#define DBG(lvl, priv, ...) \
7878 do { \
79 if ((lvl) <= dLevel) { \
79 if ((lvl) <= priv->debugLevel) { \
8080 xf86Msg(X_INFO, "%s: ", __func__); \
8181 xf86Msg(X_NONE, __VA_ARGS__); \
8282 } \
8383 } while (0)
8484#else
85#define DBG(lvl, dLevel, ...)
85#define DBG(lvl, priv, ...)
8686#endif
8787
8888/*****************************************************************************