From mboxrd@z Thu Jan 1 00:00:00 1970 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 B576E232395 for ; Sun, 12 Jul 2026 04:47:24 +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=1783831646; cv=none; b=dZoQl5WHQafswAc4y/aA7h840jpvkJZBupzKABon/XuGx0v36zNcuXGCS34AyELbUksGF5BM7InGApXp5gQ/aoXmC+512fWndrGCC9lV+tU9JORlF85cPpq85ZljR9dywHx5eqQEBaKOIwVZr2KUrMWq/8cV69lrJVqzh8JpYJA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783831646; c=relaxed/simple; bh=vHJ4g0f+0j3Q3yr62ahRwdRnFQbA2bzJ7fX2MFfF/ds=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=QSPxbO5d8YCbuzx/fdu9gORwfL37pqhfK+fHtmLBjCzN9I78Y+OIe2wYJf6IZva0kLvJOE0TBiijYKDZOC13sw/Suf+ze1nfrins+II8KPKOmM+GY+FXj81W+PDgTE5P8W5MDdvomiaQmVS1lH6Fv/dNCykabJteTM4EaWckmAU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=masoncamara.com; spf=pass smtp.mailfrom=masoncamara.com; dkim=pass (2048-bit key) header.d=masoncamara-com.20251104.gappssmtp.com header.i=@masoncamara-com.20251104.gappssmtp.com header.b=mIjoWkT5; arc=none smtp.client-ip=209.85.215.180 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=masoncamara.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=masoncamara.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=masoncamara-com.20251104.gappssmtp.com header.i=@masoncamara-com.20251104.gappssmtp.com header.b="mIjoWkT5" Received: by mail-pg1-f180.google.com with SMTP id 41be03b00d2f7-ca97d139d5fso1543026a12.0 for ; Sat, 11 Jul 2026 21:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=masoncamara-com.20251104.gappssmtp.com; s=20251104; t=1783831644; x=1784436444; 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:content-type; bh=LZXz5E3gRMPDk1Q4+ej8gwhJ/pddHD10PKP9UivF+m0=; b=mIjoWkT5IBOGdJZKYzbrtqeh0mHDWLj5HBa+4zOGqUdFngHcnHTmDDcZ0TzBJdgA8b mmPvkwgpt52Cp25iDrO7VhRKY1PCfBggLkzyAwUcSO2Dqr4Jer5zEgppkozujh5pr0a6 65mzwp4CzVaGTvg7OVSWSlMa/MndiB1zg+B/OQ4T13W6T46E2wVC8nJcIhv2XxuO0lKn SSpld5OaYEQit20xopvZcHiz0gP0Hv6YDO5fYGzqh6l+8pBCWIUgPpzrpVjv1L9bG8ef VAtv+rP9OC8Gfv3gdX9tFVec/Ay0/ffHY7mS3fpishiBwPT6ap7P58WfDMxy7Oo/zOSm nCEg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783831644; x=1784436444; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=LZXz5E3gRMPDk1Q4+ej8gwhJ/pddHD10PKP9UivF+m0=; b=Tg7MzXi+jhKpS7wg7RIVTixVieBaKEDHcFUVX2Q5JAO3hk+6yr012JLwTtQf9gysD7 wb1xWgVLFX24UfWMGhfU6GultAsZgjnn9dTOd+m1hXuVt/9Ov5NiOVQiQe9kVxAjZGkf 59+B0+uDn8reqKLDURnwjvTL+IjlLkeUde5as6+CnNlslaJOuu9jciHs1uzQqkfNSAPx TfwWJNPfqCncwnaeK6hKN+R9qcFa6FrplhNG4idhvaMVS/p08hZAEr/nidD3lfsyXrZS 2nK3WtTF2q8Oz5e0JzOLQXB9LGh+hb+05Eemx1Xv5P/GwUD4BlscQM+OgxdGFnUhUxmB 9SEQ== X-Forwarded-Encrypted: i=1; AHgh+RpE71bvr7wRJnJ2GbaML9fMnjMYn1YJ0hnB+7lI5C2hIGpZyeujXMZayFihhcV/hWIZd3noVB8dnNqe+EY=@vger.kernel.org X-Gm-Message-State: AOJu0YxXk1W1uvRaRchgTVUacIltAM65U7sv0WkUsiK9xJKfeStXYeIz gT8bzKjsI4Y38Qhy52eqo+WcW6ViXmcgcVjHpkixbwSN7B8AAik52yUCiT19Hs64LfpO X-Gm-Gg: AfdE7cmFrc5VgiCOeEGqiQ3pbuCVa+Hr0qPuIkDHIR4YsbRcVAdiWgBDqyjvqj45Fjs /sjO4f4HHMtT/m5Bn5wILsOmkxyf+UPkugVvD9aFUsvcjVnLBynLzx0Vx9K/BgWTF521Y7wKoV7 Ny95n9jW8QK1C8HkD4zGr/V6x5E31W2qOZxwZm23ujmqnB9GFTPfhjR0fmR7uTNNDfnu4qI1l3t RGJKz4iIbFzpXrc7P350sYG08axiKLZ3W1UVG+Lvdz2H2piSf3/ydsGEfUzhL0DFhzmIqWdy9oJ ibZQL4T7WD8L0vI73c92koO+kOcoYA0WGKDvIZsNk2cvuRailGwuhBOCgnIDbxjidoPKZWNmSnu fZwU13l1XhmolKvdnykiYpMVC8Ylk74Pv/BrL4e0D8JOJL3AgcU2110nlB74y5BEfefjUmb+coq cTG7UwKyGM7ZW+Vg1+E0Pu7wUFjIRQEMMwQYF5Fg== X-Received: by 2002:a05:6a21:329d:b0:3c1:b9c:4886 with SMTP id adf61e73a8af0-3c110d2fa6fmr4862702637.72.1783831643877; Sat, 11 Jul 2026 21:47:23 -0700 (PDT) Received: from nobara ([69.26.129.115]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-3118ee6091dsm59384338eec.14.2026.07.11.21.47.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jul 2026 21:47:23 -0700 (PDT) From: Mason Camara To: Jiri Kosina , Benjamin Tissoires Cc: Shuah Khan , John Chen , linux-input@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/2] HID: fix battery queries with nonzero field offsets Date: Sat, 11 Jul 2026 22:47:00 -0600 Message-ID: <20260712044702.893825-1-ping@masoncamara.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Magic Mouse 2 input report 0x90 places a status byte before the capacity field. The synchronous battery query treats that byte as capacity and reports 4% in sysfs when the device reports 95%. Use the field offset and width from the report descriptor when processing GET_REPORT responses, and add a UHID regression test. Tool use: Codex (GPT-5) reviewed the completed series for submission-process, formatting, commit-message issues, and suggested edits to the commit messages. The code and test were written without AI assistance. I reviewed all resulting changes and take responsibility for the series. Testing: - W=1 builds of drivers/hid/hid-input.o with CONFIG_HID_BATTERY_STRENGTH=y and =n - v7.2-rc2 plus patch 2 only: FAIL (capacity 4, expected 95) - v7.2-rc2 plus the complete series: PASS Mason Camara (2): HID: input: honor report field offsets in battery queries selftests/hid: test battery queries with nonzero field offsets drivers/hid/hid-input.c | 39 ++++++++++---- include/linux/hid.h | 6 +++ tools/testing/selftests/hid/config | 1 + .../testing/selftests/hid/tests/test_mouse.py | 54 +++++++++++++++++++ 4 files changed, 90 insertions(+), 10 deletions(-) base-commit: 8cdeaa50eae8dad34885515f62559ee83e7e8dda -- 2.55.0