diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-12-23 10:25:05 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-12-24 09:01:01 +1000 |
commit | bdc40d1a769229082cf91f8fd344f230996a6440 (patch) | |
tree | b8009a021c8527339c034cc10c1ba80ceaf415ea | |
parent | ea0591783f7c32dc9c650bc1b1f12a7c62379991 (diff) | |
download | xf86-input-wacom-bdc40d1a769229082cf91f8fd344f230996a6440.tar.gz |
common and priv both have debugLevel, just pass them in as-is.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | src/wcmCommon.c | 66 | ||||
-rw-r--r-- | src/wcmConfig.c | 5 | ||||
-rw-r--r-- | src/wcmFilter.c | 3 | ||||
-rw-r--r-- | src/wcmISDV4.c | 16 | ||||
-rw-r--r-- | src/wcmTouchFilter.c | 6 | ||||
-rw-r--r-- | src/wcmUSB.c | 34 | ||||
-rw-r--r-- | src/wcmXCommand.c | 14 | ||||
-rw-r--r-- | src/xf86Wacom.c | 60 | ||||
-rw-r--r-- | src/xf86Wacom.h | 6 |
9 files changed, 104 insertions, 106 deletions
diff --git a/src/wcmCommon.c b/src/wcmCommon.c index f0a6866..02f5067 100644 --- a/src/wcmCommon.c +++ b/src/wcmCommon.c @@ -57,7 +57,7 @@ void xf86WcmMappingFactor(LocalDevicePtr local) { WacomDevicePtr priv = (WacomDevicePtr) local->private; - DBG(10, priv->debugLevel, "\n"); /* just prints function name */ + DBG(10, priv, "\n"); /* just prints function name */ xf86WcmVirtualTabletSize(local); @@ -81,7 +81,7 @@ void xf86WcmMappingFactor(LocalDevicePtr local) if (priv->currentScreen == -1) /* tool on the tablet */ priv->currentScreen = 0; - DBG(10, priv->debugLevel, + DBG(10, priv, "Active tablet area x=%d y=%d (virtual tablet area x=%d y=%d) map" " to maxWidth =%d maxHeight =%d\n", priv->bottomX, priv->bottomY, priv->sizeX, priv->sizeY, @@ -89,7 +89,7 @@ void xf86WcmMappingFactor(LocalDevicePtr local) priv->factorX = (double)priv->maxWidth / (double)priv->sizeX; priv->factorY = (double)priv->maxHeight / (double)priv->sizeY; - DBG(2, priv->debugLevel, "X factor = %.3g, Y factor = %.3g\n", + DBG(2, priv, "X factor = %.3g, Y factor = %.3g\n", priv->factorX, priv->factorY); } @@ -106,7 +106,7 @@ static void xf86WcmSetScreen(LocalDevicePtr local, int v0, int v1) WacomDevicePtr priv = (WacomDevicePtr) local->private; int screenToSet = -1, i, j, x, y, tabletSize = 0; - DBG(6, priv->debugLevel, "v0=%d v1=%d " + DBG(6, priv, "v0=%d v1=%d " "currentScreen=%d\n", v0, v1, priv->currentScreen); if (priv->screen_no != -1 && priv->screen_no >= priv->numScreen) @@ -152,7 +152,7 @@ static void xf86WcmSetScreen(LocalDevicePtr local, int v0, int v1) if (v0 > priv->topY && v0 <= priv->topY + priv->tvoffsetY) priv->currentScreen = 1; } - DBG(10, priv->debugLevel, "TwinView setup screenToSet=%d\n", + DBG(10, priv, "TwinView setup screenToSet=%d\n", priv->currentScreen); } @@ -194,7 +194,7 @@ static void xf86WcmSetScreen(LocalDevicePtr local, int v0, int v1) if (screenToSet == -1) { - DBG(3, priv->debugLevel, "Error: " + DBG(3, priv, "Error: " "Can not find valid screen (currentScreen=%d)\n", priv->currentScreen); return; @@ -210,7 +210,7 @@ static void xf86WcmSetScreen(LocalDevicePtr local, int v0, int v1) y = screenInfo.screens[screenToSet]->height - 1; xf86XInputSetScreen(local, screenToSet, x, y); - DBG(10, priv->debugLevel, "current=%d ToSet=%d\n", + DBG(10, priv, "current=%d ToSet=%d\n", priv->currentScreen, screenToSet); priv->currentScreen = screenToSet; } @@ -227,7 +227,7 @@ static void xf86WcmSendButtons(LocalDevicePtr local, int buttons, int rx, int ry int button, mask; WacomDevicePtr priv = (WacomDevicePtr) local->private; WacomCommonPtr common = priv->common; - DBG(6, priv->debugLevel, "buttons=%d for %s\n", buttons, local->name); + DBG(6, priv, "buttons=%d for %s\n", buttons, local->name); /* Tablet PC buttons only apply to penabled devices */ if (common->wcmTPCButton && (priv->flags & STYLUS_ID)) @@ -460,7 +460,7 @@ static void sendAButton(LocalDevicePtr local, int button, int mask, if (!priv->button[button]) /* ignore this button event */ return; - DBG(4, priv->debugLevel, "TPCButton(%s) button=%d state=%d " + DBG(4, priv, "TPCButton(%s) button=%d state=%d " "code=%08x, for %s coreEvent=%s \n", common->wcmTPCButton ? "on" : "off", button, mask, priv->button[button], @@ -577,7 +577,7 @@ static void sendWheelStripEvents(LocalDevicePtr local, const WacomDeviceState* d unsigned *keyP = 0; int is_absolute = priv->flags & ABSOLUTE_FLAG; - DBG(10, priv->debugLevel, "strip events for %s \n", local->name); + DBG(10, priv, "strip events for %s \n", local->name); /* emulate events for relative wheel */ if ( ds->relwheel ) @@ -667,7 +667,7 @@ static void sendWheelStripEvents(LocalDevicePtr local, const WacomDeviceState* d if (!fakeButton) return; - DBG(10, priv->debugLevel, "send fakeButton %x with value = %d \n", + DBG(10, priv, "send fakeButton %x with value = %d \n", fakeButton, value); switch (fakeButton & AC_TYPE) @@ -745,7 +745,7 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds) if (priv->serial && serial != priv->serial) { - DBG(10, priv->debugLevel, "[%s] serial number" + DBG(10, priv, "[%s] serial number" " is %u but your system configured %u", local->name, serial, (int)priv->serial); return; @@ -765,7 +765,7 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds) ty = ds->stripy; } - DBG(7, priv->debugLevel, "[%s] o_prox=%s x=%d y=%d z=%d " + DBG(7, priv, "[%s] o_prox=%s x=%d y=%d z=%d " "b=%s b=%d tx=%d ty=%d wl=%d rot=%d th=%d\n", (type == STYLUS_ID) ? "stylus" : (type == CURSOR_ID) ? "cursor" : @@ -820,7 +820,7 @@ void xf86WcmSendEvents(LocalDevicePtr local, const WacomDeviceState* ds) } v5 = wheel; - DBG(6, priv->debugLevel, "[%s] %s prox=%d\tx=%d" + DBG(6, priv, "[%s] %s prox=%d\tx=%d" "\ty=%d\tz=%d\tv3=%d\tv4=%d\tv5=%d\tid=%d" "\tserial=%u\tbutton=%s\tbuttons=%d\n", local->name, @@ -1066,7 +1066,7 @@ static int xf86WcmSuppress(WacomCommonPtr common, const WacomDeviceState* dsOrig dsNew->y = dsOrig->y; } - DBG(10, common->debugLevel, "level = %d" + DBG(10, common, "level = %d" " return value = %d\n", suppress, returnV); return returnV; } @@ -1101,7 +1101,7 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel, pChannel = common->wcmChannel + channel; pLast = &pChannel->valid.state; - DBG(10, common->debugLevel, "channel = %d\n", channel); + DBG(10, common, "channel = %d\n", channel); /* sanity check the channel */ if (channel >= MAX_CHANNELS) @@ -1113,7 +1113,7 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel, /* timestamp the state for velocity and acceleration analysis */ ds.sample = (int)GetTimeInMillis(); - DBG(10, common->debugLevel, + DBG(10, common, "c=%d i=%d t=%d s=%u x=%d y=%d b=%d " "p=%d rz=%d tx=%d ty=%d aw=%d rw=%d " "t=%d df=%d px=%d st=%d cs=%d \n", @@ -1131,7 +1131,7 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel, if ( (pChannel->nSamples < 2) && (common->wcmDevCls == &gWacomUSBDevice) && ds.device_type != PAD_ID && (ds.device_type != TOUCH_ID) ) { - DBG(11, common->debugLevel, + DBG(11, common, "discarded %dth USB data.\n", pChannel->nSamples); ++pChannel->nSamples; @@ -1147,7 +1147,7 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel, fs = &pChannel->rawFilter; if (!fs->npoints && ds.proximity) { - DBG(11, common->debugLevel, "initialize Channel data.\n"); + DBG(11, common, "initialize Channel data.\n"); /* store channel device state for later use */ for (i=common->wcmRawSample - 1; i>=0; i--) { @@ -1180,7 +1180,7 @@ void wcmEvent(WacomCommonPtr common, unsigned int channel, { if (common->wcmModel->FilterRaw(common,pChannel,&ds)) { - DBG(10, common->debugLevel, + DBG(10, common, "Raw filtering discarded data.\n"); resetSampleCounter(pChannel); return; /* discard */ @@ -1335,7 +1335,7 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, } } - DBG(10, common->debugLevel, "device type = %d\n", ds->device_type); + DBG(10, common, "device type = %d\n", ds->device_type); /* Find the device the current events are meant for */ /* 1: Find the tool (the one with correct serial or in second * hand, the one with serial set to 0 if no match with the @@ -1398,7 +1398,7 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, LocalDevicePtr oDev = outprox->device; WacomDeviceState out = { 0 }; out.device_type = DEVICE_ID(((WacomDevicePtr)(oDev->private))->flags); - DBG(2, common->debugLevel, "Soft prox-out for %s\n", + DBG(2, common, "Soft prox-out for %s\n", outprox->device->name); xf86WcmSendEvents(oDev, &out); } @@ -1410,7 +1410,7 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, if(tool->current) { pDev = tool->current->device; - DBG(11, common->debugLevel, "tool id=%d for %s\n", + DBG(11, common, "tool id=%d for %s\n", ds->device_type, pDev->name); } } @@ -1468,7 +1468,7 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, /* Send soft prox-out for touch first */ WacomDeviceState out = { 0 }; out.device_type = DEVICE_ID(temppriv->flags); - DBG(2, common->debugLevel, + DBG(2, common, "Send soft prox-out for %s first\n", localDevices->name); xf86WcmSendEvents(localDevices, &out); @@ -1541,7 +1541,7 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, } else /* no other events to send */ { - DBG(10, common->debugLevel, "Ignore non-movement relative data \n"); + DBG(10, common, "Ignore non-movement relative data \n"); return; } } @@ -1570,7 +1570,7 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, if (common->wcmMaxCursorDist < filtered.distance) common->wcmMaxCursorDist = filtered.distance; } - DBG(10, common->debugLevel, "Distance over" + DBG(10, common, "Distance over" " the tablet: %d, ProxoutDist: %d current" " min/max %d hard prox: %d\n", filtered.distance, @@ -1604,7 +1604,7 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, /* otherwise, if no device matched... */ else { - DBG(11, common->debugLevel, "no device matches with" + DBG(11, common, "no device matches with" " id=%d, serial=%u\n", ds->device_type, ds->serial_num); } @@ -1802,7 +1802,7 @@ static void xf86WcmInitialTVScreens(LocalDevicePtr local) priv->screenBottomY[1] = priv->tvResolution[1]; } - DBG(10, priv->debugLevel, "\"%s\":" + DBG(10, priv, "\"%s\":" "topX0=%d topY0=%d bottomX0=%d bottomY0=%d " "topX1=%d topY1=%d bottomX1=%d bottomY1=%d \n", local->name, priv->screenTopX[0], priv->screenTopY[0], @@ -1820,7 +1820,7 @@ void xf86WcmInitialScreens(LocalDevicePtr local) WacomDevicePtr priv = (WacomDevicePtr)local->private; int i; - DBG(2, priv->debugLevel, "\"%s\":" + DBG(2, priv, "\"%s\":" "number of screen=%d \n", local->name, screenInfo.numScreens); priv->tvoffsetX = 0; priv->tvoffsetY = 0; @@ -1845,7 +1845,7 @@ void xf86WcmInitialScreens(LocalDevicePtr local) priv->screenBottomX[i] = dixScreenOrigins[i].x; priv->screenBottomY[i] = dixScreenOrigins[i].y; - DBG(10, priv->debugLevel, "from dix for \"%s\" " + DBG(10, priv, "from dix for \"%s\" " "ScreenOrigins[%d].x=%d ScreenOrigins[%d].y=%d \n", local->name, i, priv->screenTopX[i], i, priv->screenTopY[i]); @@ -1854,7 +1854,7 @@ void xf86WcmInitialScreens(LocalDevicePtr local) priv->screenBottomX[i] += screenInfo.screens[i]->width; priv->screenBottomY[i] += screenInfo.screens[i]->height; - DBG(10, priv->debugLevel, "\"%s\":" + DBG(10, priv, "\"%s\":" "topX[%d]=%d topY[%d]=%d bottomX[%d]=%d bottomY[%d]=%d \n", local->name, i, priv->screenTopX[i], i, priv->screenTopY[i], i, priv->screenBottomX[i], i, priv->screenBottomY[i]); @@ -1871,7 +1871,7 @@ static void rotateOneTool(WacomDevicePtr priv) WacomToolAreaPtr area = priv->toolarea; int tmpTopX, tmpTopY, tmpBottomX, tmpBottomY, oldMaxX, oldMaxY; - DBG(10, priv->debugLevel, "\"%s\"", priv->local->name); + DBG(10, priv, "\"%s\"", priv->local->name); if (!IsTouch(priv)) { @@ -1948,7 +1948,7 @@ void xf86WcmRotateTablet(LocalDevicePtr local, int value) int oldRotation; int tmpTopX, tmpTopY, tmpBottomX, tmpBottomY, oldMaxX, oldMaxY; - DBG(10, priv->debugLevel, "\"%s\":\n", local->name); + DBG(10, priv, "\"%s\":\n", local->name); if (common->wcmRotate == value) /* initialization */ { diff --git a/src/wcmConfig.c b/src/wcmConfig.c index 137a2d1..2cb9de1 100644 --- a/src/wcmConfig.c +++ b/src/wcmConfig.c @@ -229,7 +229,7 @@ static void xf86WcmUninit(InputDriverPtr drv, LocalDevicePtr local, int flags) WacomDevicePtr dev; WacomDevicePtr *prev; - DBG(1, priv->debugLevel, "\n"); + DBG(1, priv, "\n"); if (priv->isParent) { @@ -289,8 +289,7 @@ static Bool xf86WcmMatchDevice(LocalDevicePtr pMatch, LocalDevicePtr pLocal) strstr(pMatch->drv->driverName, "wacom") && !strcmp(privMatch->common->wcmDevice, common->wcmDevice)) { - DBG(2, priv->debugLevel, - "port share between" + DBG(2, priv, "port share between" " %s and %s\n", pLocal->name, pMatch->name); type = xf86FindOptionValue(pMatch->options, "Type"); if ( type && (strstr(type, "eraser")) ) diff --git a/src/wcmFilter.c b/src/wcmFilter.c index 5b0ff7c..5b63f37 100644 --- a/src/wcmFilter.c +++ b/src/wcmFilter.c @@ -248,8 +248,7 @@ int wcmFilterCoord(WacomCommonPtr common, WacomChannelPtr pChannel, WacomDeviceState *pLast; int *x, *y, i; - DBG(10, common->debugLevel, - "common->wcmRawSample = %d \n", common->wcmRawSample); + DBG(10, common, "common->wcmRawSample = %d \n", common->wcmRawSample); x = pChannel->rawFilter.x; y = pChannel->rawFilter.y; diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c index 045e469..df4d8b3 100644 --- a/src/wcmISDV4.c +++ b/src/wcmISDV4.c @@ -123,7 +123,7 @@ static Bool isdv4Init(LocalDevicePtr local, char* id, float *version) WacomDevicePtr priv = (WacomDevicePtr)local->private; WacomCommonPtr common = priv->common; - DBG(1, priv->debugLevel, "initializing ISDV4 tablet\n"); + DBG(1, priv, "initializing ISDV4 tablet\n"); /* Initial baudrate is 38400 */ if (xf86SetSerialSpeed(local->fd, common->wcmISDV4Speed) < 0) @@ -150,7 +150,7 @@ static int isdv4Query(LocalDevicePtr local, const char* query, char* data) WacomDevicePtr priv = (WacomDevicePtr)local->private; WacomCommonPtr common = priv->common; - DBG(1, priv->debugLevel, "Querying ISDV4 tablet\n"); + DBG(1, priv, "Querying ISDV4 tablet\n"); /* Send stop command to the tablet */ err = xf86WriteSerial(local->fd, WC_ISDV4_STOP, strlen(WC_ISDV4_STOP)); @@ -256,7 +256,7 @@ static int isdv4GetRanges(LocalDevicePtr local) WacomCommonPtr common = priv->common; int ret = Success; - DBG(2, priv->debugLevel, "getting ISDV4 Ranges\n"); + DBG(2, priv, "getting ISDV4 Ranges\n"); /* Send query command to the tablet */ ret = isdv4Query(local, WC_ISDV4_QUERY, data); @@ -281,7 +281,7 @@ static int isdv4GetRanges(LocalDevicePtr local) if (!common->wcmMaxX || !common->wcmMaxY) common->tablet_id = 0xE2; - DBG(2, priv->debugLevel, "Pen speed=%d " + DBG(2, priv, "Pen speed=%d " "maxX=%d maxY=%d maxZ=%d resX=%d resY=%d \n", common->wcmISDV4Speed, common->wcmMaxX, common->wcmMaxY, common->wcmMaxZ, common->wcmResolX, common->wcmResolY); @@ -367,7 +367,7 @@ static int isdv4GetRanges(LocalDevicePtr local) common->wcmVersion = ( data[10] | (data[9] << 7) ); ret = Success; - DBG(2, priv->debugLevel, "touch speed=%d " + DBG(2, priv, "touch speed=%d " "maxTouchX=%d maxTouchY=%d TouchresX=%d TouchresY=%d \n", common->wcmISDV4Speed, common->wcmMaxTouchX, common->wcmMaxTouchY, common->wcmTouchResolX, @@ -401,7 +401,7 @@ static int isdv4Parse(LocalDevicePtr local, const unsigned char* data) WacomDeviceState* ds; int n, cur_type, channel = 0; - DBG(10, common->debugLevel, "\n"); + DBG(10, common, "\n"); /* determine the type of message (touch or stylus) */ if (data[0] & 0x10) /* a touch data */ @@ -484,7 +484,7 @@ static int isdv4Parse(LocalDevicePtr local, const unsigned char* data) } } - DBG(8, priv->debugLevel, "MultiTouch " + DBG(8, priv, "MultiTouch " "%s proximity \n", ds->proximity ? "in" : "out of"); } else @@ -536,7 +536,7 @@ static int isdv4Parse(LocalDevicePtr local, const unsigned char* data) ds->device_id = ERASER_DEVICE_ID; } - DBG(8, priv->debugLevel, "%s\n", + DBG(8, priv, "%s\n", ds->device_type == ERASER_ID ? "ERASER " : ds->device_type == STYLUS_ID ? "STYLUS" : "NONE"); } diff --git a/src/wcmTouchFilter.c b/src/wcmTouchFilter.c index 28b75fd..d56ae5e 100644 --- a/src/wcmTouchFilter.c +++ b/src/wcmTouchFilter.c @@ -129,7 +129,7 @@ void xf86WcmFingerTapToClick(WacomCommonPtr common) secondChannel->valid.states[1] }; int direction = 0; - DBG(10, priv->debugLevel, "\n"); + DBG(10, priv, "\n"); /* skip initial second finger event */ if (!dsLast[1].proximity) @@ -316,7 +316,7 @@ static void xf86WcmFingerScroll(WacomDevicePtr priv) int gesture = 0; WacomFilterState filterd; /* borrow this struct */ - DBG(10, priv->debugLevel, "\n"); + DBG(10, priv, "\n"); /* initialize the points so we can rotate them */ filterd.x[0] = ds[0].x; @@ -391,7 +391,7 @@ static void xf86WcmFingerZoom(WacomDevicePtr priv) int dist = touchDistance(common->wcmGestureState[0], common->wcmGestureState[1]); - DBG(10, priv->debugLevel, "\n"); + DBG(10, priv, "\n"); dist = touchDistance(ds[0], ds[1]) - dist; diff --git a/src/wcmUSB.c b/src/wcmUSB.c index 8504870..7d72473 100644 --- a/src/wcmUSB.c +++ b/src/wcmUSB.c @@ -372,7 +372,7 @@ static Bool usbDetect(LocalDevicePtr local) #ifdef DEBUG WacomDevicePtr priv = (WacomDevicePtr)local->private; - DBG(1, priv->debugLevel, "\n"); + DBG(1, priv, "\n"); #endif SYSCALL(err = ioctl(local->fd, EVIOCGVERSION, &version)); @@ -508,7 +508,7 @@ Bool usbWcmInit(LocalDevicePtr local, char* id, float *version) WacomDevicePtr priv = (WacomDevicePtr)local->private; WacomCommonPtr common = priv->common; - DBG(1, priv->debugLevel, "initializing USB tablet\n"); + DBG(1, priv, "initializing USB tablet\n"); *version = 0.0; /* fetch vendor, product, and model name */ @@ -722,7 +722,7 @@ static int usbDetectConfig(LocalDevicePtr local) WacomDevicePtr priv = (WacomDevicePtr)local->private; WacomCommonPtr common = priv->common; - DBG(10, common->debugLevel, "\n"); + DBG(10, common, "\n"); if (IsPad (priv)) priv->nbuttons = common->npadkeys; else @@ -813,7 +813,7 @@ static int usbChooseChannel(WacomCommonPtr common, int serial) wcmEvent(common, i, &common->wcmChannel[i].work); } } - DBG(1, common->debugLevel, "device with serial number: %u" + DBG(1, common, "device with serial number: %u" " at %d: Exceeded channel count; ignoring the events.\n", serial, (int)GetTimeInMillis()); } @@ -830,7 +830,7 @@ static void usbParseEvent(LocalDevicePtr local, WacomDevicePtr priv = (WacomDevicePtr)local->private; WacomCommonPtr common = priv->common; - DBG(10, common->debugLevel, "\n"); + DBG(10, common, "\n"); /* store events until we receive the MSC_SERIAL containing * the serial number; without it we cannot determine the * correct channel. */ @@ -890,7 +890,7 @@ static void usbParseEvent(LocalDevicePtr local, /* ignore events without information */ if (common->wcmEventCnt <= 2) { - DBG(3, common->debugLevel, "%s: dropping empty event" + DBG(3, common, "%s: dropping empty event" " for serial %d\n", local->name, common->wcmLastToolSerial); goto skipEvent; } @@ -923,7 +923,7 @@ static void usbParseChannel(LocalDevicePtr local, int channel) WacomDevicePtr priv = (WacomDevicePtr)local->private; WacomCommonPtr common = priv->common; - DBG(6, common->debugLevel, "%d events received\n", common->wcmEventCnt); + DBG(6, common, "%d events received\n", common->wcmEventCnt); #define MOD_BUTTONS(bit, value) do { \ shift = 1<<bit; \ ds->buttons = (((value) != 0) ? \ @@ -931,10 +931,10 @@ static void usbParseChannel(LocalDevicePtr local, int channel) } while (0) if (common->wcmEventCnt == 1 && !common->wcmEvents->type) { - DBG(6, common->debugLevel, "no real events received\n"); + DBG(6, common, "no real events received\n"); return; } - DBG(6, common->debugLevel, "%d events received\n", common->wcmEventCnt); + DBG(6, common, "%d events received\n", common->wcmEventCnt); /* all USB data operates from previous context except relative values*/ ds = &common->wcmChannel[channel].work; @@ -945,7 +945,7 @@ static void usbParseChannel(LocalDevicePtr local, int channel) for (i=0; i<common->wcmEventCnt; ++i) { event = common->wcmEvents + i; - DBG(11, common->debugLevel, + DBG(11, common, "event[%d]->type=%d code=%d value=%d\n", i, event->type, event->code, event->value); @@ -1002,7 +1002,7 @@ static void usbParseChannel(LocalDevicePtr local, int channel) if (common->wcmProtocolLevel == 4) ds->device_id = STYLUS_DEVICE_ID; ds->proximity = (event->value != 0); - DBG(6, common->debugLevel, + DBG(6, common, "USB stylus detected %x\n", event->code); } @@ -1015,14 +1015,14 @@ static void usbParseChannel(LocalDevicePtr local, int channel) ds->proximity = (event->value != 0); if (ds->proximity) ds->proximity = ERASER_PROX; - DBG(6, common->debugLevel, + DBG(6, common, "USB eraser detected %x (value=%d)\n", event->code, event->value); } else if ((event->code == BTN_TOOL_MOUSE) || (event->code == BTN_TOOL_LENS)) { - DBG(6, common->debugLevel, + DBG(6, common, "USB mouse detected %x (value=%d)\n", event->code, event->value); ds->device_type = CURSOR_ID; @@ -1033,7 +1033,7 @@ static void usbParseChannel(LocalDevicePtr local, int channel) } else if (event->code == BTN_TOOL_FINGER) { - DBG(6, common->debugLevel, + DBG(6, common, "USB Pad detected %x (value=%d)\n", event->code, event->value); ds->device_type = PAD_ID; @@ -1044,7 +1044,7 @@ static void usbParseChannel(LocalDevicePtr local, int channel) { WacomChannelPtr pChannel = common->wcmChannel + channel; WacomDeviceState dslast = pChannel->valid.state; - DBG(6, common->debugLevel, + DBG(6, common, "USB Touch detected %x (value=%d)\n", event->code, event->value); ds->device_type = TOUCH_ID; @@ -1066,7 +1066,7 @@ static void usbParseChannel(LocalDevicePtr local, int channel) { WacomChannelPtr pChannel = common->wcmChannel + channel; WacomDeviceState dslast = pChannel->valid.state; - DBG(6, common->debugLevel, + DBG(6, common, "USB Touch second finger detected %x (value=%d)\n", event->code, event->value); ds->device_type = TOUCH_ID; @@ -1115,7 +1115,7 @@ static void usbParseChannel(LocalDevicePtr local, int channel) if (((common->tablet_id == 0xC0) || (common->tablet_id == 0xC2)) && (ds->device_type == ERASER_ID)) { - DBG(10, common->debugLevel, + DBG(10, common, "DTF 720 doesn't support eraser "); return; } diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c index 4ebbf10..60cbfa0 100644 --- a/src/wcmXCommand.c +++ b/src/wcmXCommand.c @@ -50,7 +50,7 @@ int xf86WcmSetPadCoreMode(LocalDevicePtr local) /* Pad is always in relative mode when it's a core device. * Always in absolute mode when it is not a core device. */ - DBG(10, priv->debugLevel, "%p" + DBG(10, priv, "%p" " is always in %s mode when it %s core device\n", (void *)local->dev, !is_core ? "absolute" : "relative", @@ -71,7 +71,7 @@ int xf86WcmDevSwitchModeCall(LocalDevicePtr local, int mode) WacomDevicePtr priv = (WacomDevicePtr)local->private; int is_absolute = priv->flags & ABSOLUTE_FLAG; - DBG(3, priv->debugLevel, "%s to mode=%d\n", + DBG(3, priv, "%s to mode=%d\n", local->name, mode); /* Pad is always in relative mode when it's a core device. @@ -96,7 +96,7 @@ int xf86WcmDevSwitchModeCall(LocalDevicePtr local, int mode) } else if ( (mode != Absolute) && (mode != Relative)) { - DBG(10, priv->debugLevel, + DBG(10, priv, "%s invalid mode=%d\n", local->name, mode); return BadMatch; } @@ -114,7 +114,7 @@ int xf86WcmDevSwitchMode(ClientPtr client, DeviceIntPtr dev, int mode) #ifdef DEBUG WacomDevicePtr priv = (WacomDevicePtr)local->private; - DBG(3, priv->debugLevel, "dev=%p mode=%d\n", + DBG(3, priv, "dev=%p mode=%d\n", (void *)dev, mode); #endif /* Share this call with sendAButton in wcmCommon.c */ @@ -211,7 +211,7 @@ void InitWcmDeviceProperties(LocalDevicePtr local) WacomCommonPtr common = priv->common; int values[WCM_MAX_MOUSE_BUTTONS]; - DBG(10, priv->debugLevel, "%s\n", local->name); + DBG(10, priv, "%s\n", local->name); values[0] = priv->topX; values[1] = priv->topY; @@ -299,7 +299,7 @@ int xf86WcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, WacomDevicePtr priv = (WacomDevicePtr) local->private; WacomCommonPtr common = priv->common; - DBG(10, priv->debugLevel, "%s\n", local->name); + DBG(10, priv, "%s\n", local->name); if (property == prop_tablet_area) { @@ -497,7 +497,7 @@ int xf86WcmSetProperty(DeviceIntPtr dev, Atom property, XIPropertyValuePtr prop, { screen = -1; priv->currentScreen = 0; - DBG(10, priv->debugLevel, "TwinView sets to " + DBG(10, priv, "TwinView sets to " "TV_NONE: can't change screen_no. \n"); } xf86WcmChangeScreen(local, screen); diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c index 4d61bb9..5938a55 100644 --- a/src/xf86Wacom.c +++ b/src/xf86Wacom.c @@ -148,7 +148,7 @@ static int xf86WcmInitArea(LocalDevicePtr local) double screenRatio, tabletRatio; int bottomx = common->wcmMaxX, bottomy = common->wcmMaxY; - DBG(10, priv->debugLevel, "\n"); + DBG(10, priv, "\n"); if (IsTouch(priv)) { @@ -208,7 +208,7 @@ static int xf86WcmInitArea(LocalDevicePtr local) tabletRatio = ((double)(bottomx - priv->topX) / (double)(bottomy - priv->topY)); - DBG(2, priv->debugLevel, "screenRatio = %.3g, " + DBG(2, priv, "screenRatio = %.3g, " "tabletRatio = %.3g\n", screenRatio, tabletRatio); if (screenRatio > tabletRatio) @@ -296,7 +296,7 @@ void xf86WcmVirtualTabletPadding(LocalDevicePtr local) priv->topPadding = (int)((double)(priv->screenTopY[i] * priv->topPadding) / ((double)(priv->screenBottomY[i] - priv->screenTopY[i])) + 0.5); } - DBG(10, priv->debugLevel, "\"%s\" " + DBG(10, priv, "\"%s\" " "x=%d y=%d \n", local->name, priv->leftPadding, priv->topPadding); return; } @@ -336,7 +336,7 @@ void xf86WcmVirtualTabletSize(LocalDevicePtr local) priv->sizeY += (int)((double)((priv->maxHeight - priv->screenBottomY[i]) * tabletSize) / ((double)(priv->screenBottomY[i] - priv->screenTopY[i])) + 0.5); } - DBG(10, priv->debugLevel, "\"%s\" " + DBG(10, priv, "\"%s\" " "x=%d y=%d \n", local->name, priv->sizeX, priv->sizeY); return; } @@ -656,7 +656,7 @@ static int xf86WcmRegisterX11Devices (LocalDevicePtr local) * This is only a workaround. */ - DBG(10, priv->debugLevel, + DBG(10, priv, "(%s) %d buttons, %d keys, %d axes\n", IsStylus(priv) ? "stylus" : IsCursor(priv) ? "cursor" : @@ -976,7 +976,7 @@ static Bool xf86WcmOpen(LocalDevicePtr local) int rc; struct serial_struct ser; - DBG(1, priv->debugLevel, "opening %s\n", common->wcmDevice); + DBG(1, priv, "opening %s\n", common->wcmDevice); local->fd = xf86OpenSerial(local->options); if (local->fd < 0) @@ -1035,7 +1035,7 @@ static int xf86WcmDevOpen(DeviceIntPtr pWcm) WacomCommonPtr common = priv->common; struct stat st; - DBG(10, priv->debugLevel, "\n"); + DBG(10, priv, "\n"); /* Device has been open and not autoprobed */ if (priv->wcmDevOpenCount) @@ -1052,11 +1052,11 @@ static int xf86WcmDevOpen(DeviceIntPtr pWcm) if ((xf86WcmOpen (local) != Success) || (local->fd < 0) || !common->wcmDevice) { - DBG(1, priv->debugLevel, "Failed to open " + DBG(1, priv, "Failed to open " "device (fd=%d)\n", local->fd); if (local->fd >= 0) { - DBG(1, priv->debugLevel, "Closing device\n"); + DBG(1, priv, "Closing device\n"); xf86CloseSerial(local->fd); } local->fd = -1; @@ -1066,7 +1066,7 @@ static int xf86WcmDevOpen(DeviceIntPtr pWcm) if (fstat(local->fd, &st) == -1) { /* can not access major/minor */ - DBG(1, priv->debugLevel, "%s: stat failed (%s). " + DBG(1, priv, "%s: stat failed (%s). " "cannot check status.\n", local->name, strerror(errno)); /* older systems don't support the required ioctl. @@ -1098,7 +1098,7 @@ static int xf86WcmReady(LocalDevicePtr local) WacomDevicePtr priv = (WacomDevicePtr)local->private; #endif int n = xf86WaitForInput(local->fd, 0); - DBG(10, priv->debugLevel, "%s with %d numbers of data\n", local->name, n); + DBG(10, priv, "%s with %d numbers of data\n", local->name, n); if (n >= 0) return n ? 1 : 0; xf86Msg(X_ERROR, "%s: select error: %s\n", local->name, strerror(errno)); @@ -1130,9 +1130,9 @@ static void xf86WcmDevReadInput(LocalDevicePtr local) /* report how well we're doing */ if (loop >= MAX_READ_LOOPS) - DBG(1, priv->debugLevel, "Can't keep up!!!\n"); + DBG(1, priv, "Can't keep up!!!\n"); else if (loop > 0) - DBG(10, priv->debugLevel, "Read (%d)\n",loop); + DBG(10, priv, "Read (%d)\n",loop); } void wcmReadPacket(LocalDevicePtr local) @@ -1142,12 +1142,12 @@ void wcmReadPacket(LocalDevicePtr local) int len, pos, cnt, remaining; unsigned char * data; - DBG(10, common->debugLevel, "device=%s" + DBG(10, common, "device=%s" " fd=%d \n", common->wcmDevice, local->fd); remaining = sizeof(common->buffer) - common->bufpos; - DBG(1, common->debugLevel, "pos=%d" + DBG(1, common, "pos=%d" " remaining=%d\n", common->bufpos, remaining); /* fill buffer with as much data as we can handle */ @@ -1171,7 +1171,7 @@ void wcmReadPacket(LocalDevicePtr local) /* account for new data */ common->bufpos += len; - DBG(10, common->debugLevel, "buffer has %d bytes\n", + DBG(10, common, "buffer has %d bytes\n", common->bufpos); pos = 0; @@ -1203,7 +1203,7 @@ void wcmReadPacket(LocalDevicePtr local) cnt = common->wcmModel->Parse(local, common->buffer + pos); if (cnt <= 0) { - DBG(1, common->debugLevel, "Misbehaving parser returned %d\n",cnt); + DBG(1, common, "Misbehaving parser returned %d\n",cnt); break; } pos += cnt; @@ -1214,7 +1214,7 @@ void wcmReadPacket(LocalDevicePtr local) /* if half a packet remains, move it down */ if (pos < common->bufpos) { - DBG(7, common->debugLevel, "MOVE %d bytes\n", common->bufpos - pos); + DBG(7, common, "MOVE %d bytes\n", common->bufpos - pos); memmove(common->buffer,common->buffer+pos, common->bufpos-pos); common->bufpos -= pos; @@ -1232,7 +1232,7 @@ int xf86WcmDevChangeControl(LocalDevicePtr local, xDeviceCtl * control) { #ifdef DEBUG WacomDevicePtr priv = (WacomDevicePtr)local->private; - DBG(3, priv->debugLevel, "\n"); + DBG(3, priv, "\n"); #endif return Success; } @@ -1247,7 +1247,7 @@ static void xf86WcmDevControlProc(DeviceIntPtr device, PtrCtrl* ctrl) LocalDevicePtr local = (LocalDevicePtr)device->public.devicePrivate; WacomDevicePtr priv = (WacomDevicePtr)local->private; - DBG(4, priv->debugLevel, "called\n"); + DBG(4, priv, "called\n"); #endif return; } @@ -1261,14 +1261,14 @@ static void xf86WcmDevClose(LocalDevicePtr local) WacomDevicePtr priv = (WacomDevicePtr)local->private; WacomCommonPtr common = priv->common; - DBG(4, priv->debugLevel, "Wacom number of open devices = %d\n", common->fd_refs); + DBG(4, priv, "Wacom number of open devices = %d\n", common->fd_refs); if (local->fd >= 0) { local->fd = -1; if (!--common->fd_refs) { - DBG(1, common->debugLevel, "Closing device; uninitializing.\n"); + DBG(1, common, "Closing device; uninitializing.\n"); xf86CloseSerial (common->fd); } } @@ -1284,7 +1284,7 @@ static int xf86WcmDevProc(DeviceIntPtr pWcm, int what) LocalDevicePtr local = (LocalDevicePtr)pWcm->public.devicePrivate; WacomDevicePtr priv = (WacomDevicePtr)local->private; - DBG(2, priv->debugLevel, "BEGIN dev=%p priv=%p " + DBG(2, priv, "BEGIN dev=%p priv=%p " "type=%s(%s) flags=%d fd=%d what=%s\n", (void *)pWcm, (void *)priv, IsStylus(priv) ? "stylus" : @@ -1306,7 +1306,7 @@ static int xf86WcmDevProc(DeviceIntPtr pWcm, int what) priv->wcmInitKeyClassCount = 0; if (!xf86WcmDevOpen(pWcm)) { - DBG(1, priv->debugLevel, "INIT FAILED\n"); + DBG(1, priv, "INIT FAILED\n"); return !Success; } priv->wcmInitKeyClassCount++; @@ -1316,7 +1316,7 @@ static int xf86WcmDevProc(DeviceIntPtr pWcm, int what) case DEVICE_ON: if (!xf86WcmDevOpen(pWcm)) { - DBG(1, priv->debugLevel, "ON FAILED\n"); + DBG(1, priv, "ON FAILED\n"); return !Success; } priv->wcmDevOpenCount++; @@ -1341,7 +1341,7 @@ static int xf86WcmDevProc(DeviceIntPtr pWcm, int what) break; } /* end switch */ - DBG(2, priv->debugLevel, "END Success \n"); + DBG(2, priv, "END Success \n"); return Success; } @@ -1356,7 +1356,7 @@ static Bool xf86WcmDevConvert(LocalDevicePtr local, int first, int num, { WacomDevicePtr priv = (WacomDevicePtr) local->private; - DBG(6, priv->debugLevel, "v0=%d v1=%d on screen %d \n", + DBG(6, priv, "v0=%d v1=%d on screen %d \n", v0, v1, priv->currentScreen); if (first != 0 || num == 1) @@ -1392,7 +1392,7 @@ static Bool xf86WcmDevConvert(LocalDevicePtr local, int first, int num, if (*y < 0) *y = 0; } - DBG(6, priv->debugLevel, "v0=%d v1=%d to x=%d y=%d\n", v0, v1, *x, *y); + DBG(6, priv, "v0=%d v1=%d to x=%d y=%d\n", v0, v1, *x, *y); return TRUE; } @@ -1409,7 +1409,7 @@ static Bool xf86WcmDevReverseConvert(LocalDevicePtr local, int x, int y, WacomDevicePtr priv = (WacomDevicePtr) local->private; int i = 0; - DBG(6, priv->debugLevel, "x=%d y=%d \n", x, y); + DBG(6, priv, "x=%d y=%d \n", x, y); priv->currentSX = x; priv->currentSY = y; @@ -1430,7 +1430,7 @@ static Bool xf86WcmDevReverseConvert(LocalDevicePtr local, int x, int y, priv->devReverseCount = 0; } - DBG(6, priv->debugLevel, "Wacom converted x=%d y=%d" + DBG(6, priv, "Wacom converted x=%d y=%d" " to v0=%d v1=%d v2=%d v3=%d v4=%d v5=%d\n", x, y, valuators[0], valuators[1], valuators[2], valuators[3], valuators[4], valuators[5]); diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h index 50ef765..194655a 100644 --- a/src/xf86Wacom.h +++ b/src/xf86Wacom.h @@ -74,15 +74,15 @@ #endif #if DEBUG -#define DBG(lvl, dLevel, ...) \ +#define DBG(lvl, priv, ...) \ do { \ - if ((lvl) <= dLevel) { \ + if ((lvl) <= priv->debugLevel) { \ xf86Msg(X_INFO, "%s: ", __func__); \ xf86Msg(X_NONE, __VA_ARGS__); \ } \ } while (0) #else -#define DBG(lvl, dLevel, ...) +#define DBG(lvl, priv, ...) #endif /***************************************************************************** |