From patchwork Thu Oct 27 21:31:13 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roderick Colenbrander X-Patchwork-Id: 9400479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id BF6C1600BA for ; Thu, 27 Oct 2016 21:31:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6FEE2A1E7 for ; Thu, 27 Oct 2016 21:31:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B1D52A3A4; Thu, 27 Oct 2016 21:31:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0BF0E2A1E7 for ; Thu, 27 Oct 2016 21:31:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752796AbcJ0Vbo (ORCPT ); Thu, 27 Oct 2016 17:31:44 -0400 Received: from mail-qk0-f174.google.com ([209.85.220.174]:36174 "EHLO mail-qk0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751152AbcJ0Vbn (ORCPT ); Thu, 27 Oct 2016 17:31:43 -0400 Received: by mail-qk0-f174.google.com with SMTP id o68so64252060qkf.3 for ; Thu, 27 Oct 2016 14:31:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gaikai-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=XAOeqmfy5mzJ5tt4K+5xCICd02BHhBCNBfNjUwheJpw=; b=WOp9aqPypKZa9x1lvs7jpt+0wZmYdNJG1OmYi+sfP0RMyWgDD0cPr9bsdmrffzSArx SSe/uEsREioRJ2YkAfDwXdppDvd4/PhhbF3i2eMnR2HByxpgLEyg0vO+8fo8fi0HldBK tazqPljCJe2fXzrftcLjLBEKcYuS+tGE5Pv1jMPin0HRQSpzY8j/xX5UDD7VQH09lEBl rpNTlznM9GVwFLcppuM28OPoWwqWza95wFFzlCnZmgnI4ZBAh0MpdL+4F5V/PUhTnl98 IoCwm8s0pvBxMnMCk2/D+HWR1p9bbFaSwO/TVAERFAVVp5Hp3esx6gU/JQdCwosL74IR 6kxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=XAOeqmfy5mzJ5tt4K+5xCICd02BHhBCNBfNjUwheJpw=; b=ZkOMRGhHhjZQPJNzKQHoC4+IQwN+x+iy7laS5FA6rTNshAw7vTQGD0uuLIi97OMno/ DjA0ob8KLEFwZn+JS8ezg6bDZaOWL9CixEbyMcuMZHqA+jltqbnaqVhbzFTOk3GC87jC qYb1Nm7LYYBNPWidqHB0zPwWj5dF9Th6vmxBjTvVWijdRpWz/g0+ohXvK5OLjpgS5mjC /hFlTyny5Am0GE+pnY9e8uGX90Gxm5jaqllbd/p348rLfGvp2cm7UtS69NuxTrSt6OPE fwv3nOV9SIkyrWA5HuOumFVMLddGi/a/QZwzQXEDXrrhQgAWQHZzYAGg0R8cWdk0X5lo OXYA== X-Gm-Message-State: ABUngvfMwAnve+nZQ35tn3GbOHMk12ZprKrtCvOf1ykqXM7HNL3fu1OUKcFG1UVQHPc7Gll6 X-Received: by 10.55.41.209 with SMTP id p78mr8629763qkp.282.1477603902934; Thu, 27 Oct 2016 14:31:42 -0700 (PDT) Received: from konan1.dev.biz ([100.42.98.197]) by smtp.gmail.com with ESMTPSA id j127sm2426676qkf.19.2016.10.27.14.31.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 27 Oct 2016 14:31:42 -0700 (PDT) From: Roderick Colenbrander To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Henrik Rydberg , Benjamin Tissoires , Tim Bird , Roderick Colenbrander Subject: [PATCH] Input: mt: only perform pointer emulation on drivers desiring this functionality Date: Thu, 27 Oct 2016 14:31:13 -0700 Message-Id: <1477603873-9143-1-git-send-email-roderick@gaikai.com> X-Mailer: git-send-email 2.7.4 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Roderick Colenbrander The input-mt driver pointer emulation from 'input_mt_sync_frame' regardless of the flags passed in to 'input_mt_init_slots' by device drivers. Pointer emulation is undesired on drivers, which didn't request this capability like the hid-sony driver for the Dualshock 4. This gamepad already reports ABS_X / ABS_Y for gamepad stick purposes. Pointer emulation would inject touchpad values into these sticks, which is undesired. This patch checks the flags INPUT_MT_POINTER / INPUT_MT_DIRECT from within input_mt_sync_frame to only allow pointer emulation when the feature was requested by the driver as the flags were set in input_mt_init_slots. --- drivers/input/input-mt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/input/input-mt.c b/drivers/input/input-mt.c index a1bbec9..30c8128 100644 --- a/drivers/input/input-mt.c +++ b/drivers/input/input-mt.c @@ -305,7 +305,8 @@ void input_mt_sync_frame(struct input_dev *dev) if ((mt->flags & INPUT_MT_POINTER) && !(mt->flags & INPUT_MT_SEMI_MT)) use_count = true; - input_mt_report_pointer_emulation(dev, use_count); + if (mt->flags & (INPUT_MT_POINTER | INPUT_MT_DIRECT)) + input_mt_report_pointer_emulation(dev, use_count); mt->frame++; }