[Linuxwacom-devel] [PATCH wdaemon] Add Intuos5 support

2012-08-22 Thread Peter Hutterer
Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
---
Some cleanup would be nice to avoid the conditions, but wdaemon is on
minimal maintainership at this point so I'm too worried about breaking some
other device.

 wacom.c | 89 ++---
 1 file changed, 85 insertions(+), 4 deletions(-)

diff --git a/wacom.c b/wacom.c
index 89f1da6..d71069a 100644
--- a/wacom.c
+++ b/wacom.c
@@ -90,6 +90,10 @@ enum {
INTUOS4L,
WACOM_21UX2,
DTU,
+   INTUOS5S,
+   INTUOS5M,
+   INTUOS5L,
+   INTUOS5_FG,
MAX_TYPE
 };
 
@@ -164,6 +168,12 @@ static struct wacom_features {
{ Wacom Cintiq 21UX2,   87200, 65600, 2047, 63, WACOM_21UX2,0xCC },
{ Wacom DTU1631,34623, 19553, 511,   0, DTU,0xF0 },
{ Wacom DTU2231,47864, 27011, 511,   0, DTU,0xCE },
+   { Wacom Intuos5 touch S Pen,31496, 19685, 2047, 63, INTUOS5S,   
0x26},
+   { Wacom Intuos5 touch S Finger,  4096,  4096,0,  0, INTUOS5_FG, 
0x26},
+   { Wacom Intuos5 touch M Pen,44704, 27940, 2047, 63, INTUOS5M,   
0x27},
+   { Wacom Intuos5 touch M Finger,  4096,  4096,0,  0, INTUOS5_FG, 
0x27},
+   { Wacom Intuos5 touch L Pen,65024, 40640, 2047, 63, INTUOS5L,   
0x28},
+   { Wacom Intuos5 touch L Finger,  4096,  4096,0,  0, INTUOS5_FG, 
0x28},
 };
 #define WACOM_N_TABLETS (sizeof(wacom_features)/sizeof(wacom_features[0]))
 int wacom_check_type(int x)
@@ -185,6 +195,25 @@ static int wacom_set_events(struct uinput_info *info, 
struct uinput_user_dev *de
set_event(info, UI_SET_EVBIT, EV_KEY);
set_event(info, UI_SET_EVBIT, EV_ABS);
 
+   /* touch devices don't have the common features of others */
+   switch(features-type) {
+   case INTUOS5_FG:
+   set_event(info, UI_SET_ABSBIT, ABS_X);
+   set_event(info, UI_SET_ABSBIT, ABS_Y);
+   set_event(info, UI_SET_ABSBIT, ABS_MT_SLOT);
+   set_event(info, UI_SET_ABSBIT, ABS_MT_TOUCH_MAJOR);
+   set_event(info, UI_SET_ABSBIT, ABS_MT_POSITION_X);
+   set_event(info, UI_SET_ABSBIT, ABS_MT_POSITION_Y);
+   set_event(info, UI_SET_ABSBIT, ABS_MT_TRACKING_ID);
+   set_event(info, UI_SET_KEYBIT, BTN_TOOL_FINGER);
+   set_event(info, UI_SET_KEYBIT, BTN_TOOL_DOUBLETAP);
+   set_event(info, UI_SET_KEYBIT, BTN_TOOL_TRIPLETAP);
+   set_event(info, UI_SET_KEYBIT, BTN_TOOL_QUADTAP);
+   set_event(info, UI_SET_KEYBIT, BTN_TOUCH);
+   return 0;
+   }
+
+
set_event(info, UI_SET_KEYBIT, BTN_TOOL_PEN);
set_event(info, UI_SET_KEYBIT, BTN_TOUCH);
set_event(info, UI_SET_KEYBIT, BTN_STYLUS);
@@ -295,6 +324,20 @@ static int wacom_set_events(struct uinput_info *info, 
struct uinput_user_dev *de
set_event(info, UI_SET_KEYBIT, BTN_5);
set_event(info, UI_SET_KEYBIT, BTN_6);
break;
+   case INTUOS5M:
+   case INTUOS5L:
+   set_event(info, UI_SET_KEYBIT, BTN_7);
+   set_event(info, UI_SET_KEYBIT, BTN_8);
+   case INTUOS5S:
+   set_event(info, UI_SET_ABSBIT, ABS_Z);
+   set_event(info, UI_SET_KEYBIT, BTN_0);
+   set_event(info, UI_SET_KEYBIT, BTN_1);
+   set_event(info, UI_SET_KEYBIT, BTN_2);
+   set_event(info, UI_SET_KEYBIT, BTN_3);
+   set_event(info, UI_SET_KEYBIT, BTN_4);
+   set_event(info, UI_SET_KEYBIT, BTN_5);
+   set_event(info, UI_SET_KEYBIT, BTN_6);
+   break;
}
 
set_event(info, UI_SET_EVBIT, EV_KEY);
@@ -310,7 +353,10 @@ static int wacom_set_events(struct uinput_info *info, 
struct uinput_user_dev *de
set_event(info, UI_SET_KEYBIT, BTN_TOOL_RUBBER);
set_event(info, UI_SET_KEYBIT, BTN_TOOL_MOUSE);
set_event(info, UI_SET_KEYBIT, BTN_TOOL_LENS);
-   set_event(info, UI_SET_KEYBIT, BTN_TOOL_FINGER);
+   if (features-type != INTUOS5S 
+   features-type != INTUOS5M 
+   features-type != INTUOS5L)
+   set_event(info, UI_SET_KEYBIT, BTN_TOOL_FINGER);
set_event(info, UI_SET_KEYBIT, BTN_TOUCH);
set_event(info, UI_SET_KEYBIT, BTN_STYLUS);
set_event(info, UI_SET_KEYBIT, BTN_STYLUS2);
@@ -326,13 +372,20 @@ static int wacom_set_events(struct uinput_info *info, 
struct uinput_user_dev *de
set_event(info, UI_SET_KEYBIT, BTN_4);
set_event(info, UI_SET_KEYBIT, BTN_5);
set_event(info, UI_SET_KEYBIT, BTN_6);
-   set_event(info, UI_SET_KEYBIT, BTN_7);
+   if (features-type != INTUOS5S 
+   features-type != INTUOS5M 
+   features-type != INTUOS5L)
+   set_event(info, UI_SET_KEYBIT, BTN_7);
set_event(info, UI_SET_KEYBIT, BTN_MIDDLE);
 
set_event(info, UI_SET_ABSBIT, ABS_X);

Re: [Linuxwacom-devel] [PATCH wdaemon] Add Intuos5 support

2012-08-22 Thread Ping Cheng
Hi Peter,

I guess you didn't plan to only support this version of wdaemon on newer
kernels. Also, there are 5 Intuos5 models. Why do we only support 3 here?
Please see detailed comments inline.

Thanks,

Ping

On Wednesday, August 22, 2012, Peter Hutterer wrote:

 Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
 ---
 Some cleanup would be nice to avoid the conditions, but wdaemon is on
 minimal maintainership at this point so I'm too worried about breaking some
 other device.

  wacom.c | 89
 ++---
  1 file changed, 85 insertions(+), 4 deletions(-)

 diff --git a/wacom.c b/wacom.c
 index 89f1da6..d71069a 100644
 --- a/wacom.c
 +++ b/wacom.c
 @@ -90,6 +90,10 @@ enum {
 INTUOS4L,
 WACOM_21UX2,
 DTU,
 +   INTUOS5S,
 +   INTUOS5M,
 +   INTUOS5L,
 +   INTUOS5_FG,
 MAX_TYPE
  };

 @@ -164,6 +168,12 @@ static struct wacom_features {
 { Wacom Cintiq 21UX2,   87200, 65600, 2047, 63, WACOM_21UX2,0xCC
 },
 { Wacom DTU1631,34623, 19553, 511,   0, DTU,0xF0
 },
 { Wacom DTU2231,47864, 27011, 511,   0, DTU,0xCE
 },
 +   { Wacom Intuos5 touch S Pen,31496, 19685, 2047, 63,
 INTUOS5S,   0x26},
 +   { Wacom Intuos5 touch S Finger,  4096,  4096,0,  0,
 INTUOS5_FG, 0x26},
 +   { Wacom Intuos5 touch M Pen,44704, 27940, 2047, 63,
 INTUOS5M,   0x27},
 +   { Wacom Intuos5 touch M Finger,  4096,  4096,0,  0,
 INTUOS5_FG, 0x27},
 +   { Wacom Intuos5 touch L Pen,65024, 40640, 2047, 63,
 INTUOS5L,   0x28},
 +   { Wacom Intuos5 touch L Finger,  4096,  4096,0,  0,
 INTUOS5_FG, 0x28},


The ones (0x29 and 0x2A) left out are pen only ones. I know quite a
few RHEL6 users don't want to buy pen and touch models since touch is not
supported there yet.


  };
  #define WACOM_N_TABLETS (sizeof(wacom_features)/sizeof(wacom_features[0]))
  int wacom_check_type(int x)
 @@ -185,6 +195,25 @@ static int wacom_set_events(struct uinput_info *info,
 struct uinput_user_dev *de
 set_event(info, UI_SET_EVBIT, EV_KEY);
 set_event(info, UI_SET_EVBIT, EV_ABS);

 +   /* touch devices don't have the common features of others */
 +   switch(features-type) {
 +   case INTUOS5_FG:
 +   set_event(info, UI_SET_ABSBIT, ABS_X);
 +   set_event(info, UI_SET_ABSBIT, ABS_Y);
 +   set_event(info, UI_SET_ABSBIT, ABS_MT_SLOT);
 +   set_event(info, UI_SET_ABSBIT, ABS_MT_TOUCH_MAJOR);
 +   set_event(info, UI_SET_ABSBIT, ABS_MT_POSITION_X);
 +   set_event(info, UI_SET_ABSBIT, ABS_MT_POSITION_Y);
 +   set_event(info, UI_SET_ABSBIT, ABS_MT_TRACKING_ID);
 +   set_event(info, UI_SET_KEYBIT, BTN_TOOL_FINGER);
 +   set_event(info, UI_SET_KEYBIT, BTN_TOOL_DOUBLETAP);
 +   set_event(info, UI_SET_KEYBIT, BTN_TOOL_TRIPLETAP);
 +   set_event(info, UI_SET_KEYBIT, BTN_TOOL_QUADTAP);


If we don't plan to only run this version of wdaemon on newer kernels, a
check for kernel version is needed. Otherwise, this code won't compile on
kernels older than 2.6.36 since some of the bits are undefined there, such
as ABS_MT_SLOT,  ABS_MT_TRACKING_ID, etc.

 +   set_event(info, UI_SET_KEYBIT, BTN_TOUCH);
 +   return 0;
 +   }
 +
 +
 set_event(info, UI_SET_KEYBIT, BTN_TOOL_PEN);
 set_event(info, UI_SET_KEYBIT, BTN_TOUCH);
 set_event(info, UI_SET_KEYBIT, BTN_STYLUS);
 @@ -295,6 +324,20 @@ static int wacom_set_events(struct uinput_info *info,
 struct uinput_user_dev *de
 set_event(info, UI_SET_KEYBIT, BTN_5);
 set_event(info, UI_SET_KEYBIT, BTN_6);
 break;
 +   case INTUOS5M:
 +   case INTUOS5L:
 +   set_event(info, UI_SET_KEYBIT, BTN_7);
 +   set_event(info, UI_SET_KEYBIT, BTN_8);
 +   case INTUOS5S:
 +   set_event(info, UI_SET_ABSBIT, ABS_Z);
 +   set_event(info, UI_SET_KEYBIT, BTN_0);
 +   set_event(info, UI_SET_KEYBIT, BTN_1);
 +   set_event(info, UI_SET_KEYBIT, BTN_2);
 +   set_event(info, UI_SET_KEYBIT, BTN_3);
 +   set_event(info, UI_SET_KEYBIT, BTN_4);
 +   set_event(info, UI_SET_KEYBIT, BTN_5);
 +   set_event(info, UI_SET_KEYBIT, BTN_6);
 +   break;
 }

 set_event(info, UI_SET_EVBIT, EV_KEY);
 @@ -310,7 +353,10 @@ static int wacom_set_events(struct uinput_info *info,
 struct uinput_user_dev *de
 set_event(info, UI_SET_KEYBIT, BTN_TOOL_RUBBER);
 set_event(info, UI_SET_KEYBIT, BTN_TOOL_MOUSE);
 set_event(info, UI_SET_KEYBIT, BTN_TOOL_LENS);
 -   set_event(info, UI_SET_KEYBIT, BTN_TOOL_FINGER);
 +   if (features-type != INTUOS5S 
 +   features-type != INTUOS5M 
 +   features-type != INTUOS5L)
 +   

Re: [Linuxwacom-devel] [PATCH wdaemon] Add Intuos5 support

2012-08-22 Thread Peter Hutterer
On Wed, Aug 22, 2012 at 09:44:54PM -0700, Ping Cheng wrote:
 Hi Peter,
 
 I guess you didn't plan to only support this version of wdaemon on newer
 kernels. 

what I really care about with wdaemon is that it builds on RHEL6 :)
the package is essentially obsolete with 6.2 as we now have the gnome
configuration, but we do still get the odd request in.

 Also, there are 5 Intuos5 models. Why do we only support 3 here?

urgh. because I thought there were only 3, and my quick check on the wacom
site confirmed that... (http://www.wacom.com/en/products/intuos.aspx)
Now that I see the USB IDs in the driver, I see it there are non-touch
enabled small and medium models too. Can you send me the evemu-describe
output for those please?

 Please see detailed comments inline.
 
 Thanks,
 
 Ping
 
 On Wednesday, August 22, 2012, Peter Hutterer wrote:
 
  Signed-off-by: Peter Hutterer peter.hutte...@who-t.net
  ---
  Some cleanup would be nice to avoid the conditions, but wdaemon is on
  minimal maintainership at this point so I'm too worried about breaking some
  other device.
 
   wacom.c | 89
  ++---
   1 file changed, 85 insertions(+), 4 deletions(-)
 
  diff --git a/wacom.c b/wacom.c
  index 89f1da6..d71069a 100644
  --- a/wacom.c
  +++ b/wacom.c
  @@ -90,6 +90,10 @@ enum {
  INTUOS4L,
  WACOM_21UX2,
  DTU,
  +   INTUOS5S,
  +   INTUOS5M,
  +   INTUOS5L,
  +   INTUOS5_FG,
  MAX_TYPE
   };
 
  @@ -164,6 +168,12 @@ static struct wacom_features {
  { Wacom Cintiq 21UX2,   87200, 65600, 2047, 63, WACOM_21UX2,0xCC
  },
  { Wacom DTU1631,34623, 19553, 511,   0, DTU,0xF0
  },
  { Wacom DTU2231,47864, 27011, 511,   0, DTU,0xCE
  },
  +   { Wacom Intuos5 touch S Pen,31496, 19685, 2047, 63,
  INTUOS5S,   0x26},
  +   { Wacom Intuos5 touch S Finger,  4096,  4096,0,  0,
  INTUOS5_FG, 0x26},
  +   { Wacom Intuos5 touch M Pen,44704, 27940, 2047, 63,
  INTUOS5M,   0x27},
  +   { Wacom Intuos5 touch M Finger,  4096,  4096,0,  0,
  INTUOS5_FG, 0x27},
  +   { Wacom Intuos5 touch L Pen,65024, 40640, 2047, 63,
  INTUOS5L,   0x28},
  +   { Wacom Intuos5 touch L Finger,  4096,  4096,0,  0,
  INTUOS5_FG, 0x28},
 
 
 The ones (0x29 and 0x2A) left out are pen only ones. I know quite a
 few RHEL6 users don't want to buy pen and touch models since touch is not
 supported there yet.
 
 
   };
   #define WACOM_N_TABLETS (sizeof(wacom_features)/sizeof(wacom_features[0]))
   int wacom_check_type(int x)
  @@ -185,6 +195,25 @@ static int wacom_set_events(struct uinput_info *info,
  struct uinput_user_dev *de
  set_event(info, UI_SET_EVBIT, EV_KEY);
  set_event(info, UI_SET_EVBIT, EV_ABS);
 
  +   /* touch devices don't have the common features of others */
  +   switch(features-type) {
  +   case INTUOS5_FG:
  +   set_event(info, UI_SET_ABSBIT, ABS_X);
  +   set_event(info, UI_SET_ABSBIT, ABS_Y);
  +   set_event(info, UI_SET_ABSBIT, ABS_MT_SLOT);
  +   set_event(info, UI_SET_ABSBIT, ABS_MT_TOUCH_MAJOR);
  +   set_event(info, UI_SET_ABSBIT, ABS_MT_POSITION_X);
  +   set_event(info, UI_SET_ABSBIT, ABS_MT_POSITION_Y);
  +   set_event(info, UI_SET_ABSBIT, ABS_MT_TRACKING_ID);
  +   set_event(info, UI_SET_KEYBIT, BTN_TOOL_FINGER);
  +   set_event(info, UI_SET_KEYBIT, BTN_TOOL_DOUBLETAP);
  +   set_event(info, UI_SET_KEYBIT, BTN_TOOL_TRIPLETAP);
  +   set_event(info, UI_SET_KEYBIT, BTN_TOOL_QUADTAP);
 
 
 If we don't plan to only run this version of wdaemon on newer kernels, a
 check for kernel version is needed. Otherwise, this code won't compile on
 kernels older than 2.6.36 since some of the bits are undefined there, such
 as ABS_MT_SLOT,  ABS_MT_TRACKING_ID, etc.
 

I'll add ifdefs for those and re-submit the patch. thanks for the review.

Cheers,
  Peter

  +   set_event(info, UI_SET_KEYBIT, BTN_TOUCH);
  +   return 0;
  +   }
  +
  +
  set_event(info, UI_SET_KEYBIT, BTN_TOOL_PEN);
  set_event(info, UI_SET_KEYBIT, BTN_TOUCH);
  set_event(info, UI_SET_KEYBIT, BTN_STYLUS);
  @@ -295,6 +324,20 @@ static int wacom_set_events(struct uinput_info *info,
  struct uinput_user_dev *de
  set_event(info, UI_SET_KEYBIT, BTN_5);
  set_event(info, UI_SET_KEYBIT, BTN_6);
  break;
  +   case INTUOS5M:
  +   case INTUOS5L:
  +   set_event(info, UI_SET_KEYBIT, BTN_7);
  +   set_event(info, UI_SET_KEYBIT, BTN_8);
  +   case INTUOS5S:
  +   set_event(info, UI_SET_ABSBIT, ABS_Z);
  +   set_event(info, UI_SET_KEYBIT, BTN_0);
  +   set_event(info, UI_SET_KEYBIT, BTN_1);
  +   set_event(info, UI_SET_KEYBIT, BTN_2);
  +