diff options
author | pingc <pingc> | 2006-08-30 21:30:55 +0000 |
---|---|---|
committer | pingc <pingc> | 2006-08-30 21:30:55 +0000 |
commit | a6097e15592b75a079e84dbbcef210ace6284215 (patch) | |
tree | ff850ea5b6782b168473afd5a5521312b920fabf | |
parent | d85c13f7778aa838f65ab8f21d7897c6fefbf37d (diff) | |
download | xf86-input-wacom-a6097e15592b75a079e84dbbcef210ace6284215.tar.gz |
Fixed the pad initialization issue
-rw-r--r-- | ChangeLog | 3 | ||||
-rwxr-xr-x | src/xdrv/wcmCommon.c | 37 | ||||
-rwxr-xr-x | src/xdrv/wcmConfig.c | 15 | ||||
-rwxr-xr-x | src/xdrv/wcmFilter.c | 8 | ||||
-rwxr-xr-x | src/xdrv/wcmUSB.c | 8 | ||||
-rwxr-xr-x | src/xdrv/xf86Wacom.c | 20 | ||||
-rwxr-xr-x | src/xdrv/xf86Wacom.h | 12 |
7 files changed, 58 insertions, 45 deletions
@@ -1,6 +1,7 @@ -2006-08-29 Ping Cheng <pingc@wacom.com> +2006-08-30 Ping Cheng <pingc@wacom.com> * Added Intuos3 4x6 support * Updated acinclude.m4 and configure.in + * Fixed a pad display issue in xidump.c and wacom_drv.o (Mats Johannesson) 2006-08-24 Ping Cheng <pingc@wacom.com> * Added GetTabletID to "xsetwacom get" command for apps in X space diff --git a/src/xdrv/wcmCommon.c b/src/xdrv/wcmCommon.c index b80ee5f..840b9f1 100755 --- a/src/xdrv/wcmCommon.c +++ b/src/xdrv/wcmCommon.c @@ -974,6 +974,7 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, const WacomChannelPtr pChannel) { int id, idx; + int threshold; WacomDevicePtr priv; LocalDevicePtr pDev = NULL; WacomDeviceState* ds = &pChannel->valid.states[0]; @@ -1084,31 +1085,39 @@ static void commonDispatchDevice(WacomCommonPtr common, unsigned int channel, #endif /* throttle */ /* force out-prox when heighth is beyond threshold. */ - if (!(priv->flags & ABSOLUTE_FLAG) && IsCursor(priv) && common->wcmMaxDist) + if (!(priv->flags & ABSOLUTE_FLAG) && IsCursor(priv)) { - int threshold = common->wcmCursorProxoutDist; - int hysteresis = (threshold * common->wcmCursorProxoutHyst)/common->wcmMaxDist ; + if (strstr(common->wcmModel->name, "Intuos")) + { + if (common->wcmCursorProxoutDist > filtered.distance) + common->wcmCursorProxoutDist = filtered.distance; + } + else + { + if (common->wcmCursorProxoutDist == PROXOUT_DISTANCE) + common->wcmCursorProxoutDist = filtered.distance; + if (common->wcmCursorProxoutDist < filtered.distance) + common->wcmCursorProxoutDist = filtered.distance; + } + + threshold = common->wcmCursorProxoutDist; - /* Apply hysteresis to avoid jitter */ + /* Force prox out when distance is outside of ProxoutHyst */ if (priv->oldProximity) + { if (strstr(common->wcmModel->name, "Intuos")) - threshold += hysteresis; - else - threshold -= 2*hysteresis; - else - if (strstr(common->wcmModel->name, "Intuos")) - threshold -= hysteresis; + threshold += common->wcmCursorProxoutHyst; else - threshold -= hysteresis; + threshold -= common->wcmCursorProxoutHyst; + } - DBG(10, ErrorF("Distance over the tablet: %d, threshold: %d\n", - filtered.distance, threshold)); + DBG(10, ErrorF("Distance over the tablet: %d, ProxoutDist: %d hard prox: %d\n", + filtered.distance, common->wcmCursorProxoutDist, ds->proximity)); if ((filtered.distance > threshold && strstr(common->wcmModel->name, "Intuos")) || (filtered.distance < threshold && !strstr(common->wcmModel->name, "Intuos"))) { - ds->proximity = 0; filtered.proximity = 0; } } diff --git a/src/xdrv/wcmConfig.c b/src/xdrv/wcmConfig.c index cac8853..ce175ba 100755 --- a/src/xdrv/wcmConfig.c +++ b/src/xdrv/wcmConfig.c @@ -27,21 +27,6 @@ #define WCMACTION_X11_DRIVER #include "../include/wcmAction.h" -/* Max distance (0-63) at which a proximity-out event is generated for - * cursor device (e.g. mouse). Default is half of the range. - */ -#define PROXOUT_DISTANCE 40 -/* Hysteresis value for the above distance in 1/64 relative units, e.g. - * if PROXOUT_DISTANCE == 32 and PROXOUT_HYSTERESIS == 8, this would mean - * that proximity out is generated when distance is more than (for Intuos - * series and Cintiq 21UX) or less than (for Graphire series) - * 32+(32*8/64) = 36 ( or 32-(32*8/64) = 28) units (this is to produce a prompt - * relative movement), and proximity in is generated when distance is less - * than or more than 32-(32*8/64) = 28 ( or 32+(32*8/64) = 36) units - * (this is to avoid prox in/out jittering). - */ -#define PROXOUT_HYSTERESIS 8 - /***************************************************************************** * xf86WcmAllocate -- ****************************************************************************/ diff --git a/src/xdrv/wcmFilter.c b/src/xdrv/wcmFilter.c index 3c5dbd1..189fa79 100755 --- a/src/xdrv/wcmFilter.c +++ b/src/xdrv/wcmFilter.c @@ -50,8 +50,8 @@ void xf86WcmSetPressureCurve(WacomDevicePtr pDev, int x0, int y0, if ((x0 < 0) || (x0 > 100) || (y0 < 0) || (y0 > 100) || (x1 < 0) || (x1 > 100) || (y1 < 0) || (y1 > 100)) return; - xf86Msg(X_INFO, "xf86WcmSetPressureCurve: setting to %d,%d %d,%d\n", - x0, y0, x1, y1); + DBG(10, ErrorF("xf86WcmSetPressureCurve: setting to " + "%d,%d %d,%d\n", x0, y0, x1, y1)); /* if curve is not allocated, do it now. */ if (!pDev->pPressCurve) @@ -60,8 +60,8 @@ void xf86WcmSetPressureCurve(WacomDevicePtr pDev, int x0, int y0, (FILTER_PRESSURE_RES + 1)); if (!pDev->pPressCurve) { - xf86Msg(X_ERROR, "xf86WcmSetPressureCurve: failed to " - "allocate memory for curve\n"); + DBG(1, ErrorF("xf86WcmSetPressureCurve: failed to " + "allocate memory for curve\n")); return; } } diff --git a/src/xdrv/wcmUSB.c b/src/xdrv/wcmUSB.c index adbc4a5..d9f01ac 100755 --- a/src/xdrv/wcmUSB.c +++ b/src/xdrv/wcmUSB.c @@ -1,4 +1,4 @@ -/* +tilt/* * Copyright 1995-2002 by Frederic Lepied, France. <Lepied@XFree86.org> * Copyright 2002-2006 by Ping Cheng, Wacom Technology. <pingc@wacom.com> * @@ -473,6 +473,8 @@ Bool usbWcmInit(LocalDevicePtr local) else common->nbuttons = 5; + common->wcmFlags |= TILT_ENABLED_FLAG; + return xf86WcmInitTablet(local,model,id,0.0); } @@ -894,6 +896,10 @@ static void usbParseChannel(WacomCommonPtr common, int channel, int serial) } } /* next event */ + /* reset the max proxout distance for next in */ + if (ds->device_type == CURSOR_ID && !ds->proximity) + common->wcmCursorProxoutDist = PROXOUT_DISTANCE; + /* Disable proximity on pads with just one channel and a pseudo second * channel (Intuos3 or Graphire4) when no pad buttons are pressed. */ diff --git a/src/xdrv/xf86Wacom.c b/src/xdrv/xf86Wacom.c index 839fb0b..964ef7e 100755 --- a/src/xdrv/xf86Wacom.c +++ b/src/xdrv/xf86Wacom.c @@ -536,8 +536,7 @@ void xf86WcmReadPacket(LocalDevicePtr local) if (common->tablet_id != sID[2]) { common->wcmReadErrorCount++; - DBG(10, ErrorF("Wacom device ID changed from %d to %d\n", - common->tablet_id, sID[2])); + DBG(10, ErrorF("Wacom device ID changed from %d to %d\n", common->tablet_id, sID[2])); } } @@ -555,9 +554,7 @@ void xf86WcmReadPacket(LocalDevicePtr local) if (common->wcmDevCls == &gWacomUSBDevice) { common->wcmReadErrorCount++; - xf86WcmDevClose(local); xf86WcmWait(500); - xf86WcmDevOpen(local->dev); } ErrorF("Error reading wacom device : %s\n", strerror(errno)); return; @@ -565,7 +562,8 @@ void xf86WcmReadPacket(LocalDevicePtr local) /* account for new data */ common->bufpos += len; - DBG(10, ErrorF("xf86WcmReadPacket buffer has %d bytes\n", common->bufpos)); + DBG(10, ErrorF("xf86WcmReadPacket buffer has %d bytes\n", + common->bufpos)); pos = 0; @@ -656,16 +654,18 @@ static int xf86WcmDevProc(DeviceIntPtr pWcm, int what) switch (what) { + /* All devices must be opened here to initialize and + * register even a 'pad' which doesn't "SendCoreEvents" + */ case DEVICE_INIT: - /* Try to open the device later (on DEVICE_OFF/ON) */ - break; - - case DEVICE_ON: if (!xf86WcmDevOpen(pWcm)) { - DBG(1, ErrorF("xf86WcmProc ON FAILED\n")); + DBG(1, ErrorF("xf86WcmProc INIT FAILED\n")); return !Success; } + break; + + case DEVICE_ON: xf86AddEnabledDevice(local); pWcm->public.on = TRUE; break; diff --git a/src/xdrv/xf86Wacom.h b/src/xdrv/xf86Wacom.h index 864e30e..54e9f2d 100755 --- a/src/xdrv/xf86Wacom.h +++ b/src/xdrv/xf86Wacom.h @@ -128,6 +128,18 @@ #define MAXTRY 3 /* max number of try to receive magic number */ #define MAX_COORD_RES 1270.0 /* Resolution of the returned MaxX and MaxY */ +/* Max distance to the tablet at which a proximity-out event is generated for + * cursor device (e.g. mouse). + */ +#define PROXOUT_DISTANCE 256 +/* Hysteresis value would mean that proximity out is generated + * when distance is more than (for Intuos series and Cintiq 21UX) + * or less than (for Graphire series) MinDistance + HYSTERESIS + * ( or MaxDistance - HYSTERESIS) units (this is to produce a prompt + * relative movement) + */ +#define PROXOUT_HYSTERESIS 8 + #define HEADER_BIT 0x80 #define ZAXIS_SIGN_BIT 0x40 #define ZAXIS_BIT 0x04 |