Received: by 2002:ab2:4a89:0:b0:1f4:a8b6:6e69 with SMTP id w9csp287078lqj; Wed, 10 Apr 2024 10:20:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXLVuPWh/uxgsN/0YNzMyddOoR7rp5M8AhF8R8qzs3OVFemI1FQ2Bw2AqCCxKs4oZneFgpPuQKpWzoL3Uos14msdKZ4QXtVeveT5N8lHg== X-Google-Smtp-Source: AGHT+IFI5lGqFUfYqdCBY3FE0K3ariZNOjSJQb6BAdcw/IJGG+mhvu75nXQDoxg2mQOqyT/bS7HH X-Received: by 2002:a17:906:b217:b0:a51:ddd3:6a4c with SMTP id p23-20020a170906b21700b00a51ddd36a4cmr1870223ejz.42.1712769613989; Wed, 10 Apr 2024 10:20:13 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712769613; cv=pass; d=google.com; s=arc-20160816; b=WSDlKwicwGFmRr8BHGs7KMLrrCWdQ6iK8UJus7QQ+/jiQcXfZcL8rly3NyHMM5nRZn +FSsPgISGKFU/4VUo63IYR90Juyk3iPcq9rcSPHLvW7xWK5dU0jNxtdtXFoeGGkVfRpx R7B8kV2nPRYYauaB7fLb5WFfxViOr0ChBmcxjaDf16EMLhD6gbmglt6kN4Cyn67tMW7l BeabhQAtOr9bHvi4g55rCszmxDa7/mnSJ71bOue6qIBm9KRnu9l6JMuLBk9csDVL7pL+ vIA0eR12x/8yenAG6KoYEIoIgsd6dBpoDKTnkt7/UxmWni1w+lCo9iH2X/9jHtOPGmNz gDfQ== 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=ZC14CXG82GurRKx7ibZiHatuwNa5PWIzNtgnRyzKacg=; fh=ho438NhVBtcioQVDrg3lHWbSMg2+osFD2590tU+Apuc=; b=kQQVAcWXVfMZk5lX2dWKwYlJwBRTFyEsEOJe51QrvIHeAl5qBaxnjUsaNbWG0BAXoJ 1LfPc0dHZafzjG9dqkYzAm1azfwn3hHKZMVp2j2yz/IS90txwS2lB/Va29JX3q+uFolO Hor/DJlq8OCDnXwlCW1F2WyWE/hXVufNih3fp+4w7Odm9wUsFeWjCdMCij0CuAqQQLPz WT6ufngwvg6/aF7ygFNqG3i+xf9NgPOxRTat0+8V7ch9LqgyrIMM8FtHknJxZhYG0Z0I H+msXF+zIew4c13gv3RVqQwYF1O1lOL4uE1TxEfDNpU16OnWtKdBhT9roJkGVAG1wiYZ m3Tw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jpNx8O69; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-139070-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139070-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id h26-20020a170906111a00b00a5197312ca1si5934301eja.29.2024.04.10.10.20.13 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Apr 2024 10:20:13 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-139070-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jpNx8O69; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-139070-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-139070-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 am.mirrors.kernel.org (Postfix) with ESMTPS id B16571F22D6F for ; Wed, 10 Apr 2024 17:20:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F2A2417F36A; Wed, 10 Apr 2024 17:19:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="jpNx8O69" 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 1FDCD17BB30; Wed, 10 Apr 2024 17:19:54 +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=1712769594; cv=none; b=PICA5ZWL4mwGZmpbghMv/N5531RFXyC+tXsCQa6Qnmc02K+3QzvfXvR9yqC5p9C9WC3BOVDhG7KYZsjBcGkzV85BeFYB20ArulcTKHrFeHfQ/hXJXrALs9oXOjGyeKzkDmYZLRdBYOD6UcSjoSqB3oKPlNJWzBeJJRB/3y2H1zA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712769594; c=relaxed/simple; bh=KsZw3etfLaKHH2rg/n8zRwwG7f+ZJgP0Ctx+1hM+nNQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=NAONXRj2OaFCaBV8Z30fIigxxgR5M7hDf1CPC0Ofi9sl0G7exvG6Td+Z1i/iHu6CjvxYK8jnj/NVKnL9q9dehWq1G78I6259b7iqJYCRVfhHDbTLDIFxuXOD1Cr1Ytbf5MpuhZ1DuOMfrmxnrkCXTzyjObMHZbuB4fNxMcNPKFI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=jpNx8O69; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8AE39C433A6; Wed, 10 Apr 2024 17:19:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712769594; bh=KsZw3etfLaKHH2rg/n8zRwwG7f+ZJgP0Ctx+1hM+nNQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=jpNx8O69ehKmFositRJB6R86vNtB2ovuhA5Y3gorWWNchOjkNgb+SqStB731PJwF5 iBxR0YUJFh0/a6YNeuKNYoGEPuVcfZhsrWjqK+LtTLeCtqIrPmTnL3Kaj7AXQZ6Dcb jtxjpK4VGAdzZVztrHJt2PvdUKLrunT7MVPFtvRfYlxfEgTLaLYRGQ2nv0m+u5K9Gp +5peGg4apX4AHVrAIlY5nBesaxZWPm6MjT3rOQUY6QP20Grucivc6gT3gmK9FXcHRO DM7dx+MAsmImtPOFrFO6Yge3y+QEKfZIhTmKygGrugpx/xVRRqwmFOu2iET/StYQiJ v0WUxyB3nLMrQ== From: Benjamin Tissoires Date: Wed, 10 Apr 2024 19:19:21 +0200 Subject: [PATCH 01/18] HID: do not assume HAT Switch logical max < 8 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-1-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=1080; i=bentiss@kernel.org; s=20230215; h=from:subject:message-id; bh=KsZw3etfLaKHH2rg/n8zRwwG7f+ZJgP0Ctx+1hM+nNQ=; b=JPPlgg5xA03dGvEoFMmWtqh12ox55NRqUBzewkucEmNjAG/XQlflf8Ogdb/rEMY2Cyaysxbyf B2tI1VnDlT1DPSXSDhAP43H4sXc3ztJFAefeyUhygIouB4Kz7ZuDk5C X-Developer-Key: i=bentiss@kernel.org; a=ed25519; pk=7D1DyAVh6ajCkuUTudt/chMuXWIJHlv2qCsRkIizvFw= Turns out that the code can handle a greater range, but the data stored can not. This is problematic on the Raptor Mach 2 joystick which logical max is 239. The kernel interprets it as `-15` and thus ignores the Hat Switch handling. Link: https://gitlab.freedesktop.org/libevdev/udev-hid-bpf/-/issues/17 Signed-off-by: Benjamin Tissoires --- include/linux/hid.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/hid.h b/include/linux/hid.h index b12cb1c8e682..8e06d89698e6 100644 --- a/include/linux/hid.h +++ b/include/linux/hid.h @@ -474,9 +474,9 @@ struct hid_usage { __s8 wheel_factor; /* 120/resolution_multiplier */ __u16 code; /* input driver code */ __u8 type; /* input driver type */ - __s8 hat_min; /* hat switch fun */ - __s8 hat_max; /* ditto */ - __s8 hat_dir; /* ditto */ + __s16 hat_min; /* hat switch fun */ + __s16 hat_max; /* ditto */ + __s16 hat_dir; /* ditto */ __s16 wheel_accumulated; /* hi-res wheel */ }; -- 2.44.0