On Wed, Sep 14, 2011 at 6:36 PM, <chris@xxxxxxxxxxxxxx> wrote: > From: Chris Bagwell <chris@xxxxxxxxxxxxxx> > > Tablet reports a distance of 0 right at highest point possible > to be in proximity and distance_max when touching tablet. Inverse > the distance since user land has no way of knowing ABS_DISTANCE > is not distance from tablet. > > Signed-off-by: Chris Bagwell <chris@xxxxxxxxxxxxxx> In case Dmitry is waiting for my confirmation for this patch (all patches in this series are either acked or reviewed): Acked-by: Ping Cheng <pingc@xxxxxxxxx> Thanks. Ping > --- > drivers/input/tablet/wacom_wac.c | 34 ++++++++++++++++++++++------------ > 1 files changed, 22 insertions(+), 12 deletions(-) > > diff --git a/drivers/input/tablet/wacom_wac.c b/drivers/input/tablet/wacom_wac.c > index 1503425..d7da1b0 100644 > --- a/drivers/input/tablet/wacom_wac.c > +++ b/drivers/input/tablet/wacom_wac.c > @@ -874,7 +874,14 @@ static int wacom_bpt_pen(struct wacom_wac *wacom) > x = le16_to_cpup((__le16 *)&data[2]); > y = le16_to_cpup((__le16 *)&data[4]); > p = le16_to_cpup((__le16 *)&data[6]); > - d = data[8]; > + /* convert distance from out prox to distance from tablet. > + * distance will be greater than distance_max once > + * touching and applying pressure. do not report negative > + * distance. > + */ > + if (data[8] <= wacom->features.distance_max) > + d = wacom->features.distance_max - data[8]; > + > pen = data[1] & 0x01; > btn1 = data[1] & 0x02; > btn2 = data[1] & 0x04; > @@ -1224,6 +1231,9 @@ void wacom_setup_input_capabilities(struct input_dev *input_dev, > __set_bit(BTN_TOOL_PEN, input_dev->keybit); > __set_bit(BTN_STYLUS, input_dev->keybit); > __set_bit(BTN_STYLUS2, input_dev->keybit); > + input_set_abs_params(input_dev, ABS_DISTANCE, 0, > + features->distance_max, > + 0, 0); > } > break; > } > @@ -1444,37 +1454,37 @@ static const struct wacom_features wacom_features_0x47 = > 31, INTUOS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > static const struct wacom_features wacom_features_0xD0 = > { "Wacom Bamboo 2FG", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, > - 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > static const struct wacom_features wacom_features_0xD1 = > { "Wacom Bamboo 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, > - 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > static const struct wacom_features wacom_features_0xD2 = > { "Wacom Bamboo Craft", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, > - 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > static const struct wacom_features wacom_features_0xD3 = > { "Wacom Bamboo 2FG 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, > - 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > static const struct wacom_features wacom_features_0xD4 = > { "Wacom Bamboo Pen", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, > - 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > static const struct wacom_features wacom_features_0xD5 = > { "Wacom Bamboo Pen 6x8", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, > - 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > static const struct wacom_features wacom_features_0xD6 = > { "Wacom BambooPT 2FG 4x5", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, > - 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > static const struct wacom_features wacom_features_0xD7 = > { "Wacom BambooPT 2FG Small", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, > - 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > static const struct wacom_features wacom_features_0xD8 = > { "Wacom Bamboo Comic 2FG", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, > - 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > static const struct wacom_features wacom_features_0xDA = > { "Wacom Bamboo 2FG 4x5 SE", WACOM_PKGLEN_BBFUN, 14720, 9200, 1023, > - 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > static struct wacom_features wacom_features_0xDB = > { "Wacom Bamboo 2FG 6x8 SE", WACOM_PKGLEN_BBFUN, 21648, 13530, 1023, > - 63, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > + 31, BAMBOO_PT, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > static const struct wacom_features wacom_features_0x6004 = > { "ISD-V4", WACOM_PKGLEN_GRAPHIRE, 12800, 8000, 255, > 0, TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; > -- > 1.7.6 > > -- To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html