Discussion:
[Linuxwacom-devel] [PATCH input-wacom C 00/17] MobileStudio Pro backport
Jason Gerecke
2016-11-16 19:15:35 UTC
Permalink
These patches backport support for the MobileStudio Pro to the 3.17, 3.7,
2.6.38, 2.6.36, and 2.6.30 directories. The 3.17 backports are very
similar to upstream since it also supports HID_GENERIC while the other
backports had to be done in a more "traditional" style of explicitly
decoding the reports.


Dan Carpenter (1):
backport: HID: wacom: Don't clear bits unintentionally

Jason Gerecke (16):
backport: HID: wacom: generic: Strip off excessive name prefixing
backport: HID: wacom: generic: Add support for height, tilt, and twist
usages
backport: HID: wacom: generic: Support and use 'Custom HID' mode and
usages
backport: HID: wacom: generic: Add support for vendor-defined
"Distance" usage
backport: HID: wacom: generic: Add support for vendor-defined
"Fingerwheel" usage
backport: HID: wacom: generic: Add support for vendor-defined "Sense"
usage
backport: HID: wacom: Read and internally use corrected Intuos tool
IDs
backport: HID: wacom: generic: Support tool ID and additional tool
types
backport: HID: wacom: Fix sensor outbounds and redefine as offsets
from each edge
backport: HID: wacom: generic: Add support for sensor offsets
backport: HID: wacom: generic: Introduce pad support
backport: HID: wacom: generic: Add support for battery status on pen
and pad interfaces
backport: HID: wacom: generic: Extend pad support
backport: HID: input: Recognize ABS_WHEEL in hidinput_calc_abs_res
backport: HID: wacom: Declare tool ID 0x84a as an Intuos eraser
backport: MobileStudio Pro to 3.7, 2.6.38, 2.6.36, 2.6.30

2.6.30/wacom_sys.c | 20 ++-
2.6.30/wacom_wac.c | 302 ++++++++++++++++++++++++++++----
2.6.30/wacom_wac.h | 14 +-
2.6.36/wacom_sys.c | 20 ++-
2.6.36/wacom_wac.c | 333 ++++++++++++++++++++++++++++++-----
2.6.36/wacom_wac.h | 14 +-
2.6.38/wacom_sys.c | 9 +
2.6.38/wacom_wac.c | 333 +++++++++++++++++++++++++++++++----
2.6.38/wacom_wac.h | 14 +-
3.17/wacom_sys.c | 65 +++++--
3.17/wacom_wac.c | 501 ++++++++++++++++++++++++++++++++++++++++++++++-------
3.17/wacom_wac.h | 68 +++++++-
3.7/wacom_sys.c | 9 +
3.7/wacom_wac.c | 334 +++++++++++++++++++++++++++++++----
3.7/wacom_wac.h | 14 +-
15 files changed, 1815 insertions(+), 235 deletions(-)
--
2.10.2


------------------------------------------------------------------------------
Jason Gerecke
2016-11-16 19:15:39 UTC
Permalink
The vendor-defined 0xFF0D01032 ("Distance") usage is nearly equivalent to
HID_GD_Z, except that the axis direction is inverted. Unlike HID_GD_Z which
increases in value as the pen-to-surface distance is decreased, this usage
decreases. Treat this usage as a special case to ensure we don't invert the
scale to be ABS_DISTANCE compatible like we do for HID_GD_Z.

Signed-off-by: Jason Gerecke <***@wacom.com>
Reviewed-by: Benjamin Tissoires <***@redhat.com>
[***@wacom.com: Imported into input-wacom repository (b5c921e)]
Signed-off-by: Jason Gerecke <***@wacom.com>
[***@wacom.com: backported from input-wacom repository (8c3e162)]
Signed-off-by: Jason Gerecke <***@wacom.com>
---
3.17/wacom_wac.c | 4 +++-
3.17/wacom_wac.h | 1 +
2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/3.17/wacom_wac.c b/3.17/wacom_wac.c
index 3a4eacd..9f92ea0 100644
--- a/3.17/wacom_wac.c
+++ b/3.17/wacom_wac.c
@@ -1449,7 +1449,8 @@ static int wacom_equivalent_usage(int usage)
int subusage = (usage & 0xFF);

if (subpage == WACOM_HID_SP_DIGITIZER ||
- subpage == WACOM_HID_SP_DIGITIZERINFO) {
+ subpage == WACOM_HID_SP_DIGITIZERINFO ||
+ usage == WACOM_HID_WD_DISTANCE) {
return usage;
}

@@ -1509,6 +1510,7 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
case HID_GD_Y:
wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4);
break;
+ case WACOM_HID_WD_DISTANCE:
case HID_GD_Z:
wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0);
break;
diff --git a/3.17/wacom_wac.h b/3.17/wacom_wac.h
index f912cac..131b469 100644
--- a/3.17/wacom_wac.h
+++ b/3.17/wacom_wac.h
@@ -100,6 +100,7 @@
#define WACOM_HID_SP_DIGITIZER 0x000d0000
#define WACOM_HID_SP_DIGITIZERINFO 0x00100000
#define WACOM_HID_WD_DIGITIZER (WACOM_HID_UP_WACOMDIGITIZER | 0x01)
+#define WACOM_HID_WD_DISTANCE (WACOM_HID_UP_WACOMDIGITIZER | 0x0132)
#define WACOM_HID_WD_DATAMODE (WACOM_HID_UP_WACOMDIGITIZER | 0x1002)
#define WACOM_HID_UP_G9 0xff090000
#define WACOM_HID_G9_PEN (WACOM_HID_UP_G9 | 0x02)
--
2.10.2


------------------------------------------------------------------------------
Jason Gerecke
2016-11-16 19:15:41 UTC
Permalink
Wacom's professional tablets beginning with the Intuos4 are capable of
reporting an intermediate degree of proximity where the pen is no longer
close enough to communicate with ("in prox"), but still close enough to
be sensed ("in range"). This additional state is particularly useful for
performing palm rejection as it allows the driver to disable the touch
sensor while the pen is a greater distance from the tablet.

Like other professional tablets, the new MobileStudio Pro also reports
this intermeidate "in range" proximity state. Its descriptor assigns
usage 0xff0d0036 to this bit. Normally 'wacom_equivalent_usage' would
translate this to the standard HID "Quality" usage, but since this has
a different meaning we have it explicitly ignore the usage and define
it ourselves as "Sense" (since "In Range" is already defined by the
HID standard and interpreted by our driver as meaning "in prox").

Signed-off-by: Jason Gerecke <***@wacom.com>
Reviewed-by: Benjamin Tissoires <***@redhat.com>
[***@wacom.com: Imported into input-wacom repository (61ce346)]
Signed-off-by: Jason Gerecke <***@wacom.com>
[***@wacom.com: backported from input-wacom repository (54d6746)]
Signed-off-by: Jason Gerecke <***@wacom.com>
---
3.17/wacom_wac.c | 26 +++++++++++++++++++++++---
3.17/wacom_wac.h | 3 +++
2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/3.17/wacom_wac.c b/3.17/wacom_wac.c
index 0b5c6f4..1c29336 100644
--- a/3.17/wacom_wac.c
+++ b/3.17/wacom_wac.c
@@ -1450,6 +1450,7 @@ static int wacom_equivalent_usage(int usage)

if (subpage == WACOM_HID_SP_DIGITIZER ||
subpage == WACOM_HID_SP_DIGITIZERINFO ||
+ usage == WACOM_HID_WD_SENSE ||
usage == WACOM_HID_WD_DISTANCE) {
return usage;
}
@@ -1500,6 +1501,7 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
{
struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
+ struct wacom_features *features = &wacom_wac->features;
struct input_dev *input = wacom_wac->pen_input;
unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);

@@ -1546,6 +1548,10 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
case HID_DG_TOOLSERIALNUMBER:
wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0);
break;
+ case WACOM_HID_WD_SENSE:
+ features->quirks |= WACOM_QUIRK_SENSE;
+ wacom_map_usage(input, usage, field, EV_KEY, BTN_TOOL_PEN, 0);
+ break;
case WACOM_HID_WD_FINGERWHEEL:
wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0);
break;
@@ -1557,6 +1563,7 @@ static int wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field,
{
struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
+ struct wacom_features *features = &wacom_wac->features;
struct input_dev *input = wacom_wac->pen_input;
unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);

@@ -1571,6 +1578,8 @@ static int wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field,
break;
case HID_DG_INRANGE:
wacom_wac->hid_data.inrange_state = value;
+ if (!(features->quirks & WACOM_QUIRK_SENSE))
+ wacom_wac->hid_data.sense_state = value;
return 0;
case HID_DG_INVERT:
wacom_wac->hid_data.invert_state = value;
@@ -1579,6 +1588,9 @@ static int wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field,
case HID_DG_TIPSWITCH:
wacom_wac->hid_data.tipswitch |= value;
return 0;
+ case WACOM_HID_WD_SENSE:
+ wacom_wac->hid_data.sense_state = value;
+ return 0;
}

/* send pen events only when touch is up or forced out
@@ -1587,6 +1599,10 @@ static int wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field,
if (!usage->type || delay_pen_events(wacom_wac))
return 0;

+ /* send pen events only when the pen is in/entering/leaving proximity */
+ if (!wacom_wac->hid_data.inrange_state && !wacom_wac->tool[0])
+ return 0;
+
input_event(input, usage->type, usage->code, value);

return 0;
@@ -1605,16 +1621,17 @@ static void wacom_wac_pen_report(struct hid_device *hdev,
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
struct input_dev *input = wacom_wac->pen_input;
bool prox = wacom_wac->hid_data.inrange_state;
+ bool range = wacom_wac->hid_data.sense_state;

- if (!wacom_wac->shared->stylus_in_proximity) /* first in prox */
+ if (!wacom_wac->tool[0] && prox) /* first in prox */
/* Going into proximity select tool */
wacom_wac->tool[0] = wacom_wac->hid_data.invert_state ?
BTN_TOOL_RUBBER : BTN_TOOL_PEN;

/* keep pen state for touch events */
- wacom_wac->shared->stylus_in_proximity = prox;
+ wacom_wac->shared->stylus_in_proximity = range;

- if (!delay_pen_events(wacom_wac)) {
+ if (!delay_pen_events(wacom_wac) && wacom_wac->tool[0]) {
input_report_key(input, BTN_TOUCH,
wacom_wac->hid_data.tipswitch);
input_report_key(input, wacom_wac->tool[0], prox);
@@ -1623,6 +1640,9 @@ static void wacom_wac_pen_report(struct hid_device *hdev,

input_sync(input);
}
+
+ if (!prox)
+ wacom_wac->tool[0] = 0;
}

static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
diff --git a/3.17/wacom_wac.h b/3.17/wacom_wac.h
index f81b9ed..93c0e1a 100644
--- a/3.17/wacom_wac.h
+++ b/3.17/wacom_wac.h
@@ -74,6 +74,7 @@

/* device quirks */
#define WACOM_QUIRK_BBTOUCH_LOWRES 0x0001
+#define WACOM_QUIRK_SENSE 0x0002
#define WACOM_QUIRK_BATTERY 0x0008

/* device types */
@@ -100,6 +101,7 @@
#define WACOM_HID_SP_DIGITIZER 0x000d0000
#define WACOM_HID_SP_DIGITIZERINFO 0x00100000
#define WACOM_HID_WD_DIGITIZER (WACOM_HID_UP_WACOMDIGITIZER | 0x01)
+#define WACOM_HID_WD_SENSE (WACOM_HID_UP_WACOMDIGITIZER | 0x36)
#define WACOM_HID_WD_DISTANCE (WACOM_HID_UP_WACOMDIGITIZER | 0x0132)
#define WACOM_HID_WD_FINGERWHEEL (WACOM_HID_UP_WACOMDIGITIZER | 0x0d03)
#define WACOM_HID_WD_DATAMODE (WACOM_HID_UP_WACOMDIGITIZER | 0x1002)
@@ -224,6 +226,7 @@ struct wacom_shared {
struct hid_data {
__s16 inputmode; /* InputMode HID feature, -1 if non-existent */
__s16 inputmode_index; /* InputMode HID feature index in the report */
+ bool sense_state;
bool inrange_state;
bool invert_state;
bool tipswitch;
--
2.10.2


------------------------------------------------------------------------------
Jason Gerecke
2016-11-16 19:15:38 UTC
Permalink
Wacom's new "MobileStudio Pro" tablets are the first devices in their
branded product line-up to include a usable HID descriptor for the pen
interface. Like prior branded products, the device can operate in one
of two modes: 'Standard HID', and 'Wacom Custom HID'. Although the
first mode is usable by the HID_GENERIC codepath as-is (huzzah!), it is
subject to some restrictions -- most notably pressure being limited
to 2048 levels instead of 8192. To ensure tablets that include support
for Custom HID mode work optimally, we add support for its usages and
switch the device to Custom HID mode if possible.

The usages defined for Custom HID mode are often numerically similar to
their standard HID equivalents, allowing us to write a simple translation
function that takes arbitrary HID usages as input and which returns
the corresponding standard HID usage as output (if one exists). Switching
on this translated usage instead of the actual usage allows the existing
cases to apply to both modes of operation without having to explicitly
define every Custom HID usage.

Signed-off-by: Jason Gerecke <***@wacom.com>
Reviewed-by: Benjamin Tissoires <***@redhat.com>
[***@wacom.com: Imported into input-wacom repository (c9c0958)]
Signed-off-by: Jason Gerecke <***@wacom.com>
[***@wacom.com: backported from input-wacom repository (38120a0)]
Signed-off-by: Jason Gerecke <***@wacom.com>
---
3.17/wacom_sys.c | 5 +++++
3.17/wacom_wac.c | 37 +++++++++++++++++++++++++++++++------
3.17/wacom_wac.h | 3 +++
3 files changed, 39 insertions(+), 6 deletions(-)

diff --git a/3.17/wacom_sys.c b/3.17/wacom_sys.c
index 16c8083..2c34297 100644
--- a/3.17/wacom_sys.c
+++ b/3.17/wacom_sys.c
@@ -166,6 +166,11 @@ static void wacom_feature_mapping(struct hid_device *hdev,
}
break;

+ case WACOM_HID_WD_DATAMODE:
+ wacom->wacom_wac.mode_report = field->report->id;
+ wacom->wacom_wac.mode_value = 2;
+ break;
+
case WACOM_HID_UP_G9:
case WACOM_HID_UP_G11:
if (field->report->id == 0x03 &&
diff --git a/3.17/wacom_wac.c b/3.17/wacom_wac.c
index 8b50416..3a4eacd 100644
--- a/3.17/wacom_wac.c
+++ b/3.17/wacom_wac.c
@@ -1442,14 +1442,35 @@ static int wacom_tpc_irq(struct wacom_wac *wacom, size_t len)
return 0;
}

+static int wacom_equivalent_usage(int usage)
+{
+ if ((usage & HID_USAGE_PAGE) == WACOM_HID_UP_WACOMDIGITIZER) {
+ int subpage = (usage & 0xFF00) << 8;
+ int subusage = (usage & 0xFF);
+
+ if (subpage == WACOM_HID_SP_DIGITIZER ||
+ subpage == WACOM_HID_SP_DIGITIZERINFO) {
+ return usage;
+ }
+
+ if (subpage == HID_UP_UNDEFINED)
+ subpage = HID_UP_DIGITIZER;
+
+ return subpage | subusage;
+ }
+
+ return usage;
+}
+
static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
struct hid_field *field, __u8 type, __u16 code, int fuzz)
{
int fmin = field->logical_minimum;
int fmax = field->logical_maximum;
+ unsigned int equivalent_usage = wacom_equivalent_usage(usage->hid);
int resolution_code = code;

- if (usage->hid == HID_DG_TWIST) {
+ if (equivalent_usage == HID_DG_TWIST) {
resolution_code = ABS_RZ;
}

@@ -1479,8 +1500,9 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
struct input_dev *input = wacom_wac->pen_input;
+ unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);

- switch (usage->hid) {
+ switch (equivalent_usage) {
case HID_GD_X:
wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4);
break;
@@ -1531,8 +1553,9 @@ static int wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field,
struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
struct input_dev *input = wacom_wac->pen_input;
+ unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);

- switch (usage->hid) {
+ switch (equivalent_usage) {
case HID_GD_Z:
/*
* HID_GD_Z "should increase as the control's position is
@@ -1604,8 +1627,9 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
struct input_dev *input = wacom_wac->touch_input;
unsigned touch_max = wacom_wac->features.touch_max;
+ unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);

- switch (usage->hid) {
+ switch (equivalent_usage) {
case HID_GD_X:
if (touch_max == 1)
wacom_map_usage(input, usage, field, EV_ABS, ABS_X, 4);
@@ -1680,8 +1704,9 @@ static int wacom_wac_finger_event(struct hid_device *hdev,
{
struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
+ unsigned equivalent_usage = wacom_equivalent_usage(usage->hid);

- switch (usage->hid) {
+ switch (equivalent_usage) {
case HID_GD_X:
wacom_wac->hid_data.x = value;
break;
@@ -1704,7 +1729,7 @@ static int wacom_wac_finger_event(struct hid_device *hdev,


if (usage->usage_index + 1 == field->report_count) {
- if (usage->hid == wacom_wac->hid_data.last_slot_field)
+ if (equivalent_usage == wacom_wac->hid_data.last_slot_field)
wacom_wac_finger_slot(wacom_wac, wacom_wac->touch_input);
}

diff --git a/3.17/wacom_wac.h b/3.17/wacom_wac.h
index 8faa7fe..f912cac 100644
--- a/3.17/wacom_wac.h
+++ b/3.17/wacom_wac.h
@@ -97,7 +97,10 @@
#endif

#define WACOM_HID_UP_WACOMDIGITIZER 0xff0d0000
+#define WACOM_HID_SP_DIGITIZER 0x000d0000
+#define WACOM_HID_SP_DIGITIZERINFO 0x00100000
#define WACOM_HID_WD_DIGITIZER (WACOM_HID_UP_WACOMDIGITIZER | 0x01)
+#define WACOM_HID_WD_DATAMODE (WACOM_HID_UP_WACOMDIGITIZER | 0x1002)
#define WACOM_HID_UP_G9 0xff090000
#define WACOM_HID_G9_PEN (WACOM_HID_UP_G9 | 0x02)
#define WACOM_HID_G9_TOUCHSCREEN (WACOM_HID_UP_G9 | 0x11)
--
2.10.2


------------------------------------------------------------------------------
Jason Gerecke
2016-11-16 19:15:37 UTC
Permalink
The HID standard defines usages that allow digitizers to report the pen's
height, tilt, and rotation and which are used by Wacom's new "MobileStudio
Pro" devices.

Note that 'hidinput_calc_abs_res' expects ABS_Z (historically used by our
driver to report twist) to have linear units. To ensure it calculates a
resolution with the actually-angular units provided in the HID descriptor
we nedd to lie and tell it we're calculating it for the (rotational) ABS_RZ
axis instead.

Signed-off-by: Jason Gerecke <***@wacom.com>
Reviewed-by: Benjamin Tissoires <***@redhat.com>
[***@wacom.com: Imported into input-wacom repository (50066a0)]
Signed-off-by: Jason Gerecke <***@wacom.com>
[***@wacom.com: backported from input-wacom repository (84e7649)]
Signed-off-by: Jason Gerecke <***@wacom.com>
---
3.17/wacom_wac.c | 28 ++++++++++++++++++++++++++--
3.17/wacom_wac.h | 12 ++++++++++++
2 files changed, 38 insertions(+), 2 deletions(-)

diff --git a/3.17/wacom_wac.c b/3.17/wacom_wac.c
index c610f3f..8b50416 100644
--- a/3.17/wacom_wac.c
+++ b/3.17/wacom_wac.c
@@ -1447,6 +1447,11 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
{
int fmin = field->logical_minimum;
int fmax = field->logical_maximum;
+ int resolution_code = code;
+
+ if (usage->hid == HID_DG_TWIST) {
+ resolution_code = ABS_RZ;
+ }

usage->type = type;
usage->code = code;
@@ -1457,7 +1462,7 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,
case EV_ABS:
input_set_abs_params(input, code, fmin, fmax, fuzz, 0);
input_abs_set_res(input, code,
- hidinput_calc_abs_res(field, code));
+ hidinput_calc_abs_res(field, resolution_code));
break;
case EV_KEY:
input_set_capability(input, EV_KEY, code);
@@ -1482,6 +1487,9 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
case HID_GD_Y:
wacom_map_usage(input, usage, field, EV_ABS, ABS_Y, 4);
break;
+ case HID_GD_Z:
+ wacom_map_usage(input, usage, field, EV_ABS, ABS_DISTANCE, 0);
+ break;
case HID_DG_TIPPRESSURE:
wacom_map_usage(input, usage, field, EV_ABS, ABS_PRESSURE, 0);
break;
@@ -1492,6 +1500,15 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
wacom_map_usage(input, usage, field, EV_KEY,
BTN_TOOL_RUBBER, 0);
break;
+ case HID_DG_TILT_X:
+ wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_X, 0);
+ break;
+ case HID_DG_TILT_Y:
+ wacom_map_usage(input, usage, field, EV_ABS, ABS_TILT_Y, 0);
+ break;
+ case HID_DG_TWIST:
+ wacom_map_usage(input, usage, field, EV_ABS, ABS_Z, 0);
+ break;
case HID_DG_ERASER:
case HID_DG_TIPSWITCH:
wacom_map_usage(input, usage, field, EV_KEY, BTN_TOUCH, 0);
@@ -1515,8 +1532,15 @@ static int wacom_wac_pen_event(struct hid_device *hdev, struct hid_field *field,
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
struct input_dev *input = wacom_wac->pen_input;

- /* checking which Tool / tip switch to send */
switch (usage->hid) {
+ case HID_GD_Z:
+ /*
+ * HID_GD_Z "should increase as the control's position is
+ * moved from high to low", while ABS_DISTANCE instead
+ * increases in value as the tool moves from low to high.
+ */
+ value = field->logical_maximum - value;
+ break;
case HID_DG_INRANGE:
wacom_wac->hid_data.inrange_state = value;
return 0;
diff --git a/3.17/wacom_wac.h b/3.17/wacom_wac.h
index 7ea5794..8faa7fe 100644
--- a/3.17/wacom_wac.h
+++ b/3.17/wacom_wac.h
@@ -84,6 +84,18 @@
#define WACOM_DEVICETYPE_WL_MONITOR 0x0008
#define WACOM_DEVICETYPE_DIRECT 0x0010

+#ifndef HID_DG_TILT_X
+#define HID_DG_TILT_X (HID_UP_DIGITIZER | 0x3D)
+#endif
+
+#ifndef HID_DG_TILT_Y
+#define HID_DG_TILT_Y (HID_UP_DIGITIZER | 0x3E)
+#endif
+
+#ifndef HID_DG_TWIST
+#define HID_DG_TWIST (HID_UP_DIGITIZER | 0x41)
+#endif
+
#define WACOM_HID_UP_WACOMDIGITIZER 0xff0d0000
#define WACOM_HID_WD_DIGITIZER (WACOM_HID_UP_WACOMDIGITIZER | 0x01)
#define WACOM_HID_UP_G9 0xff090000
--
2.10.2


------------------------------------------------------------------------------
Jason Gerecke
2016-11-16 19:15:40 UTC
Permalink
The airbrush fingerwheel does not have a usage that corresponds cleanly
with a standard HID usage, so we add explicit support for it via its
vendor-defined usage.

Signed-off-by: Jason Gerecke <***@wacom.com>
Reviewed-by: Benjamin Tissoires <***@redhat.com>
[***@wacom.com: Imported into input-wacom repository (929d6d5)]
Signed-off-by: Jason Gerecke <***@wacom.com>
[***@wacom.com: backported from input-wacom repository (899e3e6)]
Signed-off-by: Jason Gerecke <***@wacom.com>
---
3.17/wacom_wac.c | 3 +++
3.17/wacom_wac.h | 1 +
2 files changed, 4 insertions(+)

diff --git a/3.17/wacom_wac.c b/3.17/wacom_wac.c
index 9f92ea0..0b5c6f4 100644
--- a/3.17/wacom_wac.c
+++ b/3.17/wacom_wac.c
@@ -1546,6 +1546,9 @@ static void wacom_wac_pen_usage_mapping(struct hid_device *hdev,
case HID_DG_TOOLSERIALNUMBER:
wacom_map_usage(input, usage, field, EV_MSC, MSC_SERIAL, 0);
break;
+ case WACOM_HID_WD_FINGERWHEEL:
+ wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0);
+ break;
}
}

diff --git a/3.17/wacom_wac.h b/3.17/wacom_wac.h
index 131b469..f81b9ed 100644
--- a/3.17/wacom_wac.h
+++ b/3.17/wacom_wac.h
@@ -101,6 +101,7 @@
#define WACOM_HID_SP_DIGITIZERINFO 0x00100000
#define WACOM_HID_WD_DIGITIZER (WACOM_HID_UP_WACOMDIGITIZER | 0x01)
#define WACOM_HID_WD_DISTANCE (WACOM_HID_UP_WACOMDIGITIZER | 0x0132)
+#define WACOM_HID_WD_FINGERWHEEL (WACOM_HID_UP_WACOMDIGITIZER | 0x0d03)
#define WACOM_HID_WD_DATAMODE (WACOM_HID_UP_WACOMDIGITIZER | 0x1002)
#define WACOM_HID_UP_G9 0xff090000
#define WACOM_HID_G9_PEN (WACOM_HID_UP_G9 | 0x02)
--
2.10.2


------------------------------------------------------------------------------
Jason Gerecke
2016-11-16 19:15:36 UTC
Permalink
The product name received from the string descriptor in the new MobileStudio
Pro line of tablets begins with "Wacom", which leads to unnecessary visual
noise in the device name when appended to the vendor name which also includes
"Wacom". Look for and fix cases like this.

Signed-off-by: Jason Gerecke <***@wacom.com>
Reviewed-by: Benjamin Tissoires <***@redhat.com>
[***@wacom.com: Imported into input-wacom repository (f2209d4)]
Signed-off-by: Jason Gerecke <***@wacom.com>
[***@wacom.com: backported from input-wacom repository (b0fa322)]
Signed-off-by: Jason Gerecke <***@wacom.com>
---
3.17/wacom_sys.c | 13 +++++++++++++
1 file changed, 13 insertions(+)

diff --git a/3.17/wacom_sys.c b/3.17/wacom_sys.c
index c6f1da1..16c8083 100644
--- a/3.17/wacom_sys.c
+++ b/3.17/wacom_sys.c
@@ -1765,6 +1765,19 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
/* shift everything including the terminator */
memmove(gap, gap+1, strlen(gap));
}
+
+ /* strip off excessive prefixing */
+ if (strstr(name, "Wacom Co.,Ltd. Wacom ") == name) {
+ int n = strlen(name);
+ int x = strlen("Wacom Co.,Ltd. ");
+ memmove(name, name+x, n-x+1);
+ }
+ if (strstr(name, "Wacom Co., Ltd. Wacom ") == name) {
+ int n = strlen(name);
+ int x = strlen("Wacom Co., Ltd. ");
+ memmove(name, name+x, n-x+1);
+ }
+
/* get rid of trailing whitespace */
if (name[strlen(name)-1] == ' ')
name[strlen(name)-1] = '\0';
--
2.10.2


------------------------------------------------------------------------------
Loading...