Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp289033lqj; Wed, 10 Apr 2024 10:23:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXtLGyUNPUXIABrJb1QCwCBD8GkP/A4yBupYDBKUtEpedSVzteRi6M1Iyc8FGKVZDiJIiDNo+Jn5ePNy4xaJ0ELtGOyGhskFKJOMoIaMg== X-Google-Smtp-Source: AGHT+IGdsqq0C/mICeldTwPvIagSKCoqBCFNG6zow8s3wxUw/mX9Rq8VEeFpHTBULmFl1fOD88Ow X-Received: by 2002:a05:620a:5742:b0:78d:68fe:f73b with SMTP id wj2-20020a05620a574200b0078d68fef73bmr3553423qkn.63.1712769814199; Wed, 10 Apr 2024 10:23:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712769814; cv=pass; d=google.com; s=arc-20160816; b=PSPME4VUZwQN1KPtKB+QmGWr7X0Nw1Yy/envxH697nEJdP/x0YXwoFTICmT9AnSNGS 7vrQiJKiq0eiYE+SxiM87EHJ6ZIFYa1jQVACX6R5bNhOuo5gVOXs0sANw/oVucN6BDAI yie7+tfNSS+9iR/fPAwteMWzR8zKHNhg2fm8q6H+TU5QCvhJpSjrMmLP9dC1bBGyR63U En0PJbwuFV1Q8+mdPvTi1uO6gK3yogdA5WLvUlnAopfv5rrThW3dZJ3gAmR2ShbIrurY JyCKccZFqYl06s/jedZ7/SdAtm1ItdyFASzNBj9Ud+LEbdT3x1a7iDgaR2XKiBtcdtB8 TQbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=Tb37uIKFKnbzR21A3WoHkoRqd/xxuVmwrlA99T9nx5s=; fh=ho438NhVBtcioQVDrg3lHWbSMg2+osFD2590tU+Apuc=; b=SjkrJdbyKpJ2oBWhQthvSpWQHXIg7OililaGJPfXykLgafK6fxorlzI8V2BDRN5WTO Ui2ACHEle6NaF+MEzdZupxBFNx150yuHLAwJwLUZzdjxn/JpjyQaHZGCiYZSA6oNvuI8 LDF4wJbAmMmSxgjcDqncYuuM+/J44t0kum7J0XDspHToHA/uRczKPSioFWaLx1XNoyIL H3JyoPVfO0RX9LwNUvI1Teb6wUt2kwtHtHvCe0aUaQGd4H6YEEoqK6OtxlXoz+7sPS8l d8F10SvuHIOdkGjzAnBGFDhJnP3LbdG276OhV5/HTl+iTxNFRO5prhoU0k+ZhvBcVF59 dQig==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C9iSIUwG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-139084-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139084-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id bj3-20020a05620a190300b00789ed541240si13981807qkb.330.2024.04.10.10.23.34 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 10:23:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139084-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=C9iSIUwG; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-139084-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139084-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 975651C2313B for ; Wed, 10 Apr 2024 17:23:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 594B91836FB; Wed, 10 Apr 2024 17:20:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="C9iSIUwG" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BF4D1836E6; Wed, 10 Apr 2024 17:20:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712769619; cv=none; b=UzKpU/O/UtDs1UErulieB7HiYIkfHyjvFqGhptdW957rPgrKFVPHcoYyufnbUMtJHglpQEw1c/oC3ekssoXrXE+iVFV5ay2iJNyHJkt+L967tAqeMZEbcB8T/1TUv4vvYfu1aBTkhI95FkaufwOILzP2ukx5aba3Ik6OjSU4UGM= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712769619; c=relaxed/simple; bh=FSBl7C98aqlFXG4peS5iM4e+jn59fgnArt3EFNam9lY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=o2pSEiHNVg8xpunfrVMWIk7O++55+0Zyk4mhd6+3hz2Ha9hCbZMUeDTb4SY5P4UAAlDiEAfMxUaaD6wR0+BQ3rcWsidYG8zBoqhFpgLHBVSJNSVQTcD/sUksv3u9pHMI9HSoBFs1EiVXOV9H5lzLXoucV2z5Y0QBGyKC5P3ABRo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=C9iSIUwG; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id E87B0C43141; Wed, 10 Apr 2024 17:20:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712769619; bh=FSBl7C98aqlFXG4peS5iM4e+jn59fgnArt3EFNam9lY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=C9iSIUwG4mwrq8h02oJie3JHsoibQp5LQnI29DPdJXMojNKP97Ss9y90r0MBG2kVz jpU/4T2qjJV8HQVeTc2+Tm3MFUrEG4Qxa1jDPiva071RISQwBEzmTRK82YRXDClcne 9SHQaHxpAmK5YQlXNJxLCy/w3QHaJxE9r0W4GYeNHVdjHOYJBoh8pznfJ/eSQ5OV1N IGvmulVruKhefgl8NLrW73zbnMOkrHIKkuaRMQkGSi0YmR1cHiBMooDXkVVy46/6NU B6kxjoFAN2/2C2usxnBYP8MBAmwlT5ytVqEN1XpkupPwq6avk15WK0VpsqQcqn745r eFX8/3OEXm6PQ== From: Benjamin Tissoires Date: Wed, 10 Apr 2024 19:19:34 +0200 Subject: [PATCH 14/18] selftests/hid: tablets: also check for XP-Pen offset correction Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20240410-bpf_sources-v1-14-a8bf16033ef8@kernel.org> References: <20240410-bpf_sources-v1-0-a8bf16033ef8@kernel.org> In-Reply-To: <20240410-bpf_sources-v1-0-a8bf16033ef8@kernel.org> To: Jiri Kosina , Benjamin Tissoires , Shuah Khan , Peter Hutterer Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org X-Mailer: b4 0.12.4 X-Developer-Signature: v=1; a=ed25519-sha256; t=1712769589; l=1435; i=bentiss@kernel.org; s=20230215; h=from:subject:message-id; bh=FSBl7C98aqlFXG4peS5iM4e+jn59fgnArt3EFNam9lY=; b=W4VrUeL0TzGScCiyTrWxLSy8DVLetGQt9+YlciUVU7k62L1qTrxet3yJaAe9qC7wLxXBRgUfG fsuykwf9WDACXvS7ZY6vJ33mTz+M1ImSRfBiZSlIgyFo5iqaBH/8qWm X-Developer-Key: i=bentiss@kernel.org; a=ed25519; pk=7D1DyAVh6ajCkuUTudt/chMuXWIJHlv2qCsRkIizvFw= The values are taken from the HID-BPF file. Basically we are recomputing the array provided there. Signed-off-by: Benjamin Tissoires --- tools/testing/selftests/hid/tests/test_tablet.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/hid/tests/test_tablet.py b/tools/testing/selftests/hid/tests/test_tablet.py index e265f1d4e089..ae0eda9cd3d8 100644 --- a/tools/testing/selftests/hid/tests/test_tablet.py +++ b/tools/testing/selftests/hid/tests/test_tablet.py @@ -957,10 +957,24 @@ class XPPen_ArtistPro16Gen2_28bd_095b(PenDigitizer): pen.eraser = False pen.barrelswitch = False - pen.xtilt = 0 - pen.ytilt = 0 pen.current_state = state + def event(self, pen, test_button): + import math + + pen_copy = copy.copy(pen) + width = 13.567 + height = 8.480 + tip_height = 0.055677699 + hx = tip_height * (32767 / width) + hy = tip_height * (32767 / height) + if pen_copy.xtilt != 0: + pen_copy.x += round(hx * math.sin(math.radians(pen_copy.xtilt))) + if pen_copy.ytilt != 0: + pen_copy.y += round(hy * math.sin(math.radians(pen_copy.ytilt))) + + return super().event(pen_copy, test_button) + class XPPen_Artist24_28bd_093a(PenDigitizer): """ -- 2.44.0