From patchwork Fri Mar 20 16:06:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Seth Forshee X-Patchwork-Id: 452702 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 809C6140134; Sat, 21 Mar 2015 03:07:17 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1YYzS4-0000vw-2r; Fri, 20 Mar 2015 16:07:12 +0000 Received: from mail-oi0-f45.google.com ([209.85.218.45]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1YYzRq-0000qv-4X for kernel-team@lists.ubuntu.com; Fri, 20 Mar 2015 16:06:58 +0000 Received: by oifl3 with SMTP id l3so64876440oif.0 for ; Fri, 20 Mar 2015 09:06:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Jxwmx9ZyGfjhq3HiJdL73FS0Ql5bo5UK1JN9gh1q0KI=; b=UzqV75p4i+eapHND3AdsnTSOWUExK6Tldb3SpVTYfKTbDQMWIXpEeMb1fz06iAgXaP T5NBVGtE+KqaL98A88ecBEBZ6kdVJS2QiqUINpY75cDj+NzBqc7k7CQ683ALlHjcOLQE C16nqVJ5uM1RO4O1O7i6GWtZAF2gm7yFg8XMamZWjYbhN7yjf7rNAlOgc6WQAaJACV1h kj34VDMpukTugBiXW4Gij1/0t0qi9O0/xMKNoW9k07ouassUvzi8Ps1ZTUUPNjfoskd7 UC/Ke5DKbmxohXY1aRnVSa35057Rkeq1lVTzfHkLWpl8D6lhc6mkKClk6M7PFU076hJh ecGw== X-Gm-Message-State: ALoCoQkmX6vvZ4JdiG7ZE0YY0i0jk93+gwZq5xlAbx/p/PRkUPlz3jO1S0QlWxkfTbuhLg+Q0WT3 X-Received: by 10.202.197.139 with SMTP id v133mr27677905oif.1.1426867617483; Fri, 20 Mar 2015 09:06:57 -0700 (PDT) Received: from localhost (199-87-125-144.dyn.kc.surewest.net. [199.87.125.144]) by mx.google.com with ESMTPSA id z2sm2717449oex.14.2015.03.20.09.06.56 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 20 Mar 2015 09:06:57 -0700 (PDT) From: Seth Forshee To: kernel-team@lists.ubuntu.com Subject: [PATCH 1/2][vivid] HID: multitouch: add support of clickpads Date: Fri, 20 Mar 2015 11:06:51 -0500 Message-Id: <1426867612-105220-2-git-send-email-seth.forshee@canonical.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1426867612-105220-1-git-send-email-seth.forshee@canonical.com> References: <1426867612-105220-1-git-send-email-seth.forshee@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Benjamin Tissoires Touchpads that have only one button are called clickpads and should be advertised as such by the kernel. Signed-off-by: Benjamin Tissoires Tested-by: Jason Ekstrand Signed-off-by: Jiri Kosina (cherry picked from commit 015fdaa9f8edd89a456b3331088e1b77ebdad9d0 git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid.git) Signed-off-by: Seth Forshee --- drivers/hid/hid-multitouch.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index f65e78b..ef06dc3 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -116,6 +116,7 @@ struct mt_device { __u8 touches_by_report; /* how many touches are present in one report: * 1 means we should use a serial protocol * > 1 means hybrid (multitouch) protocol */ + __u8 buttons_count; /* number of physical buttons per touchpad */ bool serial_maybe; /* need to check for serial protocol */ bool curvalid; /* is the current contact valid? */ unsigned mt_flags; /* flags to pass to input-mt */ @@ -379,6 +380,10 @@ static int mt_touch_input_mapping(struct hid_device *hdev, struct hid_input *hi, td->inputmode_value = MT_INPUTMODE_TOUCHPAD; } + /* count the buttons on touchpads */ + if ((usage->hid & HID_USAGE_PAGE) == HID_UP_BUTTON) + td->buttons_count++; + if (usage->usage_index) prev_usage = &field->usage[usage->usage_index - 1]; @@ -728,6 +733,10 @@ static void mt_touch_input_configured(struct hid_device *hdev, if (cls->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP) td->mt_flags |= INPUT_MT_DROP_UNUSED; + /* check for clickpads */ + if ((td->mt_flags & INPUT_MT_POINTER) && (td->buttons_count == 1)) + __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); + input_mt_init_slots(input, td->maxcontacts, td->mt_flags); td->mt_flags = 0;