Re: [Linuxwacom-devel] [PATCH 8/9] Send touch events to X when gestures are disabled

2012-10-18 Thread Jason Gerecke
On Thu, Oct 18, 2012 at 7:12 PM, Thomas Jaeger  wrote:
> On 09/29/2012 07:58 PM, Jason Gerecke wrote:
>> @@ -419,6 +419,14 @@ static int wcmDevInit(DeviceIntPtr pWcm)
>>   return FALSE;
>>   }
>>
>> +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
>> + if (!InitTouchClassDeviceStruct(pInfo->dev, 0, XIDependentTouch, 2)) {
>> + xf86Msg(X_ERROR, "Unable to init touch class device 
>> struct!\n");
>> + return FALSE;
>> + }
>> + priv->common->touch_mask = valuator_mask_new(2);
>> +#endif
>> +
>>   if (!IsPad(priv))
>>   {
>>   wcmInitialToolSize(pInfo);
>
> This will register any wacom device as a direct touch device, even pens
> and erasers.
>
> Tom

Good catch! I'm not sure if it makes a difference to clients or not,
but its definitely not what I had intended. Enclosing it in an
IsTouch(priv) check should do the trick; I'll whip up a patch when I
get back to the office in the morning.

Jason

---
When you're rife with devastation / There's a simple explanation:
You're a toymaker's creation / Trapped inside a crystal ball.
And whichever way he tilts it / Know that we must be resilient
We won't let them break our spirits / As we sing our silly song.

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] X220t Tablet no longer working

2012-10-18 Thread Peter Hutterer
On Sat, Aug 11, 2012 at 05:56:33PM +0200, Jan Steffens wrote:
> On Sat, Aug 11, 2012 at 5:24 PM, Wataru Sakurai  wrote:
> > Hi Jonas,
> >
> > I had the same problem. my tablet's product id is 0094 before I know,
> > and Tablet not working.
> >
> > So, I built linux kernel 3.6-rc1 and boot it, then the problem is resolved.
> > Please don't do "reboot", do power off ( "shutdown" ) and next do power on.
> > Now I can use stylus, eraser, and touch. tablet's product id is 00E6.
> 
> Is there a particular commit in 3.6 that fixes it?

bringing this up late, but still:
I suspect this may be a hardware issue. I had this same issue for a while
and after digging into this today it doesn't seem to be related to a kernel
version. I even downgraded to an older kernel

$> uname -r
3.3.4-5.fc17.x86_64

rebooting, etc. didn't work. Powering off, waiting a few secs and starting
it up again worked (with that kernel above).

Cheers,
   Peter 

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH 8/9] Send touch events to X when gestures are disabled

2012-10-18 Thread Thomas Jaeger
On 09/29/2012 07:58 PM, Jason Gerecke wrote:
> @@ -419,6 +419,14 @@ static int wcmDevInit(DeviceIntPtr pWcm)
>   return FALSE;
>   }
>  
> +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
> + if (!InitTouchClassDeviceStruct(pInfo->dev, 0, XIDependentTouch, 2)) {
> + xf86Msg(X_ERROR, "Unable to init touch class device struct!\n");
> + return FALSE;
> + }
> + priv->common->touch_mask = valuator_mask_new(2);
> +#endif
> +
>   if (!IsPad(priv))
>   {
>   wcmInitialToolSize(pInfo);

This will register any wacom device as a direct touch device, even pens
and erasers.

Tom

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH] Restore pad button functionality

2012-10-18 Thread Peter Hutterer
On Thu, Oct 18, 2012 at 01:26:56PM -0700, Jason Gerecke wrote:
> Commit b0083492 broke pad buttons by no longer setting the wcmBTNChannel.
> With this variable left uninitialized, pad button data would be stored
> in another channel (e.g. 0) without any other data like proximity set.
> 
> This commit sets wcmBTNChannel to point to the channel used for
> storing pad data whenever a pad packet is detected.
> 
> Signed-off-by: Jason Gerecke 

Acked-by: Peter Hutterer 

Cheers,
   Peter

> ---
>  src/wcmUSB.c | 6 +-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> index f90def9..a2c2b3b 100644
> --- a/src/wcmUSB.c
> +++ b/src/wcmUSB.c
> @@ -767,12 +767,16 @@ static int protocol5Serial(int device_type, unsigned 
> int serial) {
>   */
>  static int usbChooseChannel(WacomCommonPtr common, int device_type, unsigned 
> int serial)
>  {
> + wcmUSBData* private = common->private;
> +
>   /* figure out the channel to use based on serial number */
>   int i, channel = -1;
>  
>   /* force events from PAD device to PAD_CHANNEL */
> - if (serial == -1)
> + if (serial == -1) {
>   channel = PAD_CHANNEL;
> + private->wcmBTNChannel = channel;
> + }
>  
>   /* find existing channel */
>   if (channel < 0)
> -- 
> 1.7.12.2
> 
> 
> --
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> ___
> Linuxwacom-devel mailing list
> Linuxwacom-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
> 

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH] Add support for Cintiq 24HD touch

2012-10-18 Thread Peter Hutterer
On Thu, Oct 18, 2012 at 01:31:46PM -0700, Jason Gerecke wrote:
> Adds support for the EMR and touch digitizers on the Cintiq 24HD
> touch. The digitizers are on separate USB devices, which can lead to
> the cursor jumping back and forth between the stylus and finger.
> Performing arbitration between the two (disabling finger while pen is in
> proximity) is expected to be handled by the kernel driver.
> 
> Signed-off-by: Jason Gerecke 

Reviewed-by: Peter Hutterer 

Cheers,
   Peter


> ---
>  src/wcmUSB.c| 1 +
>  src/wcmValidateDevice.c | 2 ++
>  2 files changed, 3 insertions(+)
> 
> diff --git a/src/wcmUSB.c b/src/wcmUSB.c
> index f90def9..4eb15d4 100644
> --- a/src/wcmUSB.c
> +++ b/src/wcmUSB.c
> @@ -278,6 +278,7 @@ static struct
>   { WACOM_VENDOR_ID, 0xCC, 20, 20, &usbCintiqV5   }, /* Cintiq 
> 21UX2 */
>   { WACOM_VENDOR_ID, 0xF4, 20, 20, &usbCintiqV5   }, /* Cintiq 
> 24HD */
>   { WACOM_VENDOR_ID, 0xFA, 20, 20, &usbCintiqV5   }, /* Cintiq 
> 22HD */
> + { WACOM_VENDOR_ID, 0xF8, 20, 20, &usbCintiqV5   }, /* Cintiq 
> 24HD touch (EMR digitizer) */
>  
>   { WACOM_VENDOR_ID, 0x90, 10, 10, &usbTabletPC   }, /* TabletPC 
> 0x90 */
>   { WACOM_VENDOR_ID, 0x93, 10, 10, &usbTabletPC   }, /* TabletPC 
> 0x93 */
> diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
> index 1d09102..658092b 100644
> --- a/src/wcmValidateDevice.c
> +++ b/src/wcmValidateDevice.c
> @@ -189,6 +189,7 @@ int wcmDeviceTypeKeys(InputInfoPtr pInfo)
>  
>   switch (priv->common->tablet_id)
>   {
> + case 0xF8:  /* Cintiq 24HDT */
>   case 0xF4:  /* Cintiq 24HD */
>   TabletSetFeature(priv->common, WCM_DUALRING | WCM_LCD);
>   /* fall through */
> @@ -279,6 +280,7 @@ int wcmDeviceTypeKeys(InputInfoPtr pInfo)
>   break;
>  
>   case 0x9F:
> + case 0xF6: /* Cintiq 24HDT Touch */
>   TabletSetFeature(priv->common, WCM_LCD);
>   break;
>   }
> -- 
> 1.7.12.2
> 
> 
> --
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_sfd2d_oct
> ___
> Linuxwacom-devel mailing list
> Linuxwacom-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
> 

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH] Add recently-referenced functions to fake-symbols

2012-10-18 Thread Peter Hutterer
On Thu, Oct 18, 2012 at 01:41:57PM -0700, Jason Gerecke wrote:
> Signed-off-by: Jason Gerecke 

Reviewed-by: Peter Hutterer 

also, if you come up with a way to avoid this in the future - awesome. I'm
not happy with the current test suite, it is a burden, catches few actual
issues and breaks the build more often than not (well, that's kinda our
fault for not running it)

I do think we need a better approach here, but I don't know what that could
be yet.

Cheers,
   Peter

> ---
>  test/fake-symbols.c | 27 +++
>  test/fake-symbols.h | 10 ++
>  2 files changed, 37 insertions(+)
> 
> diff --git a/test/fake-symbols.c b/test/fake-symbols.c
> index 9ed632b..fe1663b 100644
> --- a/test/fake-symbols.c
> +++ b/test/fake-symbols.c
> @@ -90,6 +90,12 @@ xf86CheckStrOption(OPTTYPE optlist, const char *name, char 
> *deflt)
>  return NULL;
>  }
>  
> +_X_EXPORT int
> +xf86CheckBoolOption(OPTTYPE list, const char *name, int deflt)
> +{
> + return 0;
> +}
> +
>  _X_EXPORT void
>  xf86AddEnabledDevice(InputInfoPtr pInfo)
>  {
> @@ -506,3 +512,24 @@ input_option_free_list(InputOption **opts)
>   }
>  }
>  #endif
> +
> +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
> +_X_EXPORT Bool
> +InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int max_touches,
> +unsigned int mode, unsigned int numAxes) {
> + return TRUE;
> +}
> +
> +_X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators) {
> + return NULL;
> +}
> +
> +_X_EXPORT void valuator_mask_set(ValuatorMask *mask, int valuator, int data) 
> {
> + return;
> +}
> +
> +_X_EXPORT void xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid, 
> uint16_t type,
> +uint32_t flags, const ValuatorMask *mask) {
> + return;
> +}
> +#endif
> diff --git a/test/fake-symbols.h b/test/fake-symbols.h
> index 4b28745..3a99579 100644
> --- a/test/fake-symbols.h
> +++ b/test/fake-symbols.h
> @@ -22,6 +22,7 @@ extern char* xf86OptionName(OPTTYPE opt);
>  extern CONST char* xf86FindOptionValue(OPTTYPE options, const char *name);
>  extern int xf86NameCmp(const char *s1, const char *s2);
>  extern char* xf86CheckStrOption(OPTTYPE optlist, const char *name, char 
> *deflt);
> +extern int xf86CheckBoolOption(OPTTYPE list, const char *name, int deflt);
>  
>  
>  extern char * xf86SetStrOption(OPTTYPE optlist, const char *name, CONST char 
> *deflt);
> @@ -193,3 +194,12 @@ extern void TimerFree(OsTimerPtr timer);
>  
>  extern int xf86BlockSIGIO (void);
>  extern void xf86UnblockSIGIO (int wasset);
> +
> +#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
> +extern Bool InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int 
> max_touches,
> +unsigned int mode, unsigned int numAxes);
> +extern ValuatorMask *valuator_mask_new(int num_valuators);
> +extern void valuator_mask_set(ValuatorMask *mask, int valuator, int data);
> +extern void xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid, uint16_t 
> type,
> +uint32_t flags, const ValuatorMask *mask);
> +#endif
> -- 
> 1.7.12.2
> 

--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH] Add recently-referenced functions to fake-symbols

2012-10-18 Thread Jason Gerecke
Signed-off-by: Jason Gerecke 
---
 test/fake-symbols.c | 27 +++
 test/fake-symbols.h | 10 ++
 2 files changed, 37 insertions(+)

diff --git a/test/fake-symbols.c b/test/fake-symbols.c
index 9ed632b..fe1663b 100644
--- a/test/fake-symbols.c
+++ b/test/fake-symbols.c
@@ -90,6 +90,12 @@ xf86CheckStrOption(OPTTYPE optlist, const char *name, char 
*deflt)
 return NULL;
 }
 
+_X_EXPORT int
+xf86CheckBoolOption(OPTTYPE list, const char *name, int deflt)
+{
+   return 0;
+}
+
 _X_EXPORT void
 xf86AddEnabledDevice(InputInfoPtr pInfo)
 {
@@ -506,3 +512,24 @@ input_option_free_list(InputOption **opts)
}
 }
 #endif
+
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
+_X_EXPORT Bool
+InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int max_touches,
+unsigned int mode, unsigned int numAxes) {
+   return TRUE;
+}
+
+_X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators) {
+   return NULL;
+}
+
+_X_EXPORT void valuator_mask_set(ValuatorMask *mask, int valuator, int data) {
+   return;
+}
+
+_X_EXPORT void xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid, uint16_t 
type,
+uint32_t flags, const ValuatorMask *mask) {
+   return;
+}
+#endif
diff --git a/test/fake-symbols.h b/test/fake-symbols.h
index 4b28745..3a99579 100644
--- a/test/fake-symbols.h
+++ b/test/fake-symbols.h
@@ -22,6 +22,7 @@ extern char* xf86OptionName(OPTTYPE opt);
 extern CONST char* xf86FindOptionValue(OPTTYPE options, const char *name);
 extern int xf86NameCmp(const char *s1, const char *s2);
 extern char* xf86CheckStrOption(OPTTYPE optlist, const char *name, char 
*deflt);
+extern int xf86CheckBoolOption(OPTTYPE list, const char *name, int deflt);
 
 
 extern char * xf86SetStrOption(OPTTYPE optlist, const char *name, CONST char 
*deflt);
@@ -193,3 +194,12 @@ extern void TimerFree(OsTimerPtr timer);
 
 extern int xf86BlockSIGIO (void);
 extern void xf86UnblockSIGIO (int wasset);
+
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 16
+extern Bool InitTouchClassDeviceStruct(DeviceIntPtr device, unsigned int 
max_touches,
+unsigned int mode, unsigned int numAxes);
+extern ValuatorMask *valuator_mask_new(int num_valuators);
+extern void valuator_mask_set(ValuatorMask *mask, int valuator, int data);
+extern void xf86PostTouchEvent(DeviceIntPtr dev, uint32_t touchid, uint16_t 
type,
+uint32_t flags, const ValuatorMask *mask);
+#endif
-- 
1.7.12.2


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH] Add support for Cintiq 24HD touch

2012-10-18 Thread Jason Gerecke
Adds support for the EMR and touch digitizers on the Cintiq 24HD
touch. The digitizers are on separate USB devices, which can lead to
the cursor jumping back and forth between the stylus and finger.
Performing arbitration between the two (disabling finger while pen is in
proximity) is expected to be handled by the kernel driver.

Signed-off-by: Jason Gerecke 
---
 src/wcmUSB.c| 1 +
 src/wcmValidateDevice.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index f90def9..4eb15d4 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -278,6 +278,7 @@ static struct
{ WACOM_VENDOR_ID, 0xCC, 20, 20, &usbCintiqV5   }, /* Cintiq 
21UX2 */
{ WACOM_VENDOR_ID, 0xF4, 20, 20, &usbCintiqV5   }, /* Cintiq 
24HD */
{ WACOM_VENDOR_ID, 0xFA, 20, 20, &usbCintiqV5   }, /* Cintiq 
22HD */
+   { WACOM_VENDOR_ID, 0xF8, 20, 20, &usbCintiqV5   }, /* Cintiq 
24HD touch (EMR digitizer) */
 
{ WACOM_VENDOR_ID, 0x90, 10, 10, &usbTabletPC   }, /* TabletPC 
0x90 */
{ WACOM_VENDOR_ID, 0x93, 10, 10, &usbTabletPC   }, /* TabletPC 
0x93 */
diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index 1d09102..658092b 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -189,6 +189,7 @@ int wcmDeviceTypeKeys(InputInfoPtr pInfo)
 
switch (priv->common->tablet_id)
{
+   case 0xF8:  /* Cintiq 24HDT */
case 0xF4:  /* Cintiq 24HD */
TabletSetFeature(priv->common, WCM_DUALRING | WCM_LCD);
/* fall through */
@@ -279,6 +280,7 @@ int wcmDeviceTypeKeys(InputInfoPtr pInfo)
break;
 
case 0x9F:
+   case 0xF6: /* Cintiq 24HDT Touch */
TabletSetFeature(priv->common, WCM_LCD);
break;
}
-- 
1.7.12.2


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH 1/2] Have getWheelButton deal with array indices instead of pointers

2012-10-18 Thread Jason Gerecke
This patch modifies the function signature of getWheelButton so that it
accepts and returns array indices rather than pointers. This is in
preparation of the next commit, which would be needlessly unreadable
otherwise.

Signed-off-by: Jason Gerecke 
---
 src/wcmCommon.c | 49 +++--
 1 file changed, 23 insertions(+), 26 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index ce6344c..6799108 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -350,20 +350,18 @@ static int getScrollDelta(int current, int old, int wrap, 
int flags)
  * sent.
  * 
  * @param deltaAmount of change in the scrolling axis
- * @param action_upAction to send on scroll up
- * @param action_dnAction to send on scroll down
- * @return Action that should be performed
+ * @param action_upArray index of action to send on scroll up
+ * @param action_dnArray index of action to send on scroll down
+ * @return Array index of action that should be performed, or -1 
if none.
  */
-static void getWheelButton(int delta, unsigned int *action_up,
-unsigned int *action_dn,
-unsigned int** action)
+static int getWheelButton(int delta, int action_up, int action_dn)
 {
if (delta > 0)
-   *action = action_up;
+   return action_up;
else if (delta < 0)
-   *action = action_dn;
+   return action_dn;
else
-   *action = NULL;
+   return -1;
 }
 
 /**
@@ -392,54 +390,53 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, 
const WacomDeviceState* ds,
 int first_val, int num_vals, int *valuators)
 {
WacomDevicePtr priv = (WacomDevicePtr) pInfo->private;
-   int delta = 0;
-   unsigned int *fakeKey = NULL;
+   int delta = 0, idx = 0;
 
DBG(10, priv, "\n");
 
/* emulate events for left strip */
delta = getScrollDelta(ds->stripx, priv->oldStripX, 0, AXIS_INVERT | 
AXIS_BITWISE);
-   if (delta && IsPad(priv) && priv->oldProximity == ds->proximity)
+   idx = getWheelButton(delta, STRIP_LEFT_UP, STRIP_LEFT_DN);
+   if (idx >= 0 && IsPad(priv) && priv->oldProximity == ds->proximity)
{
DBG(10, priv, "Left touch strip scroll delta = %d\n", delta);
-   getWheelButton(delta, priv->strip_keys[STRIP_LEFT_UP], 
priv->strip_keys[STRIP_LEFT_DN], &fakeKey);
-   sendWheelStripEvent(fakeKey, pInfo, first_val, num_vals, 
valuators);
+   sendWheelStripEvent(priv->strip_keys[idx], pInfo, first_val, 
num_vals, valuators);
}
 
/* emulate events for right strip */
delta = getScrollDelta(ds->stripy, priv->oldStripY, 0, AXIS_INVERT | 
AXIS_BITWISE);
-   if (delta && IsPad(priv) && priv->oldProximity == ds->proximity)
+   idx = getWheelButton(delta, STRIP_RIGHT_UP, STRIP_RIGHT_DN);
+   if (idx >= 0 && IsPad(priv) && priv->oldProximity == ds->proximity)
{
DBG(10, priv, "Right touch strip scroll delta = %d\n", delta);
-   getWheelButton(delta, priv->strip_keys[STRIP_RIGHT_UP], 
priv->strip_keys[STRIP_RIGHT_DN], &fakeKey);
-   sendWheelStripEvent(fakeKey, pInfo, first_val, num_vals, 
valuators);
+   sendWheelStripEvent(priv->strip_keys[idx], pInfo, first_val, 
num_vals, valuators);
}
 
/* emulate events for relative wheel */
delta = getScrollDelta(ds->relwheel, 0, 0, 0);
-   if (delta && (IsCursor(priv) || IsPad(priv)) && priv->oldProximity == 
ds->proximity)
+   idx = getWheelButton(delta, WHEEL_REL_UP, WHEEL_REL_DN);
+   if (idx >= 0 && (IsCursor(priv) || IsPad(priv)) && priv->oldProximity 
== ds->proximity)
{
DBG(10, priv, "Relative wheel scroll delta = %d\n", delta);
-   getWheelButton(delta, priv->wheel_keys[WHEEL_REL_UP], 
priv->wheel_keys[WHEEL_REL_DN], &fakeKey);
-   sendWheelStripEvent(fakeKey, pInfo, first_val, num_vals, 
valuators);
+   sendWheelStripEvent(priv->wheel_keys[idx], pInfo, first_val, 
num_vals, valuators);
}
 
/* emulate events for left touch ring */
delta = getScrollDelta(ds->abswheel, priv->oldWheel, MAX_PAD_RING, 
AXIS_INVERT);
-   if (delta && IsPad(priv) && priv->oldProximity == ds->proximity)
+   idx = getWheelButton(delta, WHEEL_ABS_UP, WHEEL_ABS_DN);
+   if (idx >= 0 && IsPad(priv) && priv->oldProximity == ds->proximity)
{
DBG(10, priv, "Left touch wheel scroll delta = %d\n", delta);
-   getWheelButton(delta, priv->wheel_keys[WHEEL_ABS_UP], 
priv->wheel_keys[WHEEL_ABS_DN], &fakeKey);
-   sendWheelStripEvent(fakeKey, pInfo, first_val, num_vals, 
valuators);
+   sendWheelStripEvent(priv->wheel_keys[idx], pInfo, first_val, 
num_vals, valuators);
}
 
   

[Linuxwacom-devel] [PATCH 2/2] Correct number of actions reported by sendWheelStripEvent to sendAction

2012-10-18 Thread Jason Gerecke
Commit 477a261e has sendWheelStripEvent use the ARRAY_SIZE macro on a
pointer. This will not return a proper value, causing the wrong array
length to be provided to sendAction. This can lead to only the first few
actions assigned to a wheel or strip actually being performed.

This patch changes the signature of sendWheelStripEvent to accept an
explicit length.

https://sourceforge.net/tracker/?func=detail&aid=3577713&group_id=69596&atid=52$

Signed-off-by: Jason Gerecke 
---
 src/wcmCommon.c | 22 ++
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 6799108..30b6ead 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -369,16 +369,17 @@ static int getWheelButton(int delta, int action_up, int 
action_dn)
  *
  * @param button X button number to send if no action is defined
  * @param action Action to send
+ * @param nactions   Length of action array
  * @param pInfo
  * @param first_val  
  * @param num_vals
  * @param valuators
  */
-static void sendWheelStripEvent(unsigned int *action, InputInfoPtr pInfo,
+static void sendWheelStripEvent(unsigned int *action, int nactions, 
InputInfoPtr pInfo,
 int first_val, int num_vals, int *valuators)
 {
-   sendAction(pInfo, 1, action, ARRAY_SIZE(action), first_val, num_vals, 
valuators);
-   sendAction(pInfo, 0, action, ARRAY_SIZE(action), first_val, num_vals, 
valuators);
+   sendAction(pInfo, 1, action, nactions, first_val, num_vals, valuators);
+   sendAction(pInfo, 0, action, nactions, first_val, num_vals, valuators);
 }
 
 /*
@@ -400,7 +401,8 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
if (idx >= 0 && IsPad(priv) && priv->oldProximity == ds->proximity)
{
DBG(10, priv, "Left touch strip scroll delta = %d\n", delta);
-   sendWheelStripEvent(priv->strip_keys[idx], pInfo, first_val, 
num_vals, valuators);
+   sendWheelStripEvent(priv->strip_keys[idx], 
ARRAY_SIZE(priv->strip_keys[idx]),
+   pInfo, first_val, num_vals, valuators);
}
 
/* emulate events for right strip */
@@ -409,7 +411,8 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
if (idx >= 0 && IsPad(priv) && priv->oldProximity == ds->proximity)
{
DBG(10, priv, "Right touch strip scroll delta = %d\n", delta);
-   sendWheelStripEvent(priv->strip_keys[idx], pInfo, first_val, 
num_vals, valuators);
+   sendWheelStripEvent(priv->strip_keys[idx], 
ARRAY_SIZE(priv->strip_keys[idx]),
+   pInfo, first_val, num_vals, valuators);
}
 
/* emulate events for relative wheel */
@@ -418,7 +421,8 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
if (idx >= 0 && (IsCursor(priv) || IsPad(priv)) && priv->oldProximity 
== ds->proximity)
{
DBG(10, priv, "Relative wheel scroll delta = %d\n", delta);
-   sendWheelStripEvent(priv->wheel_keys[idx], pInfo, first_val, 
num_vals, valuators);
+   sendWheelStripEvent(priv->wheel_keys[idx], 
ARRAY_SIZE(priv->wheel_keys[idx]),
+   pInfo, first_val, num_vals, valuators);
}
 
/* emulate events for left touch ring */
@@ -427,7 +431,8 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
if (idx >= 0 && IsPad(priv) && priv->oldProximity == ds->proximity)
{
DBG(10, priv, "Left touch wheel scroll delta = %d\n", delta);
-   sendWheelStripEvent(priv->wheel_keys[idx], pInfo, first_val, 
num_vals, valuators);
+   sendWheelStripEvent(priv->wheel_keys[idx], 
ARRAY_SIZE(priv->wheel_keys[idx]),
+   pInfo, first_val, num_vals, valuators);
}
 
/* emulate events for right touch ring */
@@ -436,7 +441,8 @@ static void sendWheelStripEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds,
if (idx >= 0 && IsPad(priv) && priv->oldProximity == ds->proximity)
{
DBG(10, priv, "Right touch wheel scroll delta = %d\n", delta);
-   sendWheelStripEvent(priv->wheel_keys[idx], pInfo, first_val, 
num_vals, valuators);
+   sendWheelStripEvent(priv->wheel_keys[idx], 
ARRAY_SIZE(priv->wheel_keys[idx]),
+   pInfo, first_val, num_vals, valuators);
}
 }
 
-- 
1.7.12.2


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
Linuxwacom-devel mailing list
Li

[Linuxwacom-devel] [PATCH] Restore pad button functionality

2012-10-18 Thread Jason Gerecke
Commit b0083492 broke pad buttons by no longer setting the wcmBTNChannel.
With this variable left uninitialized, pad button data would be stored
in another channel (e.g. 0) without any other data like proximity set.

This commit sets wcmBTNChannel to point to the channel used for
storing pad data whenever a pad packet is detected.

Signed-off-by: Jason Gerecke 
---
 src/wcmUSB.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index f90def9..a2c2b3b 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -767,12 +767,16 @@ static int protocol5Serial(int device_type, unsigned int 
serial) {
  */
 static int usbChooseChannel(WacomCommonPtr common, int device_type, unsigned 
int serial)
 {
+   wcmUSBData* private = common->private;
+
/* figure out the channel to use based on serial number */
int i, channel = -1;
 
/* force events from PAD device to PAD_CHANNEL */
-   if (serial == -1)
+   if (serial == -1) {
channel = PAD_CHANNEL;
+   private->wcmBTNChannel = channel;
+   }
 
/* find existing channel */
if (channel < 0)
-- 
1.7.12.2


--
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel