From patchwork Mon Apr 25 18:27:40 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 8931281 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 4DB7C9F1C1 for ; Mon, 25 Apr 2016 18:27:45 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 779F120155 for ; Mon, 25 Apr 2016 18:27:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 751772012D for ; Mon, 25 Apr 2016 18:27:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754901AbcDYS1m (ORCPT ); Mon, 25 Apr 2016 14:27:42 -0400 Received: from mail-vk0-f41.google.com ([209.85.213.41]:34916 "EHLO mail-vk0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754810AbcDYS1m (ORCPT ); Mon, 25 Apr 2016 14:27:42 -0400 Received: by mail-vk0-f41.google.com with SMTP id u23so1508787vkb.2 for ; Mon, 25 Apr 2016 11:27:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:cc; bh=fc/b9ywI8Bv10w4pCWKphgeMwFFIk09XtLrc6wRle+I=; b=FFRii5VsLOo7U4PHucUj0bIhbaGRRaTMtahMYh30r/XCa9r+xWXGLxj6zW9CLhtnKG CJEA12XxA2CAb+rwNY74vrSTxxBVULxfaiEVtZ0Lm4q1dzyKPZUzG7DrvOX8z0vKfaav 95bOl/K7bT1Wtn/CmuXscXRu98Uk4oWtfE3IwqF4fXJfJoWltlEz7Z66Gk8GJ/a+JEI5 lmh9xyVsw8dIJNpRxicjqcpc3MyTs/TJcFdYEVtCZYtQqr2htH0YgjT6PK+ym3matHZj R6XbkxJWmJeK+ZByFuNAHcRJcj3KFxSi9r8RvYB1g0meHkeZ4uPxAbB85D1Gv+8jKrRw /3dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to:cc; bh=fc/b9ywI8Bv10w4pCWKphgeMwFFIk09XtLrc6wRle+I=; b=JIwwe7BDy+KKE251x2lYkT2XyjbEbdWKaPYxeR8ALyRY987RKPZ6m7AmSIoKZuH940 2RyWhR1x+8vozFtJfLOhmlkEetp1/BhJDdXF3s6pmNG9x4eIOiLuk8u6dVfvbMDsX/4F wlTavsGvZzUZGXmjME3r5bFSqJAwu/bgBHjOpjOSCdUVQrhIDpSQG4g7vNGkHVBOwTHH INRB9oEKg0L79KiN6EaSeMmqjW+fJdVTFzQJd5SbxqzPwFVxWeymY7DX7aE0L8GsLTyN 1N5gOJ/nkZZuVDOCn+IAli3xTXeVVsoJhmy7+Bx5ko8lqjcff6QJnotKWsIQDzEfWwZC zs1Q== X-Gm-Message-State: AOPr4FWQSf7qk5fs/M1mQ695rX9iKTFJnwB/IFMzkIWe2Uv7wpFitudXoHJaJ3PNuAWK8aoqBCS7v9BmFvbJaA== MIME-Version: 1.0 X-Received: by 10.176.3.77 with SMTP id 71mr17067200uat.0.1461608861046; Mon, 25 Apr 2016 11:27:41 -0700 (PDT) Received: by 10.31.47.129 with HTTP; Mon, 25 Apr 2016 11:27:40 -0700 (PDT) Date: Mon, 25 Apr 2016 11:27:40 -0700 Message-ID: Subject: [PATCH] HID: wacom: Add fuzz factor to distance and tilt axes From: Jason Gerecke To: Linux Input Cc: Jiri Kosina , Ping Cheng , Aaron Skomra , Benjamin Tissoires Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, T_TVD_MIME_EPI,UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The fuzz present on the distance and tilt axes is noticable when a puck is present, and userspace (specifically libinput) would like the ability to filter out the noise. To facilitate this, we assign a fuzz value of '1' for the distance and tilt axes. This is large enough to cover most of the natural variation in distance value as the puck is moved around, and enough to cover the jitter in rotation (reported through tilt axes) when the puck is left alone. Signed-off-by: Jason Gerecke --- Apologies for attaching rather than inlining the patch. I'm stuck with using GMail's web interface instead of 'git-send-email' or a real client at the moment... From a2aa9d04d6918169fd0fbf29bf7cf9e172320844 Mon Sep 17 00:00:00 2001 From: Jason Gerecke Date: Fri, 22 Apr 2016 14:30:53 -0700 Subject: [PATCH] HID: wacom: Add fuzz factor to distance and tilt axes The fuzz present on the distance and tilt axes is noticable when a puck is present, and userspace (specifically libinput) would like the ability to filter out the noise. To facilitate this, we assign a fuzz value of '1' for the distance and tilt axes. This is large enough to cover most of the natural variation in distance value as the puck is moved around, and enough to cover the jitter in rotation (reported through tilt axes) when the puck is left alone. Signed-off-by: Jason Gerecke --- drivers/hid/wacom_sys.c | 3 ++- drivers/hid/wacom_wac.c | 13 +++++++------ drivers/hid/wacom_wac.h | 1 + 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index ccf1883..499cc82 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c @@ -493,7 +493,8 @@ static void wacom_retrieve_hid_descriptor(struct hid_device *hdev, features->x_fuzz = 4; features->y_fuzz = 4; features->pressure_fuzz = 0; - features->distance_fuzz = 0; + features->distance_fuzz = 1; + features->tilt_fuzz = 1; /* * The wireless device HID is basic and layout conflicts with diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index e9902f2..25fdd97 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2343,12 +2343,13 @@ static void wacom_setup_basic_pro_pen(struct wacom_wac *wacom_wac) __set_bit(BTN_STYLUS2, input_dev->keybit); input_set_abs_params(input_dev, ABS_DISTANCE, - 0, wacom_wac->features.distance_max, 0, 0); + 0, wacom_wac->features.distance_max, wacom_wac->features.distance_fuzz, 0); } static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) { struct input_dev *input_dev = wacom_wac->pen_input; + struct wacom_features *features = &wacom_wac->features; wacom_setup_basic_pro_pen(wacom_wac); @@ -2358,9 +2359,9 @@ static void wacom_setup_cintiq(struct wacom_wac *wacom_wac) __set_bit(BTN_TOOL_AIRBRUSH, input_dev->keybit); input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); - input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, 0, 0); + input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, features->tilt_fuzz, 0); input_abs_set_res(input_dev, ABS_TILT_X, 57); - input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, 0, 0); + input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, features->tilt_fuzz, 0); input_abs_set_res(input_dev, ABS_TILT_Y, 57); } @@ -2506,7 +2507,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, case WACOM_G4: input_set_abs_params(input_dev, ABS_DISTANCE, 0, features->distance_max, - 0, 0); + features->distance_fuzz, 0); /* fall through */ case GRAPHIRE: @@ -2568,7 +2569,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, input_set_abs_params(input_dev, ABS_DISTANCE, 0, features->distance_max, - 0, 0); + features->distance_fuzz, 0); input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); input_abs_set_res(input_dev, ABS_Z, 287); @@ -2627,7 +2628,7 @@ int wacom_setup_pen_input_capabilities(struct input_dev *input_dev, __set_bit(BTN_STYLUS2, input_dev->keybit); input_set_abs_params(input_dev, ABS_DISTANCE, 0, features->distance_max, - 0, 0); + features->distance_fuzz, 0); } break; case BAMBOO_PAD: diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index e2084d9..53d1653 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -177,6 +177,7 @@ struct wacom_features { int y_fuzz; int pressure_fuzz; int distance_fuzz; + int tilt_fuzz; unsigned quirks; unsigned touch_max; int oVid; -- 2.8.0