Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1195457imu; Thu, 22 Nov 2018 11:54:17 -0800 (PST) X-Google-Smtp-Source: AFSGD/XnyfK/xP0gUQxqKkZcaQbHxk9nZWTMdjFx6gq9XXrpN/2+A1DGQkmnb8/1rHjcPuXNN+AZ X-Received: by 2002:a63:d70e:: with SMTP id d14mr11334074pgg.159.1542916457807; Thu, 22 Nov 2018 11:54:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542916457; cv=none; d=google.com; s=arc-20160816; b=wP67vT1lqXCAU96l3nnOQ4nB7l21KQU4mt7wy2sx+vB/uXmDpR01VZ1rM6rpT5+tXC R8TX9cBB+cLvIO72fcj+OV45vbt/rsxlLzXkIQxDVuW4ehGjE1Po3qq0YaTWHL6vgpt6 Tu1UQsoc8KDTkr4PjPerrNQuNQGh/6I08ZTHLRE0B2jsKjcPddZcR6zOurs0ES/4ZjMt TWJ7nbwZwKUr3cqLOq7SNMXePbrpQUYthc1c1ie9vgC5YJv8fA/gXZ8azKaDq+KwvvN3 l2yVc0ZVOvzIUFFbA2qI1cCXbw2c78Pg45MSR/JQWep7W+OEfNLM0oatNpgDN+aKKJUU Hocw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=EWHkzfmgSCYPLri429kutk56OLeJAwOmh3GF9c3Ry9g=; b=joNFPeDltSXEKuhgzxUgpdZvfS12kYwPDpKHcn4AcupcWr1REMaQVw4xXsfSkkpOCH 88yXIbBgpDPFfTSM0Hkv29FDJeHpnMNmFXZf1+B850iXZTDlvspeOWTgxQfaWxtBJuZj d5yCaukbI3jfA1WFxIGecATmF2Brf191vP0uYvRoDowKi4exchi6eSWWhJqrt6lyVd3U va3U+Y2PUKHYcPvagg6oJDiOnIUrHiAXpVSsIsqUCAV5eRWdmbpqn1ie9y3+rHfyeOvn KFSDCSAwyj5FYO50E9ylJfrKgM/omUthJ9LAfKYUwZXIjm+L/dQCImTW4xX79J82uk/Y Hi7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@who-t.net header.s=fm1 header.b=m0y4JKEj; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=iT4KQqEI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 31si50257939pgl.595.2018.11.22.11.54.03; Thu, 22 Nov 2018 11:54:17 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@who-t.net header.s=fm1 header.b=m0y4JKEj; dkim=pass header.i=@messagingengine.com header.s=fm1 header.b=iT4KQqEI; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404798AbeKVRNL (ORCPT + 99 others); Thu, 22 Nov 2018 12:13:11 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:46935 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404781AbeKVRNK (ORCPT ); Thu, 22 Nov 2018 12:13:10 -0500 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.nyi.internal (Postfix) with ESMTP id 630F3220FD; Thu, 22 Nov 2018 01:35:11 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute3.internal (MEProxy); Thu, 22 Nov 2018 01:35:11 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=who-t.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; s=fm1; bh=EWHkzfmgSCYPL ri429kutk56OLeJAwOmh3GF9c3Ry9g=; b=m0y4JKEjAMCYGRKioZFwH1ksbwJl2 KYSgneedMNDdfOl0JEWaAtyVMuUx6qYgaeFwzuCtoUoABZ47IiIE4MFQgUz+qHZT B96fa/JTme+TBK8ghuzCM5QwQQfMHk8VcQyR68Y+bBGgrhxO1HwFoMP7WKMAFeSS h8c2FAlCAimPvPWUUjkOXR/5YH8HakOSdnmuVeHJGcwcF1IVfPReWwHfHm5E3I4Q sqZzJiNdNV1z6g9F+ZvuYakjNds0oJ4nU9DZRvVMAux9PD9PgYzWo66rGktCjGnr HODeF0HVk9BGG8BZi4OofmhNsF3VJAE3Mwk+2QpKrEGH40zU690Mx6F6Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=EWHkzfmgSCYPLri429kutk56OLeJAwOmh3GF9c3Ry9g=; b=iT4KQqEI RI49wtzuUlj9oxOiiCgBirUeybjeiSY+JItg2dINqnB3gQVnZxSxYHEh/7RgauUs wdditi/pNSpK+YgEymSEGJVn14iZT1xQkw69NvPNu6QjasOc5c2ynfLsmrta06OD wFUQKAsB4jFjyCAJQHQmMT9ZwXEKTJtVTTGqBXCq38ApLacQ3L7okGUbtlj2M58D aKaM/mTMGfwKv9cDUtpx6l7sQatd5HoUMPW9uWSPemYCig3Fm6RlZ+Ewiqosqfw8 bD+CfC2fs/x+cuik7qRkwrDqjys3cvaWAS5tNLZBAkpwpfXsAtDf1IBrnVHo4Ps/ 5+/MJz1qo38rug== X-ME-Sender: X-ME-Proxy: Received: from jelly.home.gateway (167-179-166-29.a7b3a6.bne.nbn.aussiebb.net [167.179.166.29]) by mail.messagingengine.com (Postfix) with ESMTPA id 8156C102DE; Thu, 22 Nov 2018 01:35:08 -0500 (EST) From: Peter Hutterer To: linux-input@vger.kernel.org Cc: Dmitry Torokhov , Jiri Kosina , Harry Cutts , torvalds@linux-foundation.org, Nestor Lopez Casado , linux-kernel@vger.kernel.org, Benjamin Tissoires Subject: [PATCH 7/8] HID: logitech: Add function to enable HID++ 1.0 "scrolling acceleration" Date: Thu, 22 Nov 2018 16:34:08 +1000 Message-Id: <20181122063409.15816-8-peter.hutterer@who-t.net> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181122063409.15816-1-peter.hutterer@who-t.net> References: <20181122063409.15816-1-peter.hutterer@who-t.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Harry Cutts "Scrolling acceleration" is a bit of a misnomer: it doesn't deal with acceleration at all. However, that's the name used in Logitech's spec, so I used it here. Signed-off-by: Harry Cutts Reviewed-by: Benjamin Tissoires Signed-off-by: Peter Hutterer --- Unmodified, same as the reverted 051dc9b0 drivers/hid/hid-logitech-hidpp.c | 47 +++++++++++++++++++++++--------- 1 file changed, 34 insertions(+), 13 deletions(-) diff --git a/drivers/hid/hid-logitech-hidpp.c b/drivers/hid/hid-logitech-hidpp.c index 146feedd9a2f..67ca587aecfa 100644 --- a/drivers/hid/hid-logitech-hidpp.c +++ b/drivers/hid/hid-logitech-hidpp.c @@ -400,32 +400,53 @@ static void hidpp_prefix_name(char **name, int name_length) #define HIDPP_SET_LONG_REGISTER 0x82 #define HIDPP_GET_LONG_REGISTER 0x83 -#define HIDPP_REG_GENERAL 0x00 - -static int hidpp10_enable_battery_reporting(struct hidpp_device *hidpp_dev) +/** + * hidpp10_set_register_bit() - Sets a single bit in a HID++ 1.0 register. + * @hidpp_dev: the device to set the register on. + * @register_address: the address of the register to modify. + * @byte: the byte of the register to modify. Should be less than 3. + * Return: 0 if successful, otherwise a negative error code. + */ +static int hidpp10_set_register_bit(struct hidpp_device *hidpp_dev, + u8 register_address, u8 byte, u8 bit) { struct hidpp_report response; int ret; u8 params[3] = { 0 }; ret = hidpp_send_rap_command_sync(hidpp_dev, - REPORT_ID_HIDPP_SHORT, - HIDPP_GET_REGISTER, - HIDPP_REG_GENERAL, - NULL, 0, &response); + REPORT_ID_HIDPP_SHORT, + HIDPP_GET_REGISTER, + register_address, + NULL, 0, &response); if (ret) return ret; memcpy(params, response.rap.params, 3); - /* Set the battery bit */ - params[0] |= BIT(4); + params[byte] |= BIT(bit); return hidpp_send_rap_command_sync(hidpp_dev, - REPORT_ID_HIDPP_SHORT, - HIDPP_SET_REGISTER, - HIDPP_REG_GENERAL, - params, 3, &response); + REPORT_ID_HIDPP_SHORT, + HIDPP_SET_REGISTER, + register_address, + params, 3, &response); +} + + +#define HIDPP_REG_GENERAL 0x00 + +static int hidpp10_enable_battery_reporting(struct hidpp_device *hidpp_dev) +{ + return hidpp10_set_register_bit(hidpp_dev, HIDPP_REG_GENERAL, 0, 4); +} + +#define HIDPP_REG_FEATURES 0x01 + +/* On HID++ 1.0 devices, high-res scroll was called "scrolling acceleration". */ +static int hidpp10_enable_scrolling_acceleration(struct hidpp_device *hidpp_dev) +{ + return hidpp10_set_register_bit(hidpp_dev, HIDPP_REG_FEATURES, 0, 6); } #define HIDPP_REG_BATTERY_STATUS 0x07 -- 2.19.1