Re: [Linuxwacom-devel] [PATCH] hid-wacom: add support to Intuos4 pad buttons and dial
Hi Aristeu, I'm sure people will be happy to see this patch. I've a question for you below. On Wed, Feb 1, 2012 at 11:23 AM, Aristeu Rozanski a...@redhat.com wrote: This patch adds support for the pad buttons and dial in the bluetooth version of Intuos4. Signed-off-by: Aristeu Rozanski a...@redhat.com --- drivers/hid/hid-wacom.c | 38 ++ 1 file changed, 38 insertions(+) --- linus-2.6.orig/drivers/hid/hid-wacom.c 2012-02-01 11:54:09.0 -0500 +++ linus-2.6/drivers/hid/hid-wacom.c 2012-02-01 12:17:46.166583951 -0500 @@ -363,6 +363,35 @@ input_report_key(input, BTN_STYLUS2, d return; } +static void wacom_i4_parse_pad_report(struct wacom_data *wdata, + struct input_dev *input, unsigned char *data) +{ + input_report_key(input, BTN_0, (data[2] 0x01)); + input_report_key(input, BTN_1, (data[3] 0x01)); + input_report_key(input, BTN_2, (data[3] 0x02)); + input_report_key(input, BTN_3, (data[3] 0x04)); + input_report_key(input, BTN_4, (data[3] 0x08)); + input_report_key(input, BTN_5, (data[3] 0x10)); + input_report_key(input, BTN_6, (data[3] 0x20)); + input_report_key(input, BTN_7, (data[3] 0x40)); + input_report_key(input, BTN_8, (data[3] 0x80)); + + if (data[1] 0x80) + input_report_abs(input, ABS_WHEEL, (data[1] 0x7f)); + else + /* Out of proximity, clear wheel value. */ + input_report_abs(input, ABS_WHEEL, 0); + + if (data[1] | (data[2] 0x01) | data[3]) { + input_report_key(input, wdata-tool, 1); + input_report_key(input, BTN_TOOL_FINGER, 1); + } else { + input_report_key(input, wdata-tool, 0); + input_report_abs(input, BTN_TOOL_FINGER, 0); + } I'm assuming your sending BTN_TOOL_FINGER because thats what Intuos4 does in wacom_wac.c kernel driver? For drivers that want to use Protocol 4 or 5 style events (see http://sourceforge.net/apps/mediawiki/linuxwacom/index.php?title=Kernel_Input_Event_Overview ), this does inform xf86-input-wacom to treat these as PAD events so, for example, ABS_WHEEL is treated as a wheel on PAD device and not a wheel on mouse puck or airbrush. But Protocol 4and 5 drivers are also required to send a value in ABS_MISC as described in above link. If not, the serial # is stuck with fixed value of zero and then the same data structure in xf86-input-wacom will be used to store all events for all hotplugged devices. I'm not exactly sure what that would visually result in but I assume if you leave pen in proximity while you click a tablet button that the pen would be forced out of proximity when you release the button. Or maybe jump to location (0,0). One option is to update xf86-input-wacom so that driver does not have to send serial #'s always. Over last year, xf86-input-wacom::wcmUSB.c has added a function called usbInitToolType() that peeks at all buffered events to detect tool type. Right now, it only does it to see which hotplug device type to send events to. We could also change to decide which data structure/array location (called channel internally) as well; We could at least do this for the PAD device which is always force to last channel by convention. I do not know if these Bluetooth Intuos4 support mouse pucks. If so, then we have to become concerned with only 1 tool with overlapping ABS_WHEEL events are allowed in proximity at the same time. Chris + input_sync(input); +} + static void wacom_i4_parse_report(struct hid_device *hdev, struct wacom_data *wdata, struct input_dev *input, unsigned char *data) @@ -377,6 +406,7 @@ case 0x03: /* Features Report */ wdata-features = data[2]; break; case 0x0C: /* Button report */ + wacom_i4_parse_pad_report(wdata, input, data); break; default: hid_err(hdev, Unknown report: %d,%d\n, data[0], data[1]); @@ -474,6 +504,14 @@ input_set_abs_params(input, ABS_DISTAN input_set_abs_params(input, ABS_X, 0, 40640, 4, 0); input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0); input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0); + input_set_abs_params(input, ABS_WHEEL, 0, 71, 0, 0); + __set_bit(BTN_2, input-keybit); + __set_bit(BTN_3, input-keybit); + __set_bit(BTN_4, input-keybit); + __set_bit(BTN_5, input-keybit); + __set_bit(BTN_6, input-keybit); + __set_bit(BTN_7, input-keybit); + __set_bit(BTN_8, input-keybit); break; } -- Keep Your Developer Skills Current with LearnDevNow!
Re: [Linuxwacom-devel] [PATCH] hid-wacom: add support to Intuos4 pad buttons and dial
When I mention ABS_MISC, it should really be MSC_SERIAL. But the link I sent tells it all better. Chris On Thu, Feb 2, 2012 at 9:32 AM, Chris Bagwell ch...@cnpbagwell.com wrote: Hi Aristeu, I'm sure people will be happy to see this patch. I've a question for you below. On Wed, Feb 1, 2012 at 11:23 AM, Aristeu Rozanski a...@redhat.com wrote: This patch adds support for the pad buttons and dial in the bluetooth version of Intuos4. Signed-off-by: Aristeu Rozanski a...@redhat.com --- drivers/hid/hid-wacom.c | 38 ++ 1 file changed, 38 insertions(+) --- linus-2.6.orig/drivers/hid/hid-wacom.c 2012-02-01 11:54:09.0 -0500 +++ linus-2.6/drivers/hid/hid-wacom.c 2012-02-01 12:17:46.166583951 -0500 @@ -363,6 +363,35 @@ input_report_key(input, BTN_STYLUS2, d return; } +static void wacom_i4_parse_pad_report(struct wacom_data *wdata, + struct input_dev *input, unsigned char *data) +{ + input_report_key(input, BTN_0, (data[2] 0x01)); + input_report_key(input, BTN_1, (data[3] 0x01)); + input_report_key(input, BTN_2, (data[3] 0x02)); + input_report_key(input, BTN_3, (data[3] 0x04)); + input_report_key(input, BTN_4, (data[3] 0x08)); + input_report_key(input, BTN_5, (data[3] 0x10)); + input_report_key(input, BTN_6, (data[3] 0x20)); + input_report_key(input, BTN_7, (data[3] 0x40)); + input_report_key(input, BTN_8, (data[3] 0x80)); + + if (data[1] 0x80) + input_report_abs(input, ABS_WHEEL, (data[1] 0x7f)); + else + /* Out of proximity, clear wheel value. */ + input_report_abs(input, ABS_WHEEL, 0); + + if (data[1] | (data[2] 0x01) | data[3]) { + input_report_key(input, wdata-tool, 1); + input_report_key(input, BTN_TOOL_FINGER, 1); + } else { + input_report_key(input, wdata-tool, 0); + input_report_abs(input, BTN_TOOL_FINGER, 0); + } I'm assuming your sending BTN_TOOL_FINGER because thats what Intuos4 does in wacom_wac.c kernel driver? For drivers that want to use Protocol 4 or 5 style events (see http://sourceforge.net/apps/mediawiki/linuxwacom/index.php?title=Kernel_Input_Event_Overview ), this does inform xf86-input-wacom to treat these as PAD events so, for example, ABS_WHEEL is treated as a wheel on PAD device and not a wheel on mouse puck or airbrush. But Protocol 4and 5 drivers are also required to send a value in ABS_MISC as described in above link. If not, the serial # is stuck with fixed value of zero and then the same data structure in xf86-input-wacom will be used to store all events for all hotplugged devices. I'm not exactly sure what that would visually result in but I assume if you leave pen in proximity while you click a tablet button that the pen would be forced out of proximity when you release the button. Or maybe jump to location (0,0). One option is to update xf86-input-wacom so that driver does not have to send serial #'s always. Over last year, xf86-input-wacom::wcmUSB.c has added a function called usbInitToolType() that peeks at all buffered events to detect tool type. Right now, it only does it to see which hotplug device type to send events to. We could also change to decide which data structure/array location (called channel internally) as well; We could at least do this for the PAD device which is always force to last channel by convention. I do not know if these Bluetooth Intuos4 support mouse pucks. If so, then we have to become concerned with only 1 tool with overlapping ABS_WHEEL events are allowed in proximity at the same time. Chris + input_sync(input); +} + static void wacom_i4_parse_report(struct hid_device *hdev, struct wacom_data *wdata, struct input_dev *input, unsigned char *data) @@ -377,6 +406,7 @@ case 0x03: /* Features Report */ wdata-features = data[2]; break; case 0x0C: /* Button report */ + wacom_i4_parse_pad_report(wdata, input, data); break; default: hid_err(hdev, Unknown report: %d,%d\n, data[0], data[1]); @@ -474,6 +504,14 @@ input_set_abs_params(input, ABS_DISTAN input_set_abs_params(input, ABS_X, 0, 40640, 4, 0); input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0); input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0); + input_set_abs_params(input, ABS_WHEEL, 0, 71, 0, 0); + __set_bit(BTN_2, input-keybit); + __set_bit(BTN_3, input-keybit); + __set_bit(BTN_4, input-keybit); + __set_bit(BTN_5, input-keybit); + __set_bit(BTN_6, input-keybit); + __set_bit(BTN_7, input-keybit); +
Re: [Linuxwacom-devel] [PATCH] hid-wacom: add support to Intuos4 pad buttons and dial
On Thu, Feb 02, 2012 at 09:32:03AM -0600, Chris Bagwell wrote: Hi Aristeu, I'm sure people will be happy to see this patch. I've a question for you below. On Wed, Feb 1, 2012 at 11:23 AM, Aristeu Rozanski a...@redhat.com wrote: This patch adds support for the pad buttons and dial in the bluetooth version of Intuos4. Signed-off-by: Aristeu Rozanski a...@redhat.com --- drivers/hid/hid-wacom.c | 38 ++ 1 file changed, 38 insertions(+) --- linus-2.6.orig/drivers/hid/hid-wacom.c 2012-02-01 11:54:09.0 -0500 +++ linus-2.6/drivers/hid/hid-wacom.c 2012-02-01 12:17:46.166583951 -0500 @@ -363,6 +363,35 @@ input_report_key(input, BTN_STYLUS2, d return; } +static void wacom_i4_parse_pad_report(struct wacom_data *wdata, + struct input_dev *input, unsigned char *data) +{ + input_report_key(input, BTN_0, (data[2] 0x01)); + input_report_key(input, BTN_1, (data[3] 0x01)); + input_report_key(input, BTN_2, (data[3] 0x02)); + input_report_key(input, BTN_3, (data[3] 0x04)); + input_report_key(input, BTN_4, (data[3] 0x08)); + input_report_key(input, BTN_5, (data[3] 0x10)); + input_report_key(input, BTN_6, (data[3] 0x20)); + input_report_key(input, BTN_7, (data[3] 0x40)); + input_report_key(input, BTN_8, (data[3] 0x80)); + + if (data[1] 0x80) + input_report_abs(input, ABS_WHEEL, (data[1] 0x7f)); + else + /* Out of proximity, clear wheel value. */ + input_report_abs(input, ABS_WHEEL, 0); + + if (data[1] | (data[2] 0x01) | data[3]) { + input_report_key(input, wdata-tool, 1); + input_report_key(input, BTN_TOOL_FINGER, 1); + } else { + input_report_key(input, wdata-tool, 0); + input_report_abs(input, BTN_TOOL_FINGER, 0); + } I'm assuming your sending BTN_TOOL_FINGER because thats what Intuos4 does in wacom_wac.c kernel driver? yep. For drivers that want to use Protocol 4 or 5 style events (see http://sourceforge.net/apps/mediawiki/linuxwacom/index.php?title=Kernel_Input_Event_Overview ), this does inform xf86-input-wacom to treat these as PAD events so, for example, ABS_WHEEL is treated as a wheel on PAD device and not a wheel on mouse puck or airbrush. but that's intended. it's a wheel on the side of the tablet: === +-+ === | | === | | === | | w | | w=w | | w | | === | | === | | === | | === +-+ But Protocol 4and 5 drivers are also required to send a value in ABS_MISC as described in above link. If not, the serial # is stuck with fixed value of zero and then the same data structure in xf86-input-wacom will be used to store all events for all hotplugged devices. I'm not exactly sure what that would visually result in but I assume if you leave pen in proximity while you click a tablet button that the pen would be forced out of proximity when you release the button. Or maybe jump to location (0,0). One option is to update xf86-input-wacom so that driver does not have to send serial #'s always. Over last year, xf86-input-wacom::wcmUSB.c has added a function called usbInitToolType() that peeks at all buffered events to detect tool type. Right now, it only does it to see which hotplug device type to send events to. We could also change to decide which data structure/array location (called channel internally) as well; We could at least do this for the PAD device which is always force to last channel by convention. I do not know if these Bluetooth Intuos4 support mouse pucks. If so, then we have to become concerned with only 1 tool with overlapping ABS_WHEEL events are allowed in proximity at the same time. thanks for the explanation, I never fully got the reason for the serial. I'll rework the patch to get it right. -- Aristeu -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Re: [Linuxwacom-devel] [PATCH] hid-wacom: add support to Intuos4 pad buttons and dial
On Thu, Feb 2, 2012 at 10:08 AM, Aristeu Rozanski a...@redhat.com wrote: On Thu, Feb 02, 2012 at 09:32:03AM -0600, Chris Bagwell wrote: Hi Aristeu, I'm sure people will be happy to see this patch. I've a question for you below. On Wed, Feb 1, 2012 at 11:23 AM, Aristeu Rozanski a...@redhat.com wrote: This patch adds support for the pad buttons and dial in the bluetooth version of Intuos4. Signed-off-by: Aristeu Rozanski a...@redhat.com --- drivers/hid/hid-wacom.c | 38 ++ 1 file changed, 38 insertions(+) --- linus-2.6.orig/drivers/hid/hid-wacom.c 2012-02-01 11:54:09.0 -0500 +++ linus-2.6/drivers/hid/hid-wacom.c 2012-02-01 12:17:46.166583951 -0500 @@ -363,6 +363,35 @@ input_report_key(input, BTN_STYLUS2, d return; } +static void wacom_i4_parse_pad_report(struct wacom_data *wdata, + struct input_dev *input, unsigned char *data) +{ + input_report_key(input, BTN_0, (data[2] 0x01)); + input_report_key(input, BTN_1, (data[3] 0x01)); + input_report_key(input, BTN_2, (data[3] 0x02)); + input_report_key(input, BTN_3, (data[3] 0x04)); + input_report_key(input, BTN_4, (data[3] 0x08)); + input_report_key(input, BTN_5, (data[3] 0x10)); + input_report_key(input, BTN_6, (data[3] 0x20)); + input_report_key(input, BTN_7, (data[3] 0x40)); + input_report_key(input, BTN_8, (data[3] 0x80)); + + if (data[1] 0x80) + input_report_abs(input, ABS_WHEEL, (data[1] 0x7f)); + else + /* Out of proximity, clear wheel value. */ + input_report_abs(input, ABS_WHEEL, 0); + + if (data[1] | (data[2] 0x01) | data[3]) { + input_report_key(input, wdata-tool, 1); + input_report_key(input, BTN_TOOL_FINGER, 1); + } else { + input_report_key(input, wdata-tool, 0); + input_report_abs(input, BTN_TOOL_FINGER, 0); + } I'm assuming your sending BTN_TOOL_FINGER because thats what Intuos4 does in wacom_wac.c kernel driver? yep. For drivers that want to use Protocol 4 or 5 style events (see http://sourceforge.net/apps/mediawiki/linuxwacom/index.php?title=Kernel_Input_Event_Overview ), this does inform xf86-input-wacom to treat these as PAD events so, for example, ABS_WHEEL is treated as a wheel on PAD device and not a wheel on mouse puck or airbrush. but that's intended. it's a wheel on the side of the tablet: === +-+ === | | === | | === | | w | | w=w | | w | | === | | === | | === | | === +-+ But Protocol 4and 5 drivers are also required to send a value in ABS_MISC as described in above link. If not, the serial # is stuck with fixed value of zero and then the same data structure in xf86-input-wacom will be used to store all events for all hotplugged devices. I'm not exactly sure what that would visually result in but I assume if you leave pen in proximity while you click a tablet button that the pen would be forced out of proximity when you release the button. Or maybe jump to location (0,0). One option is to update xf86-input-wacom so that driver does not have to send serial #'s always. Over last year, xf86-input-wacom::wcmUSB.c has added a function called usbInitToolType() that peeks at all buffered events to detect tool type. Right now, it only does it to see which hotplug device type to send events to. We could also change to decide which data structure/array location (called channel internally) as well; We could at least do this for the PAD device which is always force to last channel by convention. I do not know if these Bluetooth Intuos4 support mouse pucks. If so, then we have to become concerned with only 1 tool with overlapping ABS_WHEEL events are allowed in proximity at the same time. thanks for the explanation, I never fully got the reason for the serial. I'll rework the patch to get it right. OK. Good luck and feel free to ask question. I'm not convinced myself yet if its a kernel side or X input side design issue yet so updates to either side are an option. But sending the serial # is also probably easiest change. Chris -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now!
Re: [Linuxwacom-devel] [PATCH] hid-wacom: add support to Intuos4 pad buttons and dial
On Thu, 2012-02-02 at 11:08 -0500, Aristeu Rozanski wrote: I do not know if these Bluetooth Intuos4 support mouse pucks. From what I've read (before stupidly buying the USB-only version), plug in the Intuos4 WL via USB and it's the same as the Intuos4 L. So I'm guessing it supports the exact same tools. -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
Re: [Linuxwacom-devel] [PATCH] hid-wacom: add support to Intuos4 pad buttons and dial
On Thu, Feb 2, 2012 at 10:34 AM, Bastien Nocera had...@hadess.net wrote: On Thu, 2012-02-02 at 11:08 -0500, Aristeu Rozanski wrote: I do not know if these Bluetooth Intuos4 support mouse pucks. From what I've read (before stupidly buying the USB-only version), plug in the Intuos4 WL via USB and it's the same as the Intuos4 L. So I'm guessing it supports the exact same tools. OK. Thanks. Come to think of it, there a few bigger issues to solve first. For now, I suggest ignoring my comment about BTN_TOOL_MOUSE+BTN_TOOL_FINGER being in proximity at the same time and just get stylus+pad buttons working without addressing. Or at least put it to back of your head. :-) The issue is that right now, Protocol 5 devices have to be manually added to a list in xf86-input-wacom so probably this bluetooth device is treated as a Protocol 4 device. One difference is serial # for PAD device is 0xff vs. -1 between the two protocols so xf86-input-wacom will chose wrong channel if it thinks its a Protocol 4. The xf86-input-wacom logic could stand to be rewritten to compute all channel #'s like it does for Protocol 5's (look up an unused slot and ignore exact serial # value). The ABS_DISTANCE also becomes very important for mice pucks and Protocol 4 vs. 5 currently send it with inverse meaning. And nothing from kernel side advertises Protocol 4 vs. Protocol 5. Thus the hard coded list. Opps. Protocol 4 doesn't give you anything beyond what we've come to call Protocol Generic (simple tablets) so I've pushed to end-of-life Protocol 4. Since we do not have generic replacements for Protocol 5 concepts yet, it will need to stay around for a while. Maybe we should change default in xf86-input-wacom for unknown tablets with serial #'s from Protocol 4 to Protocol 5? Chris -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel
[Linuxwacom-devel] [PATCH] hid-wacom: add support to Intuos4 pad buttons and dial
This patch adds support for the pad buttons and dial in the bluetooth version of Intuos4. Signed-off-by: Aristeu Rozanski a...@redhat.com --- drivers/hid/hid-wacom.c | 38 ++ 1 file changed, 38 insertions(+) --- linus-2.6.orig/drivers/hid/hid-wacom.c 2012-02-01 11:54:09.0 -0500 +++ linus-2.6/drivers/hid/hid-wacom.c 2012-02-01 12:17:46.166583951 -0500 @@ -363,6 +363,35 @@input_report_key(input, BTN_STYLUS2, d return; } +static void wacom_i4_parse_pad_report(struct wacom_data *wdata, + struct input_dev *input, unsigned char *data) +{ + input_report_key(input, BTN_0, (data[2] 0x01)); + input_report_key(input, BTN_1, (data[3] 0x01)); + input_report_key(input, BTN_2, (data[3] 0x02)); + input_report_key(input, BTN_3, (data[3] 0x04)); + input_report_key(input, BTN_4, (data[3] 0x08)); + input_report_key(input, BTN_5, (data[3] 0x10)); + input_report_key(input, BTN_6, (data[3] 0x20)); + input_report_key(input, BTN_7, (data[3] 0x40)); + input_report_key(input, BTN_8, (data[3] 0x80)); + + if (data[1] 0x80) + input_report_abs(input, ABS_WHEEL, (data[1] 0x7f)); + else + /* Out of proximity, clear wheel value. */ + input_report_abs(input, ABS_WHEEL, 0); + + if (data[1] | (data[2] 0x01) | data[3]) { + input_report_key(input, wdata-tool, 1); + input_report_key(input, BTN_TOOL_FINGER, 1); + } else { + input_report_key(input, wdata-tool, 0); + input_report_abs(input, BTN_TOOL_FINGER, 0); + } + input_sync(input); +} + static void wacom_i4_parse_report(struct hid_device *hdev, struct wacom_data *wdata, struct input_dev *input, unsigned char *data) @@ -377,6 +406,7 @@ case 0x03: /* Features Report */ wdata-features = data[2]; break; case 0x0C: /* Button report */ + wacom_i4_parse_pad_report(wdata, input, data); break; default: hid_err(hdev, Unknown report: %d,%d\n, data[0], data[1]); @@ -474,6 +504,14 @@input_set_abs_params(input, ABS_DISTAN input_set_abs_params(input, ABS_X, 0, 40640, 4, 0); input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0); input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0); + input_set_abs_params(input, ABS_WHEEL, 0, 71, 0, 0); + __set_bit(BTN_2, input-keybit); + __set_bit(BTN_3, input-keybit); + __set_bit(BTN_4, input-keybit); + __set_bit(BTN_5, input-keybit); + __set_bit(BTN_6, input-keybit); + __set_bit(BTN_7, input-keybit); + __set_bit(BTN_8, input-keybit); break; } -- Keep Your Developer Skills Current with LearnDevNow! The most comprehensive online learning library for Microsoft developers is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, Metro Style Apps, more. Free future releases when you subscribe now! http://p.sf.net/sfu/learndevnow-d2d ___ Linuxwacom-devel mailing list Linuxwacom-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linuxwacom-devel