From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.182 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796090884; b=hrsBKzsfutE0mLDHMsiy6J7m7o5B9snIlR7RefiNeC3Z8cm0318agR+NdHG03k1qHbL3 4MKTT1Jq/PzOTKhWkn/Jbyz5vLqv3jBVNjhIIb48/cBQUDn7JMRS7IRLLNrGczQPplC5k MfW80jhZ0TcTK+YVyFoCJftE83cJ7ixfYzSfZ5Ns4k9q6XyPZ247agDAsQHuLW58SLd8W QN+j/gxaH0nLORsvY8O/nhj+8fJx2FU6Ib1VUKhLZq+zSPIATETEyDVATPzb6o4F5oPfs s0Q/gudJfwFY9h6zqCGHcqIfW2yBjcKzWiSZNRzUzlENWnVUmOuUcoZIug4fZwHq4+Q== 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-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=pxYaadwz9goFERUU4GnZtEMHCcQ99LiWXXCwX1HzcBnpwNVFaWnmk2KwCkFiUjNXiCgG mZmPpbvMtE9Q0Amsg9N+4zigpLA/MibB6tPlN12OXJUayRzyEs9Dau4DDjSk7/d3hOyfG 7djV1JtlIRO84N+vduOA4F7vMx5biAdA1LhJM8aMdxM/BXsguWvJqVdkUGSDmjqH9Nq6O 10vJjoKRLMbQKjsfTXiOz2laYwlWlpHzWCfDQlbdIjB7C+IFhANgo5iC7WykiMsVe4cv9 8+us/PW7hi4QJrRuB7NLyV1PSKCJqfkiVRSIM/Ry2ynj0E5EX1HR39Uqw9YfCt0uR2g== 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.182 Received: from mail-pf1-f182.google.com (mail-pf1-f182.google.com [209.85.210.182]) (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 99849606A31A for ; Tue, 1 Dec 2026 02:08:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 99849606A31A 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-f182.google.com with SMTP id d2e1a72fcca58-8b5c3288e6cso4414872b3a.3 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=sti6gUnFmDFe6zudJloqbCNMKZo0beqeWzBfhXaJx7gd+tvj/QvxqPDqn4XvqFktSH JOsh2aX40Ch1WUEOpmqUeK8Zcm6tidfMO1Tgf4FSQft854mKLmO3eBfEkjECEfw/LY1P 3cvGtlr4o/MoWvecafucutckkh6GQcKvJ5klgxfBYwfMesiSqZli+SA92HqF4qqstQEo ApLa/jxCjszZU4SOul5h+oUHJ4YVK4BZGcvwf0MD+KCszTrVAVXX+hZ/KRNN1PPV479s ecEMNlUEC6C444D8vt3jLKmstIvCA5MY0a3CH5iRTVxgYuaBQ0hvU/sGZYet2VlyQTsw byqg== X-Gm-Message-State: APuU4Z9tlWR25J5qlpLEv41T097tpe0ff8gWMH8/ygARPD7ZthLWT+1H CyR2Xcl19zAZ3p1sSTD1nfCylCEonckSEv5ntiBaza+iQ4qU0g/TIto6nEkBWxlfTYE= X-Gm-Gg: AZFdTZfrNrxMt9ps9x9HIvQ7/e/xLsB7PPbgjAGda19tCa+gdqEhpYjHAPZlvWRiesI OOEI2Esg472j6kigqLGCU+zffQMxfA+mKTn+UdyQOEv7dqH+T7pWJdbNvh7QWrVDNteJCTKvjxL 6gWbWX+2NaJE1ja7RJt/e7V6STK7EOhdN5W23gRPiUd0MiwWHaKSAoPQis++EtQUlbq4tgsMFVY ZafsOP3Q3Q3u3hQy9aEhr1j1NDSVgvAegSBUFyzjNuNX9Q/9JAZHcDC2Zv842Hd5sAtmh41xRyl SjUI63fiLvoKtyAkCbGNM6gftvFDcATKyNUl4/+7gtE4uXFoRfvlc2nWnzkAumHwnRwPo+DP34p WrxPcZj20P6c3D+H7f2RENBo8oQ0dOvF47Mi+cvosiJoswyu63pzg+V2WljsGkEeKiuv956W24b XjAHfCTJJPNl3C1uh784Hxr5V++D+PaFQlhPkqN5h28qGDEejlnZFufk87dEfRycL1fo4Rot1QF WV1OPB/H3LbvqJDVm2rXMBa9zy3W9GzeCPWmmveSo4xEJ0Da4R7KECoC7I9yxzOBmCSIaf15d3B 47yEOI0FQ7dKUDNMe/uekCeu8QH6jZKYDx1GUO0FgqKVDHhXpzZHKbc/oBKMrEiMIKqx/A40zyF Nz0q8MkAlNWqBLWGGn+K0z2RpVLZvaY5N4T7UhtoiNUf6xkV2myOEHd3/Wswvs6UOQk4nHm6KMh vKPFEghz8llbQ= 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-kernel@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