Re: [Linuxwacom-devel] [linuxwacom-announce] [ANNOUNCE] xf86-input-wacom 0.10.99.1

2011-04-03 Thread Andrzej Giniewicz
On Sun, Apr 3, 2011 at 1:57 AM, Chris Bagwell ch...@cnpbagwell.com wrote:
 OK, found and emailed patches to fix those two issues.

 I know your much better then me at testing so if you get bored, please
 apply those to 0.10.11 or git and see what else you find.

I applied on top of 0.10.99.1 (I actually applied second one already
with the line added by Ping in his reply). Now all 4 buttons on pad
work, also pointer reacts to touch. For now I found that it's now
impossible to revert the scroll directions like I did before. In both
cases when I have:

[giniu@raven3 ~]$ xsetwacom get Wacom Bamboo 2FG 4x5 Finger touch Button 4
button +4
[giniu@raven3 ~]$ xsetwacom get Wacom Bamboo 2FG 4x5 Finger touch Button 5
button +5

or

[giniu@raven3 ~]$ xsetwacom get Wacom Bamboo 2FG 4x5 Finger touch Button 4
button +5
[giniu@raven3 ~]$ xsetwacom get Wacom Bamboo 2FG 4x5 Finger touch Button 5
button +4

when I scroll down touch generates button 4 and scroll up generates
button 5. Ability to revert scrolls was removed on purpose or maybe
the way to do it changed?

Andrzej.

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH v2] fix filter issue on MT bamboos

2011-04-03 Thread chris
From: Chris Bagwell ch...@cnpbagwell.com

Init tool device type is needed for all MT devices to do correct
filtering; not just pen+MT tablets.

Signed-off-by: Chris Bagwell ch...@cnpbagwell.com
---

Limit init of tool to MT case sinces that function is not ready
for pad devices and geared towards generic protocol only.

 src/wcmUSB.c |7 ---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index d8bd404..bc2d16a 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1412,11 +1412,12 @@ static void usbDispatchEvents(InputInfoPtr pInfo)
 
DBG(6, common, %d events received\n, private-wcmEventCnt);
 
-   if (private-wcmPenTouch)
-   {
+   if (private-wcmUseMT)
private-wcmDeviceType = usbInitToolType(private-wcmEvents,
-   private-wcmEventCnt);
+private-wcmEventCnt);
 
+   if (private-wcmPenTouch)
+   {
/* We get both pen and touch data from the kernel when they
 * both are in/down. So, if we were (hence the need of dslast)
 * processing pen events, we should ignore touch events.
-- 
1.7.3.4


--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [linuxwacom-announce] [ANNOUNCE] xf86-input-wacom 0.10.99.1

2011-04-03 Thread Chris Bagwell
On Sun, Apr 3, 2011 at 4:45 AM, Andrzej Giniewicz ggi...@gmail.com wrote:
 On Sun, Apr 3, 2011 at 1:57 AM, Chris Bagwell ch...@cnpbagwell.com wrote:
 OK, found and emailed patches to fix those two issues

 I know your much better then me at testing so if you get bored, please
 apply those to 0.10.11 or git and see what else you find.

 I applied on top of 0.10.99.1 (I actually applied second one already
 with the line added by Ping in his reply). Now all 4 buttons on pad
 work, also pointer reacts to touch. For now I found that it's now
 impossible to revert the scroll directions like I did before. In both
 cases when I have:

 [giniu@raven3 ~]$ xsetwacom get Wacom Bamboo 2FG 4x5 Finger touch Button 4
 button +4
 [giniu@raven3 ~]$ xsetwacom get Wacom Bamboo 2FG 4x5 Finger touch Button 5
 button +5

 or

 [giniu@raven3 ~]$ xsetwacom get Wacom Bamboo 2FG 4x5 Finger touch Button 4
 button +5
 [giniu@raven3 ~]$ xsetwacom get Wacom Bamboo 2FG 4x5 Finger touch Button 5
 button +4

 when I scroll down touch generates button 4 and scroll up generates
 button 5. Ability to revert scrolls was removed on purpose or maybe
 the way to do it changed?


It could be a few different things.  First, did you really use get
instead of set?

Next, can you try the format of Button 4 5 and Button 5 4?

I'm not sure if the exact format you gave was meant to work (a button
press without a button release and no quotes around key sequence).

I'll try myself when I have access to the tablet.

Chris

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH v2] fix filter issue on MT bamboos

2011-04-03 Thread Ping Cheng
Reviewed-by: Ping Cheng pingli...@gmail.com

Ping

On Sun, Apr 3, 2011 at 6:49 AM, ch...@cnpbagwell.com wrote:

 From: Chris Bagwell ch...@cnpbagwell.com

 Init tool device type is needed for all MT devices to do correct
 filtering; not just pen+MT tablets.

 Signed-off-by: Chris Bagwell ch...@cnpbagwell.com
 ---

 Limit init of tool to MT case sinces that function is not ready
 for pad devices and geared towards generic protocol only.

  src/wcmUSB.c |7 ---
  1 files changed, 4 insertions(+), 3 deletions(-)

 diff --git a/src/wcmUSB.c b/src/wcmUSB.c
 index d8bd404..bc2d16a 100644
 --- a/src/wcmUSB.c
 +++ b/src/wcmUSB.c
 @@ -1412,11 +1412,12 @@ static void usbDispatchEvents(InputInfoPtr pInfo)

DBG(6, common, %d events received\n, private-wcmEventCnt);

 -   if (private-wcmPenTouch)
 -   {
 +   if (private-wcmUseMT)
private-wcmDeviceType = usbInitToolType(private-wcmEvents,
 -   private-wcmEventCnt);
 +
  private-wcmEventCnt);

 +   if (private-wcmPenTouch)
 +   {
/* We get both pen and touch data from the kernel when they
 * both are in/down. So, if we were (hence the need of
 dslast)
 * processing pen events, we should ignore touch events.
 --
 1.7.3.4



 --
 Create and publish websites with WebMatrix
 Use the most popular FREE web apps or write code yourself;
 WebMatrix provides all the features you need to develop and
 publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
 ___
 Linuxwacom-devel mailing list
 Linuxwacom-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH 0/3 v2] Centralize arbitration

2011-04-03 Thread Ping Cheng
Patch 1 is unchanged. Resend it with the group to make sure it gets merged;
Patches 2 and 3 are updated with Peter's comments.

Ping Cheng (3):
  Check predefined serial number as early as we can
  Add IsPen to cover both IsStylus and IsEraser
  Centralize pen and touch arbitration

 src/wcmCommon.c |   48 +---
 src/wcmConfig.c |   51 +++
 src/xf86Wacom.c |   43 +++
 src/xf86WacomDefs.h |5 +
 4 files changed, 120 insertions(+), 27 deletions(-)

-- 
1.7.4


--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH 1/3] Check predefined serial number as early as we can

2011-04-03 Thread Ping Cheng
Don't wait before we can post the events. Verify the serial number
as soon as the information is accessible.

Signed-off-by: Ping Cheng pingli...@gmail.com
---
 src/wcmCommon.c |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 338bc9a..106b741 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -662,14 +662,6 @@ void wcmSendEvents(InputInfoPtr pInfo, const 
WacomDeviceState* ds)
int v3, v4, v5;
int valuators[priv-naxes];
 
-   if (priv-serial  serial != priv-serial)
-   {
-   DBG(10, priv, serial number
-is %u but your system configured %u, 
-   serial, (int)priv-serial);
-   return;
-   }
-
/* don't move the cursor when going out-prox */
if (!ds-proximity)
{
@@ -1138,6 +1130,14 @@ static void commonDispatchDevice(WacomCommonPtr common, 
unsigned int channel,
/* Device transformations come first */
priv = pInfo-private;
 
+   if (priv-serial  filtered.serial_num != priv-serial)
+   {
+   DBG(10, priv, serial number
+is %u but your system configured %u, 
+   filtered.serial_num, priv-serial);
+   return;
+   }
+
/* send a touch out for USB Tablet PCs */
if (IsUSBDevice(common)  !IsTouch(priv)
 common-wcmTouchDefault  !priv-oldProximity)
-- 
1.7.4


--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH 2/3 v2] Add IsPen to cover both IsStylus and IsEraser

2011-04-03 Thread Ping Cheng
It will be used more often when we need to compare touch events
with pen events.

Signed-off-by: Ping Cheng pingli...@gmail.com
---
Changes in v2: use IsStylus and IsEraser instead of checking on
the flags directly.

 src/wcmCommon.c |2 +-
 src/xf86WacomDefs.h |1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index 106b741..a370389 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -1164,7 +1164,7 @@ static void commonDispatchDevice(WacomCommonPtr common, 
unsigned int channel,
}
}
 
-   if (IsStylus(priv) || IsEraser(priv))
+   if (IsPen(priv))
{
priv-minPressure = rebasePressure(priv, filtered);
filtered.pressure = normalizePressure(priv, filtered);
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 7740820..93debca 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -184,6 +184,7 @@ struct _WacomModel
 #define IsTouch(priv)  (DEVICE_ID((priv)-flags) == TOUCH_ID)
 #define IsEraser(priv) (DEVICE_ID((priv)-flags) == ERASER_ID)
 #define IsPad(priv)(DEVICE_ID((priv)-flags) == PAD_ID)
+#define IsPen(priv)(IsStylus(priv) || IsEraser(priv))
 
 #define IsUSBDevice(common) ((common)-wcmDevCls == gWacomUSBDevice)
 
-- 
1.7.4


--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH 3/3 v2] Centralize pen and touch arbitration

2011-04-03 Thread Ping Cheng
With the introduction of multi-touch, the chances of getting touch
events while pen is in prox have been increased. One obvious use
case is that the touch events could be used for gestures while pen
is in prox. However, we do not want two cursors compete on the screen.

Link the pen and touch device once during the initialization stage
instead of every time when we receive a pen event. Then, centralize
pen and touch arbitration process so we can store the touch data in
wcmUSB.c instead of discarding them. The touch events will only be
ignored if it is a single touch event that causes a cursor movement
while pen is in prox.

Some cleanup in wcmUSB.c is needed. It will be considered when we
make MAX_CHANNEL a dynamic value based on MAX_FINGERS. The
MAX_FINGERS is going to be the maximum of ABS_MT_SLOT that we
retrieve from the kernel. That brings us to the state to support
XInput 2.1 and devices that have dynamic number of fingers.

Note: this patch is based on the assumption that all devices
connected to the same system have unique product IDs. That is,
no two or more identical devices are connected. Identical devices
will be properly linked when we find a decent way to distinguish
them in the driver.

Signed-off-by: Ping Cheng pingli...@gmail.com
---
Changes in v2: unlink touch and pen when at least one of them
is disabled; fixed an if-statement in ignoring touch when pen is
in prox; and a few coding style suggestions made by Peter.

 src/wcmCommon.c |   32 +---
 src/wcmConfig.c |   51 +++
 src/xf86Wacom.c |   43 +++
 src/xf86WacomDefs.h |4 
 4 files changed, 111 insertions(+), 19 deletions(-)

diff --git a/src/wcmCommon.c b/src/wcmCommon.c
index a370389..fff5a08 100644
--- a/src/wcmCommon.c
+++ b/src/wcmCommon.c
@@ -1138,30 +1138,23 @@ static void commonDispatchDevice(WacomCommonPtr common, 
unsigned int channel,
return;
}
 
-   /* send a touch out for USB Tablet PCs */
-   if (IsUSBDevice(common)  !IsTouch(priv)
-common-wcmTouchDefault  !priv-oldProximity)
+   if (TabletHasFeature(common, WCM_PENTOUCH))
{
-   InputInfoPtr device = xf86FirstLocalDevice();
-   WacomCommonPtr tempcommon = NULL;
-   WacomDevicePtr temppriv = NULL;
-
-   /* Lookup to see if associated touch was enabled */
-   for (; device != NULL; device = device-next)
+   if (IsPen(priv))
{
-   if (strstr(device-drv-driverName, wacom))
+   /* send touch out when pen coming in-prox for devices
+* that provideboth pen and touch events so system
+* cursor won't jump between tools.
+*/
+   if (common-wcmTouchDevice-oldProximity)
{
-   temppriv = (WacomDevicePtr) device-private;
-   tempcommon = temppriv-common;
-
-   if ((tempcommon-tablet_id == 
common-tablet_id) 
-   IsTouch(temppriv)  
temppriv-oldProximity)
-   {
-   /* Send soft prox-out for touch first */
-   wcmSoftOutEvent(device);
-   }
+   wcmSoftOutEvent(common-wcmTouchDevice-pInfo);
+   return;
}
}
+   else if (IsTouch(priv)  common-wcmPenInProx)
+   /* Ignore touch events when pen is in prox */
+   return;
}
 
if (IsPen(priv))
@@ -1170,6 +1163,7 @@ static void commonDispatchDevice(WacomCommonPtr common, 
unsigned int channel,
filtered.pressure = normalizePressure(priv, filtered);
filtered.buttons = setPressureButton(priv, filtered);
filtered.pressure = applyPressureCurve(priv,filtered);
+   common-wcmPenInProx = filtered.proximity;
}
 
else if (IsCursor(priv)  !priv-oldCursorHwProx)
diff --git a/src/wcmConfig.c b/src/wcmConfig.c
index 6235d3c..f989fb0 100644
--- a/src/wcmConfig.c
+++ b/src/wcmConfig.c
@@ -397,6 +397,51 @@ wcmInitModel(InputInfoPtr pInfo)
return TRUE;
 }
 
+/**
+ * Link the touch tool to the pen of the same device
+ * so we can arbitrate the events when posting them.
+ */
+static void wcmLinkTouchAndPen(InputInfoPtr pInfo)
+{
+   WacomDevicePtr priv = pInfo-private;
+   WacomCommonPtr common = priv-common;
+   InputInfoPtr device = xf86FirstLocalDevice();
+   WacomCommonPtr tmpcommon = NULL;
+   WacomDevicePtr tmppriv = NULL;
+   Bool touch_device_assigned = FALSE;
+
+   /* Lookup to find the associated 

Re: [Linuxwacom-devel] [PATCH] ISDV4: work around Levono X200/X201 pressure issues

2011-04-03 Thread Peter Hutterer
On Sat, Apr 02, 2011 at 09:14:50AM -0500, ch...@cnpbagwell.com wrote:
 From: Chris Bagwell ch...@cnpbagwell.com
 
 As reported on mailing list and bug tracker #3008864, some
 Levono tablets pressure is not working right.  Some people
 notice as getting max pressure while pressing lightly and
 others report as pressure curve not working.
 
 The basic issue is hardware is reporting maximum pressure of
 127 but returning 254 values.  This throws off normalization
 and pressure curves both.
 
 Adjust dynamically when higher pressure values are seen so
 that we do not need to maintain a quirks list of hardware.
 Kernel driver would need quirks list.
 
 Signed-off-by: Chris Bagwell ch...@cnpbagwell.com
 ---
 
 This is RFC patch.
 
 The concept has been tested by user on mailing list hard coding
 pressure to 254 but this tries to do it dynamically so it can
 ship with xf86-input-wacom.
 
 Another option is to add list on wiki of problem hardware and
 explain how to edit config file and for MaxZ to 254 for stylus
 and eraser.

can we detect this tablet and put a quirk in? any hardware string we can go
by?

as-is, this patch is quite iffy. we can't guarantee that other tablets
have 127 as the correct maximum and are affected by this. Nonetheless,
growing the pressure range if the reported value is higher than the max
value seems like a good approach.

Cheers,
  Peter
 
  src/wcmISDV4.c |   17 +
  1 files changed, 17 insertions(+), 0 deletions(-)
 
 diff --git a/src/wcmISDV4.c b/src/wcmISDV4.c
 index db0d83e..c81f2d5 100644
 --- a/src/wcmISDV4.c
 +++ b/src/wcmISDV4.c
 @@ -721,6 +721,23 @@ static int isdv4Parse(InputInfoPtr pInfo, const unsigned 
 char* data, int len)
   /* pressure */
   ds-pressure = coord.pressure;
  
 + /* Work around issue with Levono tablets reporting
 +  * max pressure of 127 but returning higher values.
 +  */
 + if (coord.pressure  common-wcmMaxZ)
 + {
 + /* For sepecific Levono issues, we can jump straight
 +  * to real max pressure. If higher resolution tablets
 +  * have same issue, slowly adjust.
 +  */
 + if (common-wcmMaxZ == 127)
 + common-wcmMaxZ = 254;
 + else
 + common-wcmMaxZ = coord.pressure;
 + DBG(2, priv, pressure higher than maxZ sent. 
 + new maxZ=%d, common-wcmMaxZ);
 + }
 +
   /* buttons */
   ds-buttons = coord.tip | (coord.side  1) | (coord.eraser  
 2);
  
 -- 
 1.7.4.2

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH 7/7] Fix get_map to return proper wheel/strip button number

2011-04-03 Thread Peter Hutterer
On Fri, Apr 01, 2011 at 12:02:12PM -0700, Jason Gerecke wrote:
 On Thu, Mar 31, 2011 at 9:28 PM, Peter Hutterer
 peter.hutte...@who-t.net wrote:
  On Thu, Mar 31, 2011 at 12:07:32AM -0700, Jason Gerecke wrote:
  On Wed, Mar 30, 2011 at 9:20 PM, Peter Hutterer
  peter.hutte...@who-t.net wrote:
   On Wed, Mar 30, 2011 at 01:54:47PM -0700, Jason Gerecke wrote:
   Adding to the only-kinda-hackish use of XGetDeviceButtonMapping,
   in get_map, this total hackjob of a patch fixes the problem with
   us having no way of knowing the driver's defaults for wheels and
   strips.
  
   Thankfully, the defaults aren't changing anytime soon so its
   not likely to break. Additionally, once the raw button path is
   removed from the driver, the entire 'get_map' function can go
   the way of the dodo.
  
   This seems to solve the wrong problem. How about we decide that xsetwacom
   controls the physical buttons on the device? That way, anyone wanting to
   configure logical mapping can use the X tools and xsetwacom is
   driver-specific and stays (documented so!) driver-specific. which of 
   course
   also means we need to check that the Button xorg.conf option does the 
   right
   thing.
  
  That would make a number of things easier, but also comes with its own
  drawbacks. I think we should probably figure out where hassle,
  correctness, and compatibility collide first.
 
  just checked the man page again:
 
  Option ButtonM AC
    reports  an  action  AC when button M is pressed,  where M is one of the
    device supported  button numbers,  it can be 1 to 32. Wacom uses a
    driver-internal button mapping, where any physical button appears to the
    X server as  the button specified by the ButtonM mapping. Hence, if two
    physical buttons have the same ButtonM mapping, the server will think
    they are the same physical button.  The default action reported to the X
    server is mouse button M click. Because X uses buttons 4, 5, 6, and 7 as
    the four scrolling directions, physical buttons 4 and higher are mapped
    to 8 and higher by default.  To ignore the button click, i.e.,  to  not
    report  any  button click event to the X server,  use 0 or button 0.
 
  so at least for the xorg.conf option, we already say that this is the
  _physical_ button mapping. I guess it makes sense then to have xsetwacom do
  the same on the physical buttons and leave the X specific stuff up to the X
  tools.
 
  Cheers,
   Peter
 
 And xsetwacom's man page is wholly silent on just what its version 'M'
 is, so deferring to the existing docs would make sense.
 
 Of course, despite the lack of official documentation, its expected
 by users familiar with xsetwacom that it use the X button number.
 Don't get me wrong -- I'd love to see the change. I just hate breaking
 things for our users/customers without good cause. :) Then again, we
 already broke compatibility in the last release, so...

when things are broken, it's better to fix them as soon as possible than
dragging them out. I'm not sure how many users we have that rely on a
specific behaviour of xsetwacom but I've stated repeatedly that it's not to
be relied upon, especially not until we've called the driver stable.

Cheers,
  Peter

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH] allow more than 3 buttons

2011-04-03 Thread Chris Bagwell
On Sun, Apr 3, 2011 at 6:06 PM, Peter Hutterer peter.hutte...@who-t.net wrote:
 On Sat, Apr 02, 2011 at 06:46:18PM -0500, ch...@cnpbagwell.com wrote:
 From: Chris Bagwell ch...@cnpbagwell.com

 Made check be based on # of bits and not on # of bytes.
 Maybe there is a macro that already does this type math?

 yep, there is. bits_to_bytes() in misc.h

Its not installed on my system.  Is it only visible from xorg server checkout?

Chris


 Cheers,
  Peter


 Signed-off-by: Chris Bagwell ch...@cnpbagwell.com
 ---
  src/wcmUSB.c |    2 +-
  1 files changed, 1 insertions(+), 1 deletions(-)

 diff --git a/src/wcmUSB.c b/src/wcmUSB.c
 index 81af067..d8bd404 100644
 --- a/src/wcmUSB.c
 +++ b/src/wcmUSB.c
 @@ -1053,7 +1053,7 @@ static int mod_buttons(int buttons, int btn, int state)
  {
       int mask;

 -     if (btn = sizeof(int))
 +     if (btn = sizeof(int)*8)
       {
               xf86Msg(X_ERROR, %s: Invalid button number %d. Insufficient 
                               storage\n, __func__, btn);
 --
 1.7.3.4


 --
 Create and publish websites with WebMatrix
 Use the most popular FREE web apps or write code yourself;
 WebMatrix provides all the features you need to develop and
 publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
 ___
 Linuxwacom-devel mailing list
 Linuxwacom-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel



--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH] Update all tools rotation property when rotating one of them.

2011-04-03 Thread Peter Hutterer
All tools on the same tablet share the rotation value, so if one of them is
rotated, all of them must be. Since the property value is stored in the
server, we need to trigger it explicitly.

Test case:
$ xsetwacom set device name stylus Rotate half
$ xsetwacom get device name eraser Rotate

Should print out the correct rotation value.

Fixes #3070450

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/wcmXCommand.c |   30 ++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 64ebb8d..9e0b1e8 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -540,6 +540,33 @@ static int wcmSetStripProperty(DeviceIntPtr dev, Atom 
property,
 }
 
 /**
+ * Update the rotation property for all tools on the same physical tablet as
+ * pInfo.
+ */
+static void wcmUpdateRotationProperty(WacomDevicePtr priv)
+{
+   WacomCommonPtr common = priv-common;
+   WacomDevicePtr other;
+   char rotation = common-wcmRotate;
+
+   for (other = common-wcmDevices; other; other = other-next)
+   {
+   InputInfoPtr pInfo;
+   DeviceIntPtr dev;
+
+   if (other == priv)
+   continue;
+
+   pInfo = other-pInfo;
+   dev = pInfo-dev;
+
+   XIChangeDeviceProperty(dev, prop_rotation, XA_INTEGER, 8,
+  PropModeReplace, 1, rotation,
+  TRUE);
+   }
+}
+
+/**
  * Only allow deletion of a property if it is not being used by any of the
  * button actions.
  */
@@ -643,7 +670,10 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
XIPropertyValuePtr prop,
return BadValue;
 
if (!checkonly  common-wcmRotate != value)
+   {
wcmRotateTablet(pInfo, value);
+   wcmUpdateRotationProperty(priv);
+   }
} else if (property == prop_serials)
{
return BadValue; /* Read-only */
-- 
1.7.4.2


--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH 3/3 v2] Centralize pen and touch arbitration

2011-04-03 Thread Peter Hutterer
On Sun, Apr 03, 2011 at 04:07:38PM -0700, Ping Cheng wrote:
 With the introduction of multi-touch, the chances of getting touch
 events while pen is in prox have been increased. One obvious use
 case is that the touch events could be used for gestures while pen
 is in prox. However, we do not want two cursors compete on the screen.
 
 Link the pen and touch device once during the initialization stage
 instead of every time when we receive a pen event. Then, centralize
 pen and touch arbitration process so we can store the touch data in
 wcmUSB.c instead of discarding them. The touch events will only be
 ignored if it is a single touch event that causes a cursor movement
 while pen is in prox.
 
 Some cleanup in wcmUSB.c is needed. It will be considered when we
 make MAX_CHANNEL a dynamic value based on MAX_FINGERS. The
 MAX_FINGERS is going to be the maximum of ABS_MT_SLOT that we
 retrieve from the kernel. That brings us to the state to support
 XInput 2.1 and devices that have dynamic number of fingers.
 
 Note: this patch is based on the assumption that all devices
 connected to the same system have unique product IDs. That is,
 no two or more identical devices are connected. Identical devices
 will be properly linked when we find a decent way to distinguish
 them in the driver.
 
 Signed-off-by: Ping Cheng pingli...@gmail.com
 ---
 Changes in v2: unlink touch and pen when at least one of them
 is disabled; fixed an if-statement in ignoring touch when pen is
 in prox; and a few coding style suggestions made by Peter.

both applied, thanks.

Cheers,
  Peter

 
  src/wcmCommon.c |   32 +---
  src/wcmConfig.c |   51 
 +++
  src/xf86Wacom.c |   43 +++
  src/xf86WacomDefs.h |4 
  4 files changed, 111 insertions(+), 19 deletions(-)
 
 diff --git a/src/wcmCommon.c b/src/wcmCommon.c
 index a370389..fff5a08 100644
 --- a/src/wcmCommon.c
 +++ b/src/wcmCommon.c
 @@ -1138,30 +1138,23 @@ static void commonDispatchDevice(WacomCommonPtr 
 common, unsigned int channel,
   return;
   }
  
 - /* send a touch out for USB Tablet PCs */
 - if (IsUSBDevice(common)  !IsTouch(priv)
 -  common-wcmTouchDefault  !priv-oldProximity)
 + if (TabletHasFeature(common, WCM_PENTOUCH))
   {
 - InputInfoPtr device = xf86FirstLocalDevice();
 - WacomCommonPtr tempcommon = NULL;
 - WacomDevicePtr temppriv = NULL;
 -
 - /* Lookup to see if associated touch was enabled */
 - for (; device != NULL; device = device-next)
 + if (IsPen(priv))
   {
 - if (strstr(device-drv-driverName, wacom))
 + /* send touch out when pen coming in-prox for devices
 +  * that provideboth pen and touch events so system
 +  * cursor won't jump between tools.
 +  */
 + if (common-wcmTouchDevice-oldProximity)
   {
 - temppriv = (WacomDevicePtr) device-private;
 - tempcommon = temppriv-common;
 -
 - if ((tempcommon-tablet_id == 
 common-tablet_id) 
 - IsTouch(temppriv)  
 temppriv-oldProximity)
 - {
 - /* Send soft prox-out for touch first */
 - wcmSoftOutEvent(device);
 - }
 + wcmSoftOutEvent(common-wcmTouchDevice-pInfo);
 + return;
   }
   }
 + else if (IsTouch(priv)  common-wcmPenInProx)
 + /* Ignore touch events when pen is in prox */
 + return;
   }
  
   if (IsPen(priv))
 @@ -1170,6 +1163,7 @@ static void commonDispatchDevice(WacomCommonPtr common, 
 unsigned int channel,
   filtered.pressure = normalizePressure(priv, filtered);
   filtered.buttons = setPressureButton(priv, filtered);
   filtered.pressure = applyPressureCurve(priv,filtered);
 + common-wcmPenInProx = filtered.proximity;
   }
  
   else if (IsCursor(priv)  !priv-oldCursorHwProx)
 diff --git a/src/wcmConfig.c b/src/wcmConfig.c
 index 6235d3c..f989fb0 100644
 --- a/src/wcmConfig.c
 +++ b/src/wcmConfig.c
 @@ -397,6 +397,51 @@ wcmInitModel(InputInfoPtr pInfo)
   return TRUE;
  }
  
 +/**
 + * Link the touch tool to the pen of the same device
 + * so we can arbitrate the events when posting them.
 + */
 +static void wcmLinkTouchAndPen(InputInfoPtr pInfo)
 +{
 + WacomDevicePtr priv = pInfo-private;
 + WacomCommonPtr common = priv-common;
 + InputInfoPtr device = xf86FirstLocalDevice();
 + WacomCommonPtr tmpcommon = NULL;
 + 

Re: [Linuxwacom-devel] [PATCH 3/3] Centralize pen and touch arbitration

2011-04-03 Thread Peter Hutterer
On Thu, Mar 31, 2011 at 11:13:36PM -0700, Ping Cheng wrote:
 On Thu, Mar 31, 2011 at 10:57 PM, Peter Hutterer
 peter.hutte...@who-t.netwrote:
 
  On Thu, Mar 31, 2011 at 10:37:54PM -0700, Ping Cheng wrote:
   On Thu, Mar 31, 2011 at 4:43 PM, Peter Hutterer 
  peter.hutte...@who-t.netwrote:
  
   /* FIXME: why strstr and not strcmp? */
if (!strstr(device-drv-driverName, wacom))
continue;
   
  
   I guess, the intention was to allow driverName has extra characters
  instead
   of exact wacom. As long as it has wacom in it, we take care of it.
  Not
   sure if it is necessary though.
 
  I'd rather be precise on the match. I don't think anyone has a driver that
  could possibly conflict but substring matches have a nasty habit of finding
  things humans don't necessarily see.
 
would it make sense to have them share the common struct once we've
  linked
them?
   
  
   It makes sense. One issue, even with the current code, is how to tell the
   difference between two identical tablets in the driver. How do we know if
  we
   are linking the proper devices together?
  
   So far, I assume all devices attached to the same system have different
   product IDs.
 
  maybe we need an Option Uniq then to let the user associate the devices?
 
 
 What information can the user use for Uniq to associate the devices, which
 we do not have in the driver? Both devices have the same product ID and
 name.

I only have one Bamboo, but the test code below gives me the right answer.
argv[1,2] are the two device nodes (/dev/input/eventX and /dev/input/eventY).

static struct udev_device *udev_from_file(struct udev *udev, const char 
*filename)
{
struct stat st;
stat(filename, st);
return udev_device_new_from_devnum(udev, 'c', st.st_rdev);
}

int main(int argc, char** argv)
{
int rc = 1;
struct udev *udev = NULL;
struct udev_device *dev1, *dev2 = NULL;
struct udev_device *parent1, *parent2;
const char *syspath1, *syspath2;

if (argc  3)
goto out;

udev = udev_new();
dev1 = udev_from_file(udev, argv[1]);
dev2 = udev_from_file(udev, argv[2]);

if (!dev1 || !dev2)
goto out;

parent1 = udev_device_get_parent_with_subsystem_devtype(dev1, usb, 
usb_device);
parent2 = udev_device_get_parent_with_subsystem_devtype(dev2, usb, 
usb_device);

syspath1 = udev_device_get_syspath(parent1);
syspath2 = udev_device_get_syspath(parent2);

if (strcmp(syspath1, syspath2) == 0)
printf(Yep, they're the same physical device\n);
else
printf(Nope, different devices\n);

out:
udev_device_unref(dev1);
udev_device_unref(dev2);
udev_unref(udev);
return rc;
}

Cheers,
  Peter

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH] Only update bottomX/bottomY if they haven't been user-configured.

2011-04-03 Thread Peter Hutterer
wcmInitialToolSize() would xorg-configured overwrite BottomX/Y with the max
values read from the tablet. Only set the two if they are non-zero (0 is the
default value).

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 src/xf86Wacom.c |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index 6545c90..58d5394 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -129,8 +129,10 @@ static void wcmInitialToolSize(InputInfoPtr pInfo)
priv-resolY = common-wcmResolY;
}
 
-   priv-bottomX = priv-maxX;
-   priv-bottomY = priv-maxY;
+   if (!priv-bottomX)
+   priv-bottomX = priv-maxX;
+   if (!priv-bottomY)
+   priv-bottomY = priv-maxY;
 
return;
 }
-- 
1.7.4.2


--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH 3/3] Centralize pen and touch arbitration

2011-04-03 Thread Ping Cheng
On Sun, Apr 3, 2011 at 6:35 PM, Peter Hutterer peter.hutte...@who-t.netwrote:

  
  What information can the user use for Uniq to associate the devices,
 which
  we do not have in the driver? Both devices have the same product ID and
  name.

 I only have one Bamboo, but the test code below gives me the right answer.
 argv[1,2] are the two device nodes (/dev/input/eventX and
 /dev/input/eventY).

 static struct udev_device *udev_from_file(struct udev *udev, const char
 *filename)
 {
struct stat st;
stat(filename, st);
return udev_device_new_from_devnum(udev, 'c', st.st_rdev);
 }

 int main(int argc, char** argv)
 {
int rc = 1;
struct udev *udev = NULL;
struct udev_device *dev1, *dev2 = NULL;
struct udev_device *parent1, *parent2;
const char *syspath1, *syspath2;

if (argc  3)
goto out;

udev = udev_new();
dev1 = udev_from_file(udev, argv[1]);
dev2 = udev_from_file(udev, argv[2]);

if (!dev1 || !dev2)
goto out;

parent1 = udev_device_get_parent_with_subsystem_devtype(dev1, usb,
 usb_device);
parent2 = udev_device_get_parent_with_subsystem_devtype(dev2, usb,
 usb_device);

syspath1 = udev_device_get_syspath(parent1);
syspath2 = udev_device_get_syspath(parent2);



This looks very promising. So, we do not need anything from the user.
Everything could be done inside the driver. Are you going to make a patch?

Thank you for the info.

Ping


   if (strcmp(syspath1, syspath2) == 0)
printf(Yep, they're the same physical device\n);
else
printf(Nope, different devices\n);

 out:
udev_device_unref(dev1);
udev_device_unref(dev2);
udev_unref(udev);
return rc;
 }

 Cheers,
  Peter

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH 3/3] Centralize pen and touch arbitration

2011-04-03 Thread Peter Hutterer
On Sun, Apr 03, 2011 at 07:23:34PM -0700, Ping Cheng wrote:
 On Sun, Apr 3, 2011 at 6:35 PM, Peter Hutterer 
 peter.hutte...@who-t.netwrote:
 
   
   What information can the user use for Uniq to associate the devices,
  which
   we do not have in the driver? Both devices have the same product ID and
   name.
 
  I only have one Bamboo, but the test code below gives me the right answer.
  argv[1,2] are the two device nodes (/dev/input/eventX and
  /dev/input/eventY).
 
  static struct udev_device *udev_from_file(struct udev *udev, const char
  *filename)
  {
 struct stat st;
 stat(filename, st);
 return udev_device_new_from_devnum(udev, 'c', st.st_rdev);
  }
 
  int main(int argc, char** argv)
  {
 int rc = 1;
 struct udev *udev = NULL;
 struct udev_device *dev1, *dev2 = NULL;
 struct udev_device *parent1, *parent2;
 const char *syspath1, *syspath2;
 
 if (argc  3)
 goto out;
 
 udev = udev_new();
 dev1 = udev_from_file(udev, argv[1]);
 dev2 = udev_from_file(udev, argv[2]);
 
 if (!dev1 || !dev2)
 goto out;
 
 parent1 = udev_device_get_parent_with_subsystem_devtype(dev1, usb,
  usb_device);
 parent2 = udev_device_get_parent_with_subsystem_devtype(dev2, usb,
  usb_device);
 
 syspath1 = udev_device_get_syspath(parent1);
 syspath2 = udev_device_get_syspath(parent2);
 
 
 
 This looks very promising. So, we do not need anything from the user.
 Everything could be done inside the driver. Are you going to make a patch?

can't right now, got too many other things on my slate, sorry.

Cheers,
  Peter


--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [linuxwacom-announce] [ANNOUNCE] xf86-input-wacom 0.10.99.1

2011-04-03 Thread Peter Hutterer
On Sun, Apr 03, 2011 at 11:45:20AM +0200, Andrzej Giniewicz wrote:
 On Sun, Apr 3, 2011 at 1:57 AM, Chris Bagwell ch...@cnpbagwell.com wrote:
  OK, found and emailed patches to fix those two issues.
 
  I know your much better then me at testing so if you get bored, please
  apply those to 0.10.11 or git and see what else you find.
 
 I applied on top of 0.10.99.1 (I actually applied second one already
 with the line added by Ping in his reply). Now all 4 buttons on pad
 work, also pointer reacts to touch. For now I found that it's now
 impossible to revert the scroll directions like I did before. In both
 cases when I have:
 
 [giniu@raven3 ~]$ xsetwacom get Wacom Bamboo 2FG 4x5 Finger touch Button 4
 button +4
 [giniu@raven3 ~]$ xsetwacom get Wacom Bamboo 2FG 4x5 Finger touch Button 5
 button +5
 
 or
 
 [giniu@raven3 ~]$ xsetwacom get Wacom Bamboo 2FG 4x5 Finger touch Button 4
 button +5
 [giniu@raven3 ~]$ xsetwacom get Wacom Bamboo 2FG 4x5 Finger touch Button 5
 button +4
 
 when I scroll down touch generates button 4 and scroll up generates
 button 5. Ability to revert scrolls was removed on purpose or maybe
 the way to do it changed?

are you scrolling through gestures? afaict the scrolling code is hardcoded
to use 4/5 6/7 instead of the button mapping.

Cheers,
  Peter

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH 5/7] Decrease minimum number of args to 'set' [allow wheels/strips reset]

2011-04-03 Thread Peter Hutterer
On Fri, Apr 01, 2011 at 11:17:15AM -0700, Jason Gerecke wrote:
 On Thu, Mar 31, 2011 at 9:21 PM, Peter Hutterer
 peter.hutte...@who-t.net wrote:
  On Wed, Mar 30, 2011 at 11:51:22PM -0700, Jason Gerecke wrote:
  On Wed, Mar 30, 2011 at 9:04 PM, Peter Hutterer
  peter.hutte...@who-t.net wrote:
   On Wed, Mar 30, 2011 at 01:54:45PM -0700, Jason Gerecke wrote:
   Since the worker functions now check that they have the appropriate
   number of arguments, its possible to decrease the number of arguments
   required by 'set'. Since all it really needs is a device number and
   a property, the minimum argc is now 2.
  
   A handy side-effect of this change is that its now possible to run
   e.g. `xsetwacom --set $ID StripLeftDown` to reset the action to
   its default.
  
   is that because we delete the property then so it falls back to using the
   button mapping?
  
  Correct.
 
   this formulation is a bit unfortunate, since it doesn't actually set to 
   the
   default. if I map the button to say 8, then run the above command it 
   would
   revert back to 8, not to the default (4 or whatever it is), right?
  
   Cheers,
    Peter
  
  I'm not quite sure what you mean here. If no action has been defined,
  the driver falls back to its predefined button. If you run e.g.
  `xsetwacom --set $ID LeftStripUp 8`, the action button +8 is
  assigned (because of parse_action's simple button handling). When you
  move your finger along the strip, the driver notices an action has
  been set and will send the button 8 event. If you then run `xsetwacom
  --set $ID LeftStripUp` the action is deleted. Moving your finger along
  the strip again, the driver will not find an action and fall back to
  its predefined mapping (which should be button 5)
 
  Where is this 5 coming from? shouldn't this be the equivalent of button
  +5 in the driver?
 
  Cheers,
   Peter
 
 getWheelButton (in wcmCommon.c) is responsible for finding both the
 fakeButton and fakeKey that could be associated with various
 device events. In the case of our hypothetical strip left up, it
 gets the button from 'priv-striplup' and the key from
 'priv-strip_keys[0]'. The former is defined during wcmAllocate and is
 never changed. 

in spirit with the other discussion of allowing physical mappings, this
should probably be adjustable.

 The latter is changed by wcmUpdateButtonKeyActions
 (after a long call chain beginning with wcmSetProperty) whenever X
 detects a change in the WACOM_PROP_STRIPBUTTONS property.
 getWheelButton then returns both of these to sendWheelStripEvents. If
 a key is defined, it will preferentially decode it and send the
 necessary events. Otherwise, it interprets the raw integer fakeButton
 as the X button to send a button press event for.
 
 When xsetwacom is given arguments to StripLeftUp, it converts them
 into an action and modifies the appropriate offset into
 WACOM_PROP_STRIPBUTTONS. When the appropriate motion is made the
 driver notices an action is sent and sends it. When it is run without
 arguments, it clears the offset, so the same motion results in the
 driver not finding an action and sending the default button. Note that
 xsetwacom works the same way for Button X! Running with arguments
 sets an action the driver will preferentially use; running without
 arguments clears the action, forcing the driver to fall back on the
 raw integer defined in the button[] array.

right, so if I understand this correctly, the default button it uses then
is the (essentially hardcoded) striplup value. which brings me back to my
original question: it doesn't reset to the default value but rather removes
the new button mapping.  if you could change striplup, removing a button
mapping would reset to whatever striplup has as current value (and that may
not be the _default_). currently this works, but only because we don't seem
to have a way to change it. it's really just the wording that matters to me
here, even if it appears to be overly anal :)

 The only thing I find a little mystifying is how priv-strip_keys is
 initially set. My first thought was that it was done when the
 properties were first created -- this doesn't look to be true. My
 second thought was that perhaps the entire priv structure was zeroed
 out prior to initialization -- can't find evidence of this either. I
 would think unless strip_keys[] were initialized somewhere it'd be
 filled with random junk, defeating the logic used and resulting in
 completely undefined behavior...

all memory in the wacom driver is calloc'd, which means it's initialized to
0 from the onset.

Cheers,
  Peter

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list

Re: [Linuxwacom-devel] [PATCH 3/3] Centralize pen and touch arbitration

2011-04-03 Thread Ping Cheng
On Sun, Apr 3, 2011 at 7:51 PM, Peter Hutterer peter.hutte...@who-t.netwrote:

 On Sun, Apr 03, 2011 at 07:23:34PM -0700, Ping Cheng wrote:
  On Sun, Apr 3, 2011 at 6:35 PM, Peter Hutterer peter.hutte...@who-t.net
 wrote:
 

What information can the user use for Uniq to associate the devices,
   which
we do not have in the driver? Both devices have the same product ID
 and
name.
  
   I only have one Bamboo, but the test code below gives me the right
 answer.
   argv[1,2] are the two device nodes (/dev/input/eventX and
   /dev/input/eventY).
  
   static struct udev_device *udev_from_file(struct udev *udev, const char
   *filename)
   {
  struct stat st;
  stat(filename, st);
  return udev_device_new_from_devnum(udev, 'c', st.st_rdev);
   }
  
   int main(int argc, char** argv)
   {
  int rc = 1;
  struct udev *udev = NULL;
  struct udev_device *dev1, *dev2 = NULL;
  struct udev_device *parent1, *parent2;
  const char *syspath1, *syspath2;
  
  if (argc  3)
  goto out;
  
  udev = udev_new();
  dev1 = udev_from_file(udev, argv[1]);
  dev2 = udev_from_file(udev, argv[2]);
  
  if (!dev1 || !dev2)
  goto out;
  
  parent1 = udev_device_get_parent_with_subsystem_devtype(dev1, usb,
   usb_device);
  parent2 = udev_device_get_parent_with_subsystem_devtype(dev2, usb,
   usb_device);
  
  syspath1 = udev_device_get_syspath(parent1);
  syspath2 = udev_device_get_syspath(parent2);
  
 
 
  This looks very promising. So, we do not need anything from the user.
  Everything could be done inside the driver. Are you going to make a
 patch?

 can't right now, got too many other things on my slate, sorry.


That's fine. I may be able to get to it after next week.

Can you test the code with two of your Intuos4's? If we get Nope, different
devices for two identical devices, we are ready to move forward. Otherwise,
...

I will not be in the office next whole week. So, I do not have two identical
devices to play with.

Ping
--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [PATCH] Update all tools rotation property when rotating one of them.

2011-04-03 Thread Ping Cheng
On Sun, Apr 3, 2011 at 5:39 PM, Peter Hutterer peter.hutte...@who-t.netwrote:

 All tools on the same tablet share the rotation value, so if one of them is
 rotated, all of them must be. Since the property value is stored in the
 server, we need to trigger it explicitly.

 Test case:
 $ xsetwacom set device name stylus Rotate half
 $ xsetwacom get device name eraser Rotate

 Should print out the correct rotation value.

 Fixes #3070450

 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
 ---
  src/wcmXCommand.c |   30 ++
  1 files changed, 30 insertions(+), 0 deletions(-)

 diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
 index 64ebb8d..9e0b1e8 100644
 --- a/src/wcmXCommand.c
 +++ b/src/wcmXCommand.c
 @@ -540,6 +540,33 @@ static int wcmSetStripProperty(DeviceIntPtr dev, Atom
 property,
  }

  /**
 + * Update the rotation property for all tools on the same physical tablet
 as
 + * pInfo.
 + */
 +static void wcmUpdateRotationProperty(WacomDevicePtr priv)
 +{
 +   WacomCommonPtr common = priv-common;
 +   WacomDevicePtr other;
 +   char rotation = common-wcmRotate;
 +
 +   for (other = common-wcmDevices; other; other = other-next)
 +   {
 +   InputInfoPtr pInfo;
 +   DeviceIntPtr dev;
 +
 +   if (other == priv)
 +   continue;
 +
 +   pInfo = other-pInfo;
 +   dev = pInfo-dev;
 +
 +   XIChangeDeviceProperty(dev, prop_rotation, XA_INTEGER, 8,
 +  PropModeReplace, 1, rotation,
 +  TRUE);
 +   }
 +}
 +
 +/**
  * Only allow deletion of a property if it is not being used by any of the
  * button actions.
  */
 @@ -643,7 +670,10 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property,
 XIPropertyValuePtr prop,
return BadValue;

if (!checkonly  common-wcmRotate != value)
 +   {
wcmRotateTablet(pInfo, value);


My initial thought was that we might be able to merge wcmRotateTablet into
wcmUpdateRotationProperty. When I grep'd wcmRotateTablet, I saw it is also
called by wcmDevInit in xf86Wacom.c.

After looking into the content of wcmRotateTablet, I see the call in
wcmDevInit is unnecessary. So, we could remove the wcmRotateTablet call in
wcmDevInit and merge wcmRotateTablet and wcmUpdateRotationProperty.

However, the commit comments, All tools on the same tablet share the
rotation value, so if one of them is rotated, all of them must be. makes me
think about the wcmRotate in wcmParseOptions (wcmValidateDevice.c). We
either should only allow one tool to set Rotation or need to make sure all
tools on the same tablet are rotated in the same way by xorg.conf.

Ping


 +   wcmUpdateRotationProperty(priv);
 +   }
} else if (property == prop_serials)
{
return BadValue; /* Read-only */
 --
 1.7.4.2



 --
 Create and publish websites with WebMatrix
 Use the most popular FREE web apps or write code yourself;
 WebMatrix provides all the features you need to develop and
 publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
 ___
 Linuxwacom-devel mailing list
 Linuxwacom-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [linuxwacom-announce] [ANNOUNCE] xf86-input-wacom 0.10.99.1

2011-04-03 Thread Andrzej Giniewicz
 are you scrolling through gestures? afaict the scrolling code is hardcoded
 to use 4/5 6/7 instead of the button mapping.

yes, that was of course using gestures. It worked in 0.10.11 so I
believe it was recent change to hardcode it?

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


Re: [Linuxwacom-devel] [linuxwacom-announce] [ANNOUNCE] xf86-input-wacom 0.10.99.1

2011-04-03 Thread Peter Hutterer
On Mon, Apr 04, 2011 at 07:32:44AM +0200, Andrzej Giniewicz wrote:
  are you scrolling through gestures? afaict the scrolling code is hardcoded
  to use 4/5 6/7 instead of the button mapping.
 
 yes, that was of course using gestures. It worked in 0.10.11 so I
 believe it was recent change to hardcode it?

what changed was the way how xsetwacom worked. it used to set the X logical
button mapping but that's not the case anymore for simple button
mappings.

Jason can tell you more but in the meantime xinput set-button-map device
name ... will get you there.

Cheers,
  Peter

--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH 1/4] xsetwacom: constify convert_value_to_user

2011-04-03 Thread Peter Hutterer
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 tools/xsetwacom.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index da2ef08..8e63f01 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -1475,7 +1475,7 @@ error:
  * @param[out] return_value the integer representation of the 'value' parameter
  * @return TRUE if the conversion succeeded, FALSE otherwise
  */
-static Bool convert_value_from_user(param_t *param, char *value, int 
*return_value)
+static Bool convert_value_from_user(const param_t *param, const char *value, 
int *return_value)
 {
if (param-prop_flags  PROP_FLAG_BOOLEAN)
{
-- 
1.7.4.2


--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH 3/4] Revert Correct TPCButton property inversion

2011-04-03 Thread Peter Hutterer
Hover Click and TPCButton are not the same meaning. TPCButton behaviour
is that Hover Click is off and vice versa. Hence the property inversion is
there on purpose.
Add some documentation to make this public.

This reverts commit f1ecd11c619f1f7eb7850dd2fb514307ca1dd1ce.

Conflicts:

src/wcmXCommand.c

Reported-by: Michal Suchanek hramr...@centrum.cz
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 include/wacom-properties.h |3 ++-
 src/wcmXCommand.c  |4 ++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/include/wacom-properties.h b/include/wacom-properties.h
index dfa454d..f0180d5 100644
--- a/include/wacom-properties.h
+++ b/include/wacom-properties.h
@@ -78,7 +78,8 @@
 /* 32 bit, 3 values, zoom, rotate, tap parameters */
 #define WACOM_PROP_GESTURE_PARAMETERS Wacom Touch Gesture Parameters
 
-/* BOOL, 1 value */
+/* BOOL, 1 value,
+   TRUE == hover click is enabled, FALSE == hover click disabled */
 #define WACOM_PROP_HOVER Wacom Hover Click
 
 /* Atom, 1 value, read-only */
diff --git a/src/wcmXCommand.c b/src/wcmXCommand.c
index 64ebb8d..00c6754 100644
--- a/src/wcmXCommand.c
+++ b/src/wcmXCommand.c
@@ -201,7 +201,7 @@ void InitWcmDeviceProperties(InputInfoPtr pInfo)
prop_touch = InitWcmAtom(pInfo-dev, WACOM_PROP_TOUCH, 8, 1, values);
 
if (IsStylus(priv)) {
-   values[0] = common-wcmTPCButton;
+   values[0] = !common-wcmTPCButton;
prop_hover = InitWcmAtom(pInfo-dev, WACOM_PROP_HOVER, 8, 1, 
values);
}
 
@@ -753,7 +753,7 @@ int wcmSetProperty(DeviceIntPtr dev, Atom property, 
XIPropertyValuePtr prop,
return BadMatch;
 
if (!checkonly)
-   common-wcmTPCButton = values[0];
+   common-wcmTPCButton = !values[0];
 #ifdef DEBUG
} else if (property == prop_debuglevels)
{
-- 
1.7.4.2


--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel


[Linuxwacom-devel] [PATCH 4/4] xsetwacom: add PROP_FLAG_INVERTED for Hover Click/TPCButton

2011-04-03 Thread Peter Hutterer
The Hover Click property is inverse to the TPCButton xsetwacom
option/xorg.conf option.

This commit restores the original behaviour for the property as before
f1ecd11c619f1f7eb7850dd2fb514307ca1dd1ce but fixes xsetwacom that users of
xsetwacom won't notice the difference.

Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
 tools/xsetwacom.c |   19 +--
 1 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/tools/xsetwacom.c b/tools/xsetwacom.c
index bd0e61f..8a84e9a 100644
--- a/tools/xsetwacom.c
+++ b/tools/xsetwacom.c
@@ -55,7 +55,8 @@ enum printformat {
 enum prop_flags {
PROP_FLAG_BOOLEAN = 1,
PROP_FLAG_READONLY = 2,
-   PROP_FLAG_WRITEONLY = 4
+   PROP_FLAG_WRITEONLY = 4,
+   PROP_FLAG_INVERTED = 8, /* only valid with PROP_FLAG_BOOLEAN */
 };
 
 
@@ -183,7 +184,7 @@ static param_t parameters[] =
.prop_name = WACOM_PROP_HOVER,
.prop_format = 8,
.prop_offset = 0,
-   .prop_flags = PROP_FLAG_BOOLEAN
+   .prop_flags = PROP_FLAG_BOOLEAN | PROP_FLAG_INVERTED
},
{
.name = Touch,
@@ -1485,6 +1486,9 @@ static Bool convert_value_from_user(const param_t *param, 
const char *value, int
*return_value = 1;
else
return False;
+
+   if (param-prop_flags  PROP_FLAG_INVERTED)
+   *return_value = !(*return_value);
}
else
{
@@ -2390,6 +2394,13 @@ static void test_convert_value_from_user(void)
.prop_flags = PROP_FLAG_BOOLEAN,
};
 
+   param_t test_bool_inverted =
+   {
+   .name = Test,
+   .desc = NOT A REAL PARAMETER,
+   .prop_flags = PROP_FLAG_BOOLEAN | PROP_FLAG_INVERTED,
+   };
+
const char *bool_true[] = { true, TRUE, True, On, on, ON, 
NULL };
const char *bool_false[] = { false, FALSE, False, Off, off, 
OFF, NULL };
const char *bool_garbage[] = { 0, 1,  on, on ,  off,  off, 
NULL};
@@ -2406,6 +2417,10 @@ static void test_convert_value_from_user(void)
_test_conversion(test_bool, bool_true, True, True);
_test_conversion(test_bool, bool_false, True, False);
_test_conversion(test_bool, bool_garbage, False, False);
+
+   _test_conversion(test_bool_inverted, bool_true, True, False);
+   _test_conversion(test_bool_inverted, bool_false, True, True);
+   _test_conversion(test_bool_inverted, bool_garbage, False, False);
 }
 
 
-- 
1.7.4.2


--
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
___
Linuxwacom-devel mailing list
Linuxwacom-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel