From patchwork Tue Jul 30 15:51:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 815473 Received: from mail-pf1-f169.google.com (mail-pf1-f169.google.com [209.85.210.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83A441BA879 for ; Tue, 30 Jul 2024 15:52:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722354729; cv=none; b=bgobis41nTzo2G/KCF0iSCYOVTWltkInkQCA1dnXIehiYO8Y+BBSNadwQHvQcTpz2DCcezOHrK2JNbk+aaonYW5rFc2qzhtvAJr69zkK78d0iKtiX+QPtJevACX9MbhB5P7gyOxBBnDmqDJk6N9wrFAkCtpvpM+YNk+5tBZahDc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722354729; c=relaxed/simple; bh=31n1X/9lIbf+QGA+QLw85KXMy5B3Q3zT8UEtcF4M2ss=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=IdLOL37S5hXao/c53dD2wVdnECH1aZCTpWyQaBsdtzBt3YMi3/8G4HqtNoecZxNkmxjvAAZVDELaXFi+N55jH3s3WGv0TBC+xGjgpxNZKeaaD9c6X6n+TxVUK68cCUtQlxpRZvpKknYnkmFYNdFwdehjTQllzjyJPoi3Socx6Xg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Bw6lumzs; arc=none smtp.client-ip=209.85.210.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Bw6lumzs" Received: by mail-pf1-f169.google.com with SMTP id d2e1a72fcca58-70d25b5b6b0so3315273b3a.2 for ; Tue, 30 Jul 2024 08:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722354726; x=1722959526; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=pGjWryPa+E0i9O1vtsxMqVFVLNR1dXSU3MEx8xiuJFI=; b=Bw6lumzsFlUbrTAW5YH9vNK2j0/uhaodjBBbwuHUTzrhr4Com/dknI7ei7TXOvR9zw pvarCLVHjOp+ZWi3nEEo/4J2ASO3aykajG3D7y0e2gvFcNbqyolnubuCbZkQNa84zjEH AkNAwLZzmpfvMHNtFgi0Lja1pBMpWkqACuFwqepT/ntFKXZ5g47TJGyB3mbbLgWaEads mdMQqrvrzebgJlhFfvbH4X4YBCl0cqiyyusLltpk1AyyIS+EC1BdrTPZDOwYZcvviRJ8 pOpQje0dN3kwInEHMQtnAbrh8eAHkVM+6vZ4FcXKFPvOS5MAWVze1sCct4m7cc4jPWqz BS5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722354726; x=1722959526; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=pGjWryPa+E0i9O1vtsxMqVFVLNR1dXSU3MEx8xiuJFI=; b=LZiq3BX9uBZfnpLL/DI+ryuM2y60Zo1VB4TE/mqFA+hsY3CzeG28W3DNgpTmqpHt6X vTwwuIDtZpbpSnlg0yEPtGvTltXfcJX21kE9CI7YZ/x8wWaTair2XemTOEBXEFL2j1Dg aG8w/YB2BVjiepl0VGRVa3oYjR/xPPKpbSj0sZAp+AoG3sBoNTqYQDTQz5weIWG68wuy c1f9sgowRu8+aqYAM5yzij+RYh5j41AaMkzIVwg7QcMdVrE9URcAxHXzJXb0D0LSI3ae cjmWPnE6qSGXsMhYeiweJHnhc8j1KTw/4IXptbRsWT5d7oGpffSXtRuRS74QWDqrkMNw USnQ== X-Gm-Message-State: AOJu0YxreM4JLdmz578Boy0UOtR2CiFj1XwGx5Qv1jjPIu91Uy5kEtD5 E1bhGGaiaAPFQMWE1YDnbfI6pmxFB5bvN3Egf7TpVReXkjbAeU8oCR5gzw== X-Google-Smtp-Source: AGHT+IE2laQGcCFLh1elKBueC5G5/T/V8Jp5tDHWnpPQHaz5yt977NdWKpobk1jAXi5Z6e63X3dspw== X-Received: by 2002:a05:6a21:9994:b0:1c2:92a1:9320 with SMTP id adf61e73a8af0-1c4a1179205mr11364736637.7.1722354725803; Tue, 30 Jul 2024 08:52:05 -0700 (PDT) Received: from localhost.localdomain (71-34-81-131.ptld.qwest.net. [71.34.81.131]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cdb7600054sm12788517a91.47.2024.07.30.08.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 08:52:05 -0700 (PDT) From: "Gerecke, Jason" X-Google-Original-From: "Gerecke, Jason" To: linux-input@vger.kernel.org, Benjamin Tissoires , Jiri Kosina Cc: Ping Cheng , Joshua Dickens , Erin Skomra , "Tobita, Tatsunosuke" , Jason Gerecke Subject: [PATCH 2/5] HID: wacom: Improve warning for tablets falling back to default resolution Date: Tue, 30 Jul 2024 08:51:56 -0700 Message-ID: <20240730155159.3156-2-jason.gerecke@wacom.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730155159.3156-1-jason.gerecke@wacom.com> References: <20240730155159.3156-1-jason.gerecke@wacom.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Jason Gerecke When we encounter a usage mapped to ABS_X or ABS_Y which has a calculated resolution of 0, we want to warn the user of this before setting a default value. The previous language used the word "usage" but then printed out the value of a "code" instead. We can improve this. Signed-off-by: Jason Gerecke --- drivers/hid/wacom_wac.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 2541fa2e0fa3b..7e81c93d18229 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -1906,8 +1906,8 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage, if ((code == ABS_X || code == ABS_Y) && !resolution) { resolution = WACOM_INTUOS_RES; hid_warn(input, - "Wacom usage (%d) missing resolution \n", - code); + "Using default resolution for axis type 0x%x code 0x%x\n", + type, code); } input_abs_set_res(input, code, resolution); break; From patchwork Tue Jul 30 15:51:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gerecke, Jason" X-Patchwork-Id: 815472 Received: from mail-pg1-f180.google.com (mail-pg1-f180.google.com [209.85.215.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 023CF1BA889 for ; Tue, 30 Jul 2024 15:52:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722354732; cv=none; b=FGErfwuWmjvZJCeIl4J9Jj4jj9EQweOpLo30ioP9HP6hRsrKr/Pl0XsTOiFFyFHP+AAD0Ip9xwMtF5lbZP6idJMo5AUcsZEvs1zufxPKJTuiU8POplYxLq60Xj7QpQQCJYouOXe4NV34uF6/0d/JIoPl+NZZmVFoopttD/7ICbo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722354732; c=relaxed/simple; bh=pCuV0U+CE/5FzqxHlYgYkhiJZ+uemPaU/f6WxnPqLAU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=GkjKWurAXqC4tb3+bT++GYp0kSD9r+wObR/7jOBYh+TzJPQ3LTR6Sgo3WK11Xjm6cLA3sAxILRrqW3KL1ogiO+DQrsIPmZ7SvZG/PEDJQ/0dOEzs6lYVvwy/z2/GiyFStMqup2RN63Kv9xAYiEeW/rWW4ET3fBJzB1ipwK15YuI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=HHMFQIAm; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="HHMFQIAm" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-7a1be7b7bb5so3468619a12.0 for ; Tue, 30 Jul 2024 08:52:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1722354730; x=1722959530; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=M3XSJ6eZ4QQQt8d3kl2QAxniTSgrYj7kobyAQ/bT4fs=; b=HHMFQIAmVZZGT/rBZX9GSAqmYZdr/vzn6XXM3ZoIuDQFDb+NGmkiebeHWa09lVoM8e Pa41biuSmC1VvEjdWOPr608wQWdpEmlvIe6ZoG6pZnXSms7whoSrHHtN59+N8OYS8MiF pmQd40Eo1nCYM5UqrdVfKQgth660m1rDeocIZ14kqv+u0m+4KMhV7Ww+7iGHkGEg2Wys 5wDKPNWcyql+dxXIJA5gF6CtJLZ+KYUQVrX+X42XRDVjSTR7rbe+maF6CB8JJrRHjRwL DylAKEQ3bRJrQcAqeSZvNa5AxydPPPlwCGPu18kPeAhBH+vpRIqxZnYY05VUfSVJinMC 1BaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1722354730; x=1722959530; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M3XSJ6eZ4QQQt8d3kl2QAxniTSgrYj7kobyAQ/bT4fs=; b=HewZdCeP0fA9nNLvlL/8RUQPkr9UPDwxGpx8KyWSU9oc6T1VZkEMh339hmjaonCROL 1Qw1wto2cNXtwGSsRbSFCWrtYtcuGtNCTlo4xijRw3aLBmxVlQh9hPcr9A6thSPgCg0g YHh2mfAiYqjSKjlEHkGfOmPSOUYxNiysLkxo12LUz7ujvFtlxkdJaCRoCbQeSdljF/MI 1F38EEhfQI7LO5iWnlY6hFtt1vrZ6MpjB9fsKsieaCKVkXT3enabD1696PsXm1bn57Z+ U8MmiqQz0+Eg1xy8dlHBJX9fx+H8RhkcV9xbyASJ4VxmVtwkCKHwG61LuhFABKlqEffE ZjLg== X-Gm-Message-State: AOJu0YzIg+Oo4plGuJp+YbfQmIcW6+/lK81uZTYGCUBS3zaBTYXMtN38 nOYYCBL3A8zMZ/dhq1D5EBIVFYiJXRoZB3jXsyA2MHE+dF5Q/rLCPYZdXQ== X-Google-Smtp-Source: AGHT+IFxt6hl+/Z18mh05dVq3k5WK0q12F4Fbx8Jie7ZGWwQvTL1IsGUaCK4FncvzZNRNMksZjBfyg== X-Received: by 2002:a17:90a:cc3:b0:2cd:619:6826 with SMTP id 98e67ed59e1d1-2cf7e60bee6mr13567090a91.34.1722354729636; Tue, 30 Jul 2024 08:52:09 -0700 (PDT) Received: from localhost.localdomain (71-34-81-131.ptld.qwest.net. [71.34.81.131]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2cdb7600054sm12788517a91.47.2024.07.30.08.52.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jul 2024 08:52:08 -0700 (PDT) From: "Gerecke, Jason" X-Google-Original-From: "Gerecke, Jason" To: linux-input@vger.kernel.org, Benjamin Tissoires , Jiri Kosina Cc: Ping Cheng , Joshua Dickens , Erin Skomra , "Tobita, Tatsunosuke" , Jason Gerecke Subject: [PATCH 4/5] HID: wacom: Add preliminary support for high-resolution wheel scrolling Date: Tue, 30 Jul 2024 08:51:58 -0700 Message-ID: <20240730155159.3156-4-jason.gerecke@wacom.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240730155159.3156-1-jason.gerecke@wacom.com> References: <20240730155159.3156-1-jason.gerecke@wacom.com> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Jason Gerecke Modern userspace (i.e. libinput) will make use of high-resolution scrolling if supported. Hardware does not currently set a resolution multiplier needed for effective high-res scrolling, but we can still write code to support it in the future. Signed-off-by: Jason Gerecke --- drivers/hid/wacom_wac.c | 24 ++++++++++++++++++++---- drivers/hid/wacom_wac.h | 1 + 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index 96b158a94ef9c..e45abc973363a 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2048,10 +2048,12 @@ static void wacom_wac_pad_usage_mapping(struct hid_device *hdev, features->device_type |= WACOM_DEVICETYPE_PAD; break; case WACOM_HID_WD_TOUCHRING: - if (field->flags & HID_MAIN_ITEM_RELATIVE) - wacom_map_usage(input, usage, field, EV_REL, REL_WHEEL, 0); - else + if (field->flags & HID_MAIN_ITEM_RELATIVE) { + wacom_map_usage(input, usage, field, EV_REL, REL_WHEEL_HI_RES, 0); + set_bit(REL_WHEEL, input->relbit); + } else { wacom_map_usage(input, usage, field, EV_ABS, ABS_WHEEL, 0); + } features->device_type |= WACOM_DEVICETYPE_PAD; break; case WACOM_HID_WD_TOUCHRINGSTATUS: @@ -2179,7 +2181,21 @@ static void wacom_wac_pad_event(struct hid_device *hdev, struct hid_field *field * userspace treats positive REL_WHEEL as a * scroll *up*! */ - value = -value; + int hires_value = -value * 120 / usage->resolution_multiplier; + int *ring_value = &wacom_wac->hid_data.ring_value; + + value = hires_value; + *ring_value += hires_value; + + /* Emulate a legacy wheel click for every 120 + * units of hi-res travel. + */ + if (*ring_value >= 120 || *ring_value <= -120) { + int clicks = *ring_value / 120; + + input_event(input, usage->type, REL_WHEEL, clicks); + *ring_value -= clicks * 120; + } } else { value = wacom_offset_rotation(input, usage, value, 1, 4); diff --git a/drivers/hid/wacom_wac.h b/drivers/hid/wacom_wac.h index 6ec499841f709..aeba2f3082f03 100644 --- a/drivers/hid/wacom_wac.h +++ b/drivers/hid/wacom_wac.h @@ -312,6 +312,7 @@ struct hid_data { int width; int height; int id; + int ring_value; int cc_report; int cc_index; int cc_value_index;