From patchwork Thu Feb 1 04:40:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tatsunosuke Tobita X-Patchwork-Id: 13540649 X-Patchwork-Delegate: jikos@jikos.cz Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (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 DB27E1EEF8; Thu, 1 Feb 2024 04:41:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706762482; cv=none; b=L5DSgX5cwA6+Y6kfRuYxUWrdODQd3z2ZpFIsdTd1HACmaH6obPvKOYGjsGE9YZMj+cA+IdxlIRaQFykKB5GDlcCPuBcoODR/hh47bNmz/jxQNwqBv1ZV4htUpkosNCNC68s9Vg40D7HCyFOM+DuqpEwp5/Bbe7fjgYkgZtjztsA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706762482; c=relaxed/simple; bh=MeFsnr70vuz/PQLuXUKqCe7KhvGM+4jAF1eW6TQijrI=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=eXVl4C+KFde6/EfSUX7NMTsVmuszjmrCXFUU5xkVwL42uXyFyOco1lZyaF30RXNN8TqUTNHKss66PCAbkTUC9MCFrFIUxKOqasmfTMAKjvd2Zhp/RY9LGNrBaOkd88CR2MtMWtzGKkgqKvWIyQyMRhxmhw5B3Iep/THX+ddtGDA= 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=mqpRevVU; arc=none smtp.client-ip=209.85.216.43 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="mqpRevVU" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-29593a27fcaso112946a91.1; Wed, 31 Jan 2024 20:41:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706762479; x=1707367279; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=ZGzsH9un+SuLT2jBVrNgYws9bKvscinpS1YvutaGoJE=; b=mqpRevVU3YQvFaG0yDsH4auyRgd80yCisqTzyv3ED6DHAKCD8xkTC9hdcqtvjxeYUV 7qSrHHvriSb2U36wC0JbwjhqMnYZHe/+ugAAQpDLZKjFwgOV1NcS91kCs/3KkNmzL4B5 jfcC+ADWyLFiCGx4VP2kBxQiY8MRaACi3ppl94I5XMyJmu4fRuMgNXbaT6VAjsMoje9M PoBwOAdwvxhUsrX1mAJoP5eQJ3ItWcnlSi2XjGCBhcVneXV+FWx8irWzsMyYvZHOUg5h lIBLuFh9F0q0V6Gh6AixI+Rqlh+Q4kHBu7hLDyuqr0FcAD9IjHTrUYnFCQJumm0qz4F8 g2Zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706762479; x=1707367279; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ZGzsH9un+SuLT2jBVrNgYws9bKvscinpS1YvutaGoJE=; b=I7rdKhf2Qy7LW3njSGKNDKLOQhOuy5cxQrddvy9uqNwAxIkTRB0hqNSlVOKjadLSUB cK1X9ezhyZBPcNVoFg20x7DCMhbbdUnMQ7WiS1o9AYxzevCJIxbJFXHnKIYMZLFbyj7o sjL2+B8d/RNsl7XvSLkkqy/EFalsL9fM5D3sFS5bBjRvuQzvJfknl9VJnOuU+ylGZB3x P4akXRiXypINdwfcW9feIhHbTQ0TMx0IA2a0ZJN7wMTKq7dTem+HqrkTBmVwpBW7EF0S 4/bTD8oyZk4FkGwsp/sEKNWV0DXpurMHdCRAlnXQRvQVx/l/BeAB+75Yr1V59vV8U0hv EIdA== X-Forwarded-Encrypted: i=0; AJvYcCUnoIJDplvLmSN4Shd6reQZEt9i+pjhgnV1dLcxSdMOH5olxUh3zQY8QKXm4SSzj1SuMVVWhx8w1tomUsboqHtCuqK9jwUv X-Gm-Message-State: AOJu0Yy9lm39HC4YOZX5Zm/ZFJ0CSsz+0sdErB/sgKEAUUFYNI6Axdw2 FB/lMXJF70Xyh0uEL9Gu6tusOueIzxfxEAWIQYjqH3PYqAgap8l9v37scpI0 X-Google-Smtp-Source: AGHT+IFmV+E4ua407EExdmy+760CbcVOfFqQaqMDJ29Yqcg7UdzF08CRUJ8TzSkiXbiimRQAeeTxAw== X-Received: by 2002:a17:902:c18b:b0:1d8:dc04:2534 with SMTP id d11-20020a170902c18b00b001d8dc042534mr1614844pld.2.1706762479073; Wed, 31 Jan 2024 20:41:19 -0800 (PST) Received: from Holt.corp.onewacom.com ([153.246.18.34]) by smtp.gmail.com with ESMTPSA id m18-20020a170902db1200b001d8accb025fsm889908plx.197.2024.01.31.20.41.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 20:41:18 -0800 (PST) From: "Tobita, Tatsunosuke" To: linux-input@vger.kernel.org, Benjamin Tissoires , Jiri Kosina Cc: Ping Cheng , Jason Gerecke , Aaron Armstrong Skomra , Joshua Dickens , Tatsunosuke Tobita , Jason Gerecke , stable@vger.kernel.org Subject: [PATCH 1/2] HID: wacom: generic: Avoid reporting a serial of '0' to userspace Date: Thu, 1 Feb 2024 13:40:55 +0900 Message-Id: <20240201044055.23367-1-tatsunosuke.wacom@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Tatsunosuke Tobita The xf86-input-wacom driver does not treat '0' as a valid serial number and will drop any input report which contains an MSC_SERIAL = 0 event. The kernel driver already takes care to avoid sending any MSC_SERIAL event if the value of serial[0] == 0 (which is the case for devices that don't actually report a serial number), but this is not quite sufficient. Only the lower 32 bits of the serial get reported to userspace, so if this portion of the serial is zero then there can still be problems. This commit allows the driver to report either the lower 32 bits if they are non-zero or the upper 32 bits otherwise. Signed-off-by: Jason Gerecke Signed-off-by: Tatsunosuke Tobita Fixes: f85c9dc678a5 ("HID: wacom: generic: Support tool ID and additional tool types") CC: stable@vger.kernel.org # v4.10 --- drivers/hid/wacom_wac.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index da8a01fedd39..fbe10fbc5769 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2575,7 +2575,14 @@ static void wacom_wac_pen_report(struct hid_device *hdev, wacom_wac->hid_data.tipswitch); input_report_key(input, wacom_wac->tool[0], sense); if (wacom_wac->serial[0]) { - input_event(input, EV_MSC, MSC_SERIAL, wacom_wac->serial[0]); + /* + * xf86-input-wacom does not accept a serial number + * of '0'. Report the low 32 bits if possible, but + * if they are zero, report the upper ones instead. + */ + __u32 serial_lo = wacom_wac->serial[0] & 0xFFFFFFFFu; + __u32 serial_hi = wacom_wac->serial[0] >> 32; + input_event(input, EV_MSC, MSC_SERIAL, (int)(serial_lo ? serial_lo : serial_hi)); input_report_abs(input, ABS_MISC, sense ? id : 0); } From patchwork Thu Feb 1 04:43:46 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tatsunosuke Tobita X-Patchwork-Id: 13540650 X-Patchwork-Delegate: jikos@jikos.cz Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (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 B9BF538DE1 for ; Thu, 1 Feb 2024 04:43:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706762634; cv=none; b=uUcCNeFCle9QQXHBbtQEHN9mA2aqlpvzE3NqrxiCCvFYpn4hOAiYXaboP6A566uDikMF7je4PN+85DS4/HYn6NwSPQZdf8htvSBNKolzDbjXtbWKrSdQoPbQGDwAUT/4AmjQ0+7yJx93Vv/ZhLFiGo31/Eie2afHZ8zSnJVpDYw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706762634; c=relaxed/simple; bh=uNjxcqd70WMLg8YmHI9N4JLyqHI5HySKMj4F0MhTSOA=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=a4jQLbvxJHLhPKAyUSayfyDWbKO+4mnqf0hkAoz6zJACbDjOT47yBkyuKBelh6Gh9JJxDtOZTk6no3Pl3R+Pu0pd0pLKjJqQsv8fm6Nm8VhdswdZI0ce8JYabY5bbstbM3asIpwOxMdOzhv/lbCTXfIWezY7KV/OVqPa+ZQUXkA= 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=mgzeE03y; arc=none smtp.client-ip=209.85.215.174 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="mgzeE03y" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-58962bf3f89so101034a12.0 for ; Wed, 31 Jan 2024 20:43:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706762631; x=1707367431; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LPBx0u+e/iIMpnGcKEeuIMPG6EbvxnsWSqyT+5DphoQ=; b=mgzeE03yl4fbZqHiF+7xlCPzRUygMO84sDHH7fkVmKcS3a7s4cYMxlxgT09NXqhPnJ mEwvFwL1aQnF639gCe893UQB3sxoEwL/w4YIfR1SPG4+S+YCP3iLCoy7G2eQt0sNZoSG a4/L99BoXSfiptD8509j4T+wgBJ1IN0b3zl+E0lDO95JZ2RsDRY2rz0+2jUtS6CJaXnl tApUYxLogi8nVkm+8ewfJJPOk4CvP8oodfWy8+9bho+N4KLJX6h8xmLLmKvHSBzcwin6 LkMa/zTZpGq3+XUqeXWMNow2H9UuzS4bZBzOCKAoTAz/03WL0cv29Gui8wOeYk1lTDNB aLkA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706762631; x=1707367431; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LPBx0u+e/iIMpnGcKEeuIMPG6EbvxnsWSqyT+5DphoQ=; b=oMEq9iBuaMEz4dkLmL/gpftCLTz6vhlPWk2kborhS6MxyhYGip/GzBB0TQb7SgGkWP yTZpuh7AUz6RGwnTQniCzUwHT8Y6zbmAl3ej8/z2cFFG75Yuvc5P8W3nF2bp2gZm80dm 2ax/XPy6PUz+4lGPyInXPxCydBoQJOvstaf5MI2E8mZyBMWXcWzSkVzIzNWnp5U5TkXr wKX1qk+1DCr3l3FK23KCRZHI+fW/TMNv3wkuwVDkz5t2uirlJQxT7U1nXoSi0zQGdAA2 X2ctNs+RH7CF1XQamNul+J6KlIUFvlgGM/ayMJ5C1FrvjKam3fSxLKcP5Y/SeMMHCu2F cbSA== X-Gm-Message-State: AOJu0YzXTNpKHIvSA9YwgaaB3h1VXUz6wFgH7dbtEOXdmR7sLG1P7q6c mfuTVeCdWcEUxhF9fNHsP85ZrDclYTzSdNFUbF+fuIR8HNKRfItyPlO/otCR X-Google-Smtp-Source: AGHT+IGqRQl7vFaZiJW58Mhte0xM5OVn4bgZJ3bZQ5CUydPtbJwyLnJQiglOv2qOYKTcqd30ToSrZw== X-Received: by 2002:a05:6a21:33a5:b0:19c:9c10:f90a with SMTP id yy37-20020a056a2133a500b0019c9c10f90amr1660014pzb.4.1706762631586; Wed, 31 Jan 2024 20:43:51 -0800 (PST) Received: from Holt.corp.onewacom.com ([153.246.18.34]) by smtp.gmail.com with ESMTPSA id c185-20020a6335c2000000b005d8b6e5ce00sm9941503pga.27.2024.01.31.20.43.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 20:43:51 -0800 (PST) From: "Tobita, Tatsunosuke" To: linux-input@vger.kernel.org, Benjamin Tissoires , Jiri Kosina Cc: Ping Cheng , Jason Gerecke , Aaron Armstrong Skomra , Joshua Dickens , Tatsunosuke Tobita Subject: [PATCH 2/2] HID: wacom: Clean up use of struct->wacom_wac Date: Thu, 1 Feb 2024 13:43:46 +0900 Message-Id: <20240201044346.23476-1-tatsunosuke.wacom@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Tatsunosuke Tobita Replace the indirect accesses to struct->wacom_wac from struct->wacom to the direct access in order for better code reading. Signed-off-by: Tatsunosuke Tobita --- drivers/hid/wacom_wac.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/hid/wacom_wac.c b/drivers/hid/wacom_wac.c index fbe10fbc5769..a44367aef621 100644 --- a/drivers/hid/wacom_wac.c +++ b/drivers/hid/wacom_wac.c @@ -2990,11 +2990,11 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report) wacom_wac_battery_pre_report(hdev, report); - if (pad_in_hid_field && wacom->wacom_wac.pad_input) + if (pad_in_hid_field && wacom_wac->pad_input) wacom_wac_pad_pre_report(hdev, report); - if (pen_in_hid_field && wacom->wacom_wac.pen_input) + if (pen_in_hid_field && wacom_wac->pen_input) wacom_wac_pen_pre_report(hdev, report); - if (finger_in_hid_field && wacom->wacom_wac.touch_input) + if (finger_in_hid_field && wacom_wac->touch_input) wacom_wac_finger_pre_report(hdev, report); for (r = 0; r < report->maxfield; r++) { @@ -3010,7 +3010,7 @@ void wacom_wac_report(struct hid_device *hdev, struct hid_report *report) wacom_wac_battery_report(hdev, report); - if (true_pad && wacom->wacom_wac.pad_input) + if (true_pad && wacom_wac->pad_input) wacom_wac_pad_report(hdev, report, field); }