From patchwork Wed Apr 11 19:09:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ganzhorn X-Patchwork-Id: 10336775 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 7910E6053C for ; Wed, 11 Apr 2018 19:09:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6A2B827F91 for ; Wed, 11 Apr 2018 19:09:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5E27C27F98; Wed, 11 Apr 2018 19:09:44 +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=-7.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, 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 58B4227F91 for ; Wed, 11 Apr 2018 19:09:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756876AbeDKTJk (ORCPT ); Wed, 11 Apr 2018 15:09:40 -0400 Received: from mail-wm0-f67.google.com ([74.125.82.67]:40446 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756877AbeDKTJh (ORCPT ); Wed, 11 Apr 2018 15:09:37 -0400 Received: by mail-wm0-f67.google.com with SMTP id x4so5603417wmh.5 for ; Wed, 11 Apr 2018 12:09:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QgBpu/cUNpWb+bu9ak/9EtkFxcgxCNMAdq992BMLch0=; b=hMbHbLaM2xuUaEBX3qMe2MS+cSCGFESTmqb+6CvLqs/VC63a24WJ4dYCJnrGH8wDHR DvJhFyWbl4NzXL73unSTPVpF2xcEbbGzyTDjHxgp7t9/FgRtzlTd0QlOU9Zyx3zxzq+D VkzG0LX9VV1QBT5Ds+DXYSKczgdKtWvDZymZD20uu/MbmKYGDeT5+QesXdZhr4L5snTP 0iuz12wegcmQ5j2pb8DoVFA4XT0OEUTuaUPBZ2i3BYe7HwVCNwcY5OZoy9cwNCOuIauG FEByhdgt96w6dHpDwUPVcpLfW2imWVubFu4dtZAinOYYVjExkC0zulxkFmVqHsMMgZ8d h9zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QgBpu/cUNpWb+bu9ak/9EtkFxcgxCNMAdq992BMLch0=; b=s6Wo42Rby4CqSRJtA/ZsxRbnz1rOnixUj5ilxtnCzPo25AtHR00A3nN2iwYb79+tbv yA2iIuUoSwMjeJiCdKkl3scYDO2QUuW9hMI5IcUd+5YD/M66p5bGbUjwHtJPx47v3C4S Ys/TcVsUNJg/a01fkHmtqG8InK1zfAPDZPTX9fzhm5MvvXqAgDe958HejcM7b90r0odi n5IAkHbjBI8py0JgRIF8nMsou9jQ8YRiaUg2+QcLhAWY1RbkScdy18gAgZwQsnHKBEgz HjWVGST9+dBYEPRRCqWam06deMFD/0SkHhPCtW4gTQ6YjYZXdA6ItKzC4sCL1uk8oEdI qn4A== X-Gm-Message-State: ALQs6tA1Au1mOPT9lDafNjwg9bWJKvd/WmoIV+1vVoUnRrPaNcxWBQK0 tMv1P3EVhz9pva8hFaZgPNIceXda X-Google-Smtp-Source: AIpwx48x9Zs/UoJ/cJ3nPOm/ZL0EQfuQFXijP/wWpFSyATWB2N7RBF++OclpGEkrVU+POZPRnb5pSg== X-Received: by 10.28.85.137 with SMTP id j131mr3705899wmb.94.1523473775991; Wed, 11 Apr 2018 12:09:35 -0700 (PDT) Received: from orion.fritz.box (p57AB1D71.dip0.t-ipconnect.de. [87.171.29.113]) by smtp.gmail.com with ESMTPSA id y101sm2252058wmh.10.2018.04.11.12.09.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Apr 2018 12:09:35 -0700 (PDT) From: Peter Ganzhorn To: linux-input@vger.kernel.org Cc: jikos@kernel.org, benjamin.tissoires@redhat.com, pdewacht@gmail.com, peter.ganzhorn@gmail.com Subject: [PATCH 2/2] Enable IBM/Lenovo Scrollpoint mice horizontal scrolling. Date: Wed, 11 Apr 2018 21:09:03 +0200 Message-Id: <20180411190903.11442-3-peter.ganzhorn@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180411190903.11442-1-peter.ganzhorn@gmail.com> References: <20180411190903.11442-1-peter.ganzhorn@gmail.com> 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 Signed-off-by: Peter Ganzhorn --- drivers/hid/Kconfig | 7 ++++--- drivers/hid/hid-lenovo.c | 36 ++++++++++++++++++++++++++++++++++++ drivers/hid/hid-quirks.c | 6 ++++++ 3 files changed, 46 insertions(+), 3 deletions(-) diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 60252fd796f6..ab5e84018345 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -462,10 +462,11 @@ config HID_LENOVO select NEW_LEDS select LEDS_CLASS ---help--- - Support for Lenovo devices that are not fully compliant with HID standard. + Support for IBM/Lenovo devices that are not fully compliant with HID standard. - Say Y if you want support for the non-compliant features of the Lenovo - Thinkpad standalone keyboards, e.g: + Say Y if you want support for horizontal scrolling with the IBM/Lenovo + Scrollpoint mice or the non-compliant features of the Lenovo Thinkpad + standalone keyboards, e.g: - ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint configuration) - ThinkPad Compact Bluetooth Keyboard with TrackPoint (supports Fn keys) diff --git a/drivers/hid/hid-lenovo.c b/drivers/hid/hid-lenovo.c index 1ac4ff4d57a6..643b6eb54442 100644 --- a/drivers/hid/hid-lenovo.c +++ b/drivers/hid/hid-lenovo.c @@ -6,6 +6,17 @@ * * Copyright (c) 2012 Bernhard Seibold * Copyright (c) 2014 Jamie Lentin + * + * Linux IBM/Lenovo Scrollpoint mouse driver: + * - IBM Scrollpoint III + * - IBM Scrollpoint Pro + * - IBM Scrollpoint Optical + * - IBM Scrollpoint Optical 800dpi + * - IBM Scrollpoint Optical 800dpi Pro + * - Lenovo Scrollpoint Optical + * + * Copyright (c) 2012 Peter De Wachter + * Copyright (c) 2018 Peter Ganzhorn */ /* @@ -160,6 +171,17 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev, return 0; } +static int lenovo_input_mapping_scrollpoint(struct hid_device *hdev, + struct hid_input *hi, struct hid_field *field, + struct hid_usage *usage, unsigned long **bit, int *max) +{ + if (usage->hid == HID_GD_Z) { + hid_map_usage(hi, usage, bit, max, EV_REL, REL_HWHEEL); + return 1; + } + return 0; +} + static int lenovo_input_mapping(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) @@ -172,6 +194,14 @@ static int lenovo_input_mapping(struct hid_device *hdev, case USB_DEVICE_ID_LENOVO_CBTKBD: return lenovo_input_mapping_cptkbd(hdev, hi, field, usage, bit, max); + case USB_DEVICE_ID_IBM_SCROLLPOINT_III: + case USB_DEVICE_ID_IBM_SCROLLPOINT_PRO: + case USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL: + case USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL: + case USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO: + case USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL: + return lenovo_input_mapping_scrollpoint(hdev, hi, field, + usage, bit, max); default: return 0; } @@ -883,6 +913,12 @@ static const struct hid_device_id lenovo_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) }, + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_III) }, + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_PRO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL) }, + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL) }, + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL) }, { } }; diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c index 587e2681a53f..d5ff6de75e0b 100644 --- a/drivers/hid/hid-quirks.c +++ b/drivers/hid/hid-quirks.c @@ -428,6 +428,12 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CUSBKBD) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_CBTKBD) }, { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPPRODOCK) }, + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_III) }, + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_PRO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_OPTICAL) }, + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL) }, + { HID_USB_DEVICE(USB_VENDOR_ID_IBM, USB_DEVICE_ID_IBM_SCROLLPOINT_800DPI_OPTICAL_PRO) }, + { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_SCROLLPOINT_OPTICAL) }, #endif #if IS_ENABLED(CONFIG_HID_LOGITECH) { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) },