From patchwork Mon Apr 13 06:07:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Hellstrom X-Patchwork-Id: 6205071 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 29D039F1C4 for ; Mon, 13 Apr 2015 06:08:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4A85B2026C for ; Mon, 13 Apr 2015 06:08:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4EC5E200CF for ; Mon, 13 Apr 2015 06:08:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751498AbbDMGIN (ORCPT ); Mon, 13 Apr 2015 02:08:13 -0400 Received: from smtp-outbound-2.vmware.com ([208.91.2.13]:45242 "EHLO smtp-outbound-2.vmware.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751418AbbDMGIM (ORCPT ); Mon, 13 Apr 2015 02:08:12 -0400 Received: from sc9-mailhost1.vmware.com (sc9-mailhost1.vmware.com [10.113.161.71]) by smtp-outbound-2.vmware.com (Postfix) with ESMTP id 4BB97282EC; Sun, 12 Apr 2015 23:08:12 -0700 (PDT) Received: from EX13-CAS-010.vmware.com (EX13-CAS-010.vmware.com [10.113.191.62]) by sc9-mailhost1.vmware.com (Postfix) with ESMTP id 473D1183F9; Sun, 12 Apr 2015 23:08:12 -0700 (PDT) Received: from localhost.localdomain (10.113.160.246) by EX13-MBX-024.vmware.com (10.113.191.44) with Microsoft SMTP Server (TLS) id 15.0.913.22; Sun, 12 Apr 2015 23:08:07 -0700 From: Thomas Hellstrom To: CC: , , , Thomas Hellstrom Subject: [PATCH 2/2] Input: Allow devices to state that they aren't joysticks Date: Sun, 12 Apr 2015 23:07:51 -0700 Message-ID: <1428905271-3416-3-git-send-email-thellstrom@vmware.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1428905271-3416-1-git-send-email-thellstrom@vmware.com> References: <1428905271-3416-1-git-send-email-thellstrom@vmware.com> MIME-Version: 1.0 X-Originating-IP: [10.113.160.246] X-ClientProxiedBy: EX13-CAS-013.vmware.com (10.113.191.65) To EX13-MBX-024.vmware.com (10.113.191.44) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable 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 Sometimes the device driver knows that a device isn't a joystick. In those cases, allow the driver to ovveride joydev's guess. Signed-off-by: Thomas Hellstrom --- drivers/input/joydev.c | 4 ++++ drivers/input/mouse/vmmouse.c | 1 + include/linux/input.h | 5 +++++ 3 files changed, 10 insertions(+) diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index f362883..6add101 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c @@ -750,6 +750,10 @@ static void joydev_cleanup(struct joydev *joydev) static bool joydev_match(struct input_handler *handler, struct input_dev *dev) { + /* Avoid devices that explicitly don't want to be joysticks */ + if (dev->flags & INPUT_FLAG_NO_JOYSTICK) + return false; + /* Avoid touchpads and touchscreens */ if (test_bit(EV_KEY, dev->evbit) && test_bit(BTN_TOUCH, dev->keybit)) return false; diff --git a/drivers/input/mouse/vmmouse.c b/drivers/input/mouse/vmmouse.c index b3a6170..0fabe3d 100644 --- a/drivers/input/mouse/vmmouse.c +++ b/drivers/input/mouse/vmmouse.c @@ -468,6 +468,7 @@ int vmmouse_init(struct psmouse *psmouse) abs_dev->id.product = PSMOUSE_VMMOUSE; abs_dev->id.version = psmouse->model; abs_dev->dev.parent = &psmouse->ps2dev.serio->dev; + abs_dev->flags |= INPUT_FLAG_NO_JOYSTICK; if (input_register_device(priv->abs_dev)) goto init_fail; diff --git a/include/linux/input.h b/include/linux/input.h index 82ce323..516387e 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -117,6 +117,7 @@ struct input_value { * @vals: array of values queued in the current frame * @devres_managed: indicates that devices is managed with devres framework * and needs not be explicitly unregistered or freed. + * @flags: Device flags. */ struct input_dev { const char *name; @@ -187,9 +188,13 @@ struct input_dev { struct input_value *vals; bool devres_managed; + + u32 flags; }; #define to_input_dev(d) container_of(d, struct input_dev, dev) +#define INPUT_FLAG_NO_JOYSTICK (1 << 0) + /* * Verify that we are in sync with input_device_id mod_devicetable.h #defines */