From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.173 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796090884; b=Fz6Qb2Va1N2hpMb4pFY0o8AzHBSfgIWr22ex5UQ/AEPcqDpZ0SIbAbHKZU6YICKeNWOF V0LmfT5KYErVgGTX56aPnVBr/P8ZZYpgfIV1PsUHAoI1tj0f62/SMo52wF9rhpmTTiTDk Q/b+gH0uZCtxBRchMDaASuuCQULPuD2hgwmoRQPiXcLiILQ2L0hWk9o9GK3KVo3zdJjrv IY7ZbZHHJvbf5PnClbWC5V3JqwqrJ+G1e1zjauzh3ZnYLu1mmHFsQ2twZiSRjthDgRpJX fbvkB5yiPwdYMz8CNSR6v4Wh+aGcOKO7Ki5hEpsOnnOFbBShyzcDMWRIeBJH+Hk7+VA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796090884; h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received: From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:References: MIME-Version:Content-Transfer-Encoding; bh=qTjiV238kxEJKVkh1uEmQjnO+OMpQlEwsS5XxuOeUJY=; b=aXz3M2sPVODhvwjxNwwKt3OmKBvzFzhrjGkwa2Fk/aqZDq6ejoCwaGDEabIN4/S+ujC3 Q5YGfUnXQHCHH6L/VLgjxxrLpu0sQt0pawcWHywYWg3JRhH7n5FPiQXxOltRJ4bH3ql4Q GvcmnxrproT9hBPKQ3OMR+hft9mPP2eOZ/LhWN299DPiICQl+KGWVMbxQ6wCh/6P5xCU+ keyD9ZkqSQ2k3zvGV4NDNbGmvSWjREDEEIC7++zP/J7MuUU3QOuoMQufc/WzXaZpYtfKK n+t7x2twiPU4uFS7C4Q3K2X0oUEE8MGnNq/RMu5NwGGiEPMb0Cvxmx5yIxN8e9/TXWg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=EPsUXaJL; arc=none smtp.remote-ip=209.85.210.173 Received: from mail-pf1-f173.google.com (mail-pf1-f173.google.com [209.85.210.173]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8EC03606A329 for ; Tue, 1 Dec 2026 02:08:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 8EC03606A329 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.a=rsa-sha256 header.s=20260707 header.b=EPsUXaJL Received: by mail-pf1-f173.google.com with SMTP id d2e1a72fcca58-8d2d4cdb478so1838753b3a.1 for ; Mon, 30 Nov 2026 18:08:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20260707; t=1796090884; x=1796695684; 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:content-type; bh=qTjiV238kxEJKVkh1uEmQjnO+OMpQlEwsS5XxuOeUJY=; b=EPsUXaJLTZiedNGa2vNwiHUMZaeqT9uQqFdWkfhBy5psVgX1buhm+lvFSFisFGgW8F tkmrlsZVlQOhuhnF7KU/eqDGccV+VnYJiQNWbcZIooFH8iDnbJxjdbEoyu6OI3rbxQY6 R6pSSlSkgRAAtC132DLh+Ztbj6/LzYbD5kmHKcBIr+IVBM+Lzo4ad4o3IYnudLCRxk+6 LQL0d1lMA92yYLZK8XD6L+MJuq/CljZscMlfAmN+nK6uJyLASyqS7jdsPEACKz56/qSz Sy6a+ThsfJiaN+XbZ8ktkoUJIzHYf/9RjZNgtWjtEyDvyqBuaoAAiz3Mnj7UzCGA60i/ H0AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796090884; x=1796695684; h=content-transfer-encoding:mime-version:references:in-reply-to :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=qTjiV238kxEJKVkh1uEmQjnO+OMpQlEwsS5XxuOeUJY=; b=qZMH1lmFd0ID1+k/PjIZFDRo6zpsaA0uJhi1gRZzsxLhLwQwimaRdNW5Kce7tx6BED 2T8b4vTViTXwmZvNW5RIKpWoEK9lV1kFb+EOBSfHtI2JbskGlS3mlVV4r1ntp+15TSDG tOnRtolAUowSNkxPbqR1K3DlKtpzMpkU53XO6Z6dpJ+TA/EZ4Vp9Tan2TW9q5Inlo5lO qP0rsGRE62T5CzOrgH3yZ7VdpVfzJmexr2d/IjVRuhm19qJnpsLzrVBeTgIZNnyxnL/N 6b/1/Cdn7d0oHwMKgJg93XyAbzMWGU2aNlo0xRqO4wcIVznPQT24nv78Or7dWYg1CwDy XZ+A== X-Forwarded-Encrypted: i=1; AL+hErEnIhfdENCYpO1Udj9RHMI6ma8s5g/oqQ2mWOJ+i6lQp84mjnNm16Y/UfQaXNQhDUmZ0JGGtL7CLx/3TA==@vger.kernel.org X-Gm-Message-State: APuU4Z80d1Ib5P2LHVh7H1VHCO1tOf4oopPkDNDT8voRGFF8cPY5aoDJ 79B2QwFiRxbHmOpdWHjTLB8cgOgCr+i/MZzVvPUdhKc5socTfwTY9ONq X-Gm-Gg: AZFdTZcNLD2P0UlSjDLxjzOk2Opsp1kWv5C1sdCB6RRjjv+qXURTMDKc0sVebzgBiYx 6N4nZQvl2GK9elNrQZjA4Ni5vD6XEOSlOFU9HgkEAHC5sb50BaXzlBrCLQltM6N9lfIw7p2E4a6 /Il5k5m2wcKXDDD+iKYpe6APyqVEoX0zKd+1sgLhsWcG81A9OkjcLDrgJ2Zqvy3KgaFsC0saVwb Dn75DrRieX+dR9SkuvqAdapeFi2IeebrfIo3q32k9zmERZS9U6mHL/3FJsIMwckoNxYIVemACef c+OeqduSpKfk5P0sJSxb/D/Kp665PZPmYPO7z4Fv8xpvA1rdc56KKrMdWFySE1V9lHBmQEhSOts EZQB6ksYtPGVj1My+QYAVHWotrVWTPqV4PzJTTH19xdTI8+V+v0E3NuE9IzpDROJVivsbKlCfi3 uogiwKspWusbFjsnnQNVWWbMO67A621Bw31frQv3ZPWXWDubhgW28ZqVrP1qHsdRBGKYcjy26fD qkOK9swcrwgGNvO9HKCuGS1kSWTqlYHrVaE9i42zFqWu8gqjQPWG4aUi9p91fLRwGf6U2/osaEC J6BwTFrMsd2SszrbRx1CmZ7ZWjBef/odbCcKKSChJa8O2a6HI1gOWYfa/6gMUE2yIC4+cZUiIou lAVP58ivFwpnciPa4OtOVd3pKW/mKQ3qkhmZW6djLRvs0U2rO5vlQo+cZIfvP+3mShuf58Zt8UK t0X4jVNy3DsHo= X-Received: by 2002:a05:6a21:e58d:b0:3fb:35a3:8bb4 with SMTP id adf61e73a8af0-4014f04c62emr38345286637.74.1796090883820; Mon, 30 Nov 2026 18:08:03 -0800 (PST) Received: from sanjays-pc.govzhome.govindz.co.nz ([139.180.95.49]) by smtp.gmail.com with ESMTPSA id 41be03b00d2f7-cde6cea7c38sm19147806a12.2.2026.11.30.18.08.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 18:08:03 -0800 (PST) From: Sanjay Govind To: Jiri Kosina , Benjamin Tissoires , linux-input@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Rosalie Wanders , Sanjay Govind , stable@vger.kernel.org Subject: [PATCH 2/2] HID: sony: fix battery name clash between RB4 PS5 guitars Date: Tue, 1 Dec 2026 15:07:05 +1300 Message-ID: <20261201020704.3545243-4-sanjay.govind9@gmail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261201020704.3545243-2-sanjay.govind9@gmail.com> References: <20261201020704.3545243-2-sanjay.govind9@gmail.com> X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Rock Band 4 PS5 guitars register a power supply named after their MAC address, but the driver never reads a MAC address for them, so every such guitar registers "sony_controller_battery_00:00:00:00:00:00". With two of these guitars connected, registering the battery of the second one fails, and as a battery registration failure aborts sony_input_configured(), the second guitar is not usable at all: sysfs: cannot create duplicate filename '/class/power_supply/sony_controller_battery_00:00:00:00:00:00' ... sony 0003:3958:5600.0222: Unable to register battery device sony 0003:3958:5600.0222: failed to claim input Allocate a device ID for these guitars, and append it to the battery name when the MAC address is unknown. Fixes: e4bdeaef0351 ("HID: sony: add battery status support for Rock Band 4 PS5 guitars") Cc: stable@vger.kernel.org Signed-off-by: Sanjay Govind --- Notes: Tested with a Gibson SG (3651:8600) and a Gibson Kramer (3958:5600), both in PS5 mode over USB and connected at the same time. Without this patch, the guitar connected second fails to register its battery, with the sysfs warning above, and has no input device. With it, both guitars are usable and their batteries are registered as sony_controller_battery_00:00:00:00:00:00_0 and _1. Built hid-sony.ko with W=1 against the 7.3.6 headers, no warnings; checkpatch clean. The patch and changelog were written with the help of an AI coding assistant (Claude Opus 5.5). drivers/hid/hid-sony.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 7a25f5acce88..1f1152575ae4 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -31,6 +31,7 @@ #include #include +#include #include #include #include @@ -1906,13 +1907,21 @@ static int sony_battery_get_property(struct power_supply *psy, static int sony_battery_probe(struct sony_sc *sc, int append_dev_id) { - const char *battery_str_fmt = append_dev_id ? - "sony_controller_battery_%pMR_%i" : - "sony_controller_battery_%pMR"; struct power_supply_config psy_cfg = { .drv_data = sc, }; struct hid_device *hdev = sc->hdev; + const char *battery_str_fmt; int ret; + /* + * Devices without a MAC address, such as Rock Band 4 PS5 guitars, + * would all get the same name, so use the device ID to tell them + * apart. + */ + if (append_dev_id || is_zero_ether_addr(sc->mac_address)) + battery_str_fmt = "sony_controller_battery_%pMR_%i"; + else + battery_str_fmt = "sony_controller_battery_%pMR"; + /* * Set the default battery level to 100% to avoid low battery warnings * if the battery is polled before the first device report is received. @@ -2085,10 +2094,10 @@ static int sony_set_device_id(struct sony_sc *sc) int ret; /* - * Only Sixaxis controllers get an id. - * All others are set to -1. + * Only Sixaxis controllers, and Rock Band 4 PS5 guitars which need it + * to name their battery, get an id. All others are set to -1. */ - if (sc->quirks & SIXAXIS_CONTROLLER) { + if (sc->quirks & (SIXAXIS_CONTROLLER | RB4_GUITAR_PS5)) { ret = ida_alloc(&sony_device_id_allocator, GFP_KERNEL); if (ret < 0) { sc->device_id = -1; -- 2.56.1