From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.45 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796065474; b=XEP1M+PNSy5OUjf2l1sHbcVcuoTnekSgkk7zTaJNTFLLtSxCSboOoo8J2ruYMhAa7AP7 epxYN5TP4GtNxGGSNZnghP2SwJipadNyBam2F0nryNQVIXDUqgSlNoZGjfNn3s3UTKBGe ksnlebmm8BbxfWKAbi6OWpXHv0NylRiQMn6FTxMv+4hPi1L/3D68ZGBsFPUT54FVi+Ubr ijWCWK9MYm8k36bXZF5IGKuRhY1fu2WuKh4Tyn/vQLRSlaDuzFCA3vQIhzIL622qnz4kx osTpzN/SH6CgxXWBw/Y271lRnDwSHkylNsJ9eRCfQ+AqJBu/ReuXdHYha2ogb6BopTA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796065474; 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=DKseFa86gt54b8YkUp7FZBsrfqhTz6OfWncThVuLX6Q=; b=z+PIv7EIn9X4vE+myz0X7ho/zEEsSReaHazkOQEEwIoAJdJeYinyXw8hyevb4IvryBdx D0MiD9rcffNgqW9JAr0URa6wkwtG+QPnYS3neLwyxgE9tTxgRZePrf2GmYvyfkb1/e1xW sQC8+4Xp1Oa1//7/D/NGTTP5L9gzlkquzXeI8VU0Fdx35NmhQnOL4r+aSXD6n1iq9LVbj jMmWWEEd9pc8gQxdppLKiVbnlmL1IUs/5yithmDQOAFZJTeV5ZxOq8lIkzeWTbvUfDnI7 +F0Ysr1WcKUqvD0Ok426RdhrGkmsLt4HZgYLHaQZ58NS6+Bs5ojOiPUqb/fyubkwHaA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=googlemail.com; spf=pass smtp.mailfrom=googlemail.com; dkim=pass header.d=googlemail.com header.i=@googlemail.com header.a=rsa-sha256 header.s=20260707 header.b=NmjZwm58; arc=none smtp.remote-ip=209.85.128.45 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (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 DD541606A32E for ; Mon, 30 Nov 2026 19:04:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org DD541606A32E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=googlemail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=googlemail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=googlemail.com header.i=@googlemail.com header.a=rsa-sha256 header.s=20260707 header.b=NmjZwm58 Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-4ba013938d7so102890745e9.2 for ; Mon, 30 Nov 2026 11:04:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20260707; t=1796065472; x=1796670272; 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=DKseFa86gt54b8YkUp7FZBsrfqhTz6OfWncThVuLX6Q=; b=NmjZwm58SL4B7dUO6D2z1reBMpSnD5ufZlop2pfx4kZy6TRmw+Q953tteh913ch9lx OR8wS3qV8TPju7tysLU/32ATCEsbWr/H3JgLVSok1k5ZUwSa3w6lS1+WL5XYV3/yZIXH Q0BD7aBQH8sLbsC/1mUXa/bfqP+aq4pXOCjpd9gSP9scDQTt3yw/kmH21RSuQMdDZyQM XH0dqbGcr0tcD6sGItLygM45gZeEZdgTBmB77G5AEUNIsFh2FDI+FR4khzBnt16YbM81 nyoxqB++2bkdhCuNgcVKORDEYbTZIACDoEmeMeG72XoveG+cJdsI8ka1XR64ZmlUB8KQ /Ibg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796065472; x=1796670272; 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=DKseFa86gt54b8YkUp7FZBsrfqhTz6OfWncThVuLX6Q=; b=cBUqfbEzchE3YAwBBfN+qPD5NpRxdBJhqKyVMUy2cPl1zXw5xzBD4JiTfnEda6cZwr jY26xk3XKcBLb5grdnCiXfQngbZq+yANThsOipHTEfkkbnawWQQdEBXViVJeZCscYoKF AUM3020TcJcQNpkx8tZ5YQjasD5AXP64FMMrUbCY0EzJD7YR3IVHb8e3ehaaxEX8je3c ogHcpFC4cDatb3QGn1sXpTcfGMUXvOgmTjYZtwu80l7TE1x1HikpHM1HKq62FIeAU2dR kBYi7FjxKUOeJaQwXg5fkGKP0+51IjGH5RI8u+jQyYAZ4VRpBb1o78fxfLz7lCf6eqqY /hYA== X-Gm-Message-State: APuU4Z8MBJgGymvBXXX4OHbKo4NbpaxRbdguO2VlnO96QQWVLjOTttlA VsuazhJ+SU+F3LPnFi2hpwYrfpPFhuay3NyXHG/Yj5KWjrmgwaPeIatM3SDnVDvgIeE= X-Gm-Gg: AZFdTZeRm5CwQ027liIAFZEr3Nj+C9pSdN1iQc8DhkBjnCKwN+zLKuiQmNeVNDREbgb tTCs+hQ9wjbeVrq6DuLdFiR57FgV5z6Bimrgfc9hDBDwA3NyORtYdepcaPb/N/9vZCSYF0ShQ+e EiYMAxGl+O73yxc9DJTKNjgMAVOCMmsWjl7uq5JQx3GUyWE54wLxeEp8+JTobz1p2i0nv8J+LAz 1egnXNpNo/sb1L0ePovRkiakfF7zuQbp8TGKxr/Gwd4/Oejux42nCAfFBfNVAjyivGrQVpfpBmM DPPxxH1kgkLYk2O+jPI5agIyhNx6GDUg/eJFqu550wcqbkL+IpItNBCo+AA6m6gzNzHlE6fGGqC 12TSQyfrwaLpYMgVIfU6zk/OoRhsaDm/LPHDW4slxT2D/Uju2CVz5cJI9hHB/wCw4KEcOj/I1Kk LSikMG2/th8FWyLeSkasPi8wXuwgeL7jZsajSqWrZDglefwuxF4Gwrgo6A0ytTyZKmNEKUvvipN qunSKu2faoH5F3cmHmoJppDtDenwG/L0O144Vitnk5x1oaH4JFCR00nzOJfV4CL1WTPTCUs6TDX pEXdB88wIWnCKmJRYxn/ju15hLuRiFbkELbRwSAy2xux0ouFcTTeQD+bS+qaE3CaOAdKgflwO46 HqLA= X-Received: by 2002:a05:600c:6290:b0:4bb:741d:eba with SMTP id 5b1f17b1804b1-4bb88824a5bmr673598565e9.13.1796065472054; Mon, 30 Nov 2026 11:04:32 -0800 (PST) Received: from sp8 (213-146-237-228.ptr.skytron.de. [213.146.237.228]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bb8538b09bsm1727776655e9.4.2026.11.30.11.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 11:04:31 -0800 (PST) From: Sebastian To: linux-bluetooth@vger.kernel.org Cc: Sebastian , "Claude Opus 5.5" Subject: [PATCH 2/2] shared/hog: Accept Report Map longer than 512 octets Date: Mon, 30 Nov 2026 20:03:40 +0100 Message-ID: <20261130190340.201189-3-seb.witt@googlemail.com> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261130190340.201189-1-seb.witt@googlemail.com> References: <20261130190340.201189-1-seb.witt@googlemail.com> X-Mailing-List: linux-bluetooth@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 Some HID over GATT devices expose a Report Map longer than 512 octets, such as the Inateck KB05113 keyboard with touchpad (3373:7713), which sends 637 octets. Since 5.88 it is truncated when read, the kernel then fails to parse it and no input device is created: hid-generic 0005:3373:7713.0005: item fetching failed at offset 509/512 hid-generic 0005:3373:7713.0005: probe with driver hid-generic failed Other Inateck keyboards, the HP 720 keyboard and the Sanwa MA-PB521GM touchpad, with Report Maps of 612 to 902 octets, are reported to fail the same way. This is a regression: commit 952c08ff50c5 ("hog-lib: Don't restrict Report MAP size") made hog-lib read Report Maps of any size, since other operating systems don't enforce the limit and many devices exceed it. Since commit 96f1201f5ac2 ("input/hog: Use shared/hog") the Report Map is read with bt_gatt_client_read_value, which truncates to BT_ATT_MAX_VALUE_LEN. Read it with bt_gatt_client_read_long_value_max_len up to 4096 octets, the size of HID descriptor UHID_CREATE2 accepts, which makes the keyboard and touchpad work again. Fixes: 96f1201f5ac2 ("input/hog: Use shared/hog") Fixes: https://github.com/bluez/bluez/issues/2814 Co-Authored-By: Claude Opus 5.5 --- src/shared/hog.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/shared/hog.c b/src/shared/hog.c index e62423fa4..be57399f7 100644 --- a/src/shared/hog.c +++ b/src/shared/hog.c @@ -56,6 +56,12 @@ #define HOG_PROTO_MODE_BOOT 0 #define HOG_PROTO_MODE_REPORT 1 +/* Some peripherals expose a Report Map longer than the 512 octets an + * attribute value may have (Core v5.4, Vol 3, Part F, Section 3.2.9). + * Accept up to the size of HID descriptor UHID_CREATE2 can take. + */ +#define HOG_REPORT_MAP_MAX_LEN 4096 + #define HOG_INFO_FLAG_SCI_SUPPORTED 0x04 #define HOG_INFO_FLAG_SCI_LOW_POWER 0x08 @@ -151,7 +157,8 @@ static void db_value_cb(struct gatt_db_attribute *attr, int err, * The requests are cancelled by cancelling all the requests of the client, * which is a clone owned by hog, once detached. */ -static void read_char(struct bt_hog *hog, uint16_t handle, bool cache, +static void read_char_max_len(struct bt_hog *hog, uint16_t handle, + bool cache, uint16_t max_len, bt_gatt_client_read_callback_t func, void *data) { if (cache) { @@ -169,11 +176,18 @@ static void read_char(struct bt_hog *hog, uint16_t handle, bool cache, } } - if (!bt_gatt_client_read_value(hog->client, handle, func, data, - NULL)) + if (!bt_gatt_client_read_long_value_max_len(hog->client, handle, 0, + max_len, func, data, NULL)) DBG(hog, "Could not read handle 0x%04x", handle); } +static void read_char(struct bt_hog *hog, uint16_t handle, bool cache, + bt_gatt_client_read_callback_t func, void *data) +{ + read_char_max_len(hog, handle, cache, BT_ATT_MAX_VALUE_LEN, func, + data); +} + /* Cache a static value in the gatt_db, see read_char */ static void cache_value(struct bt_hog *hog, uint16_t handle, const uint8_t *value, uint16_t length) @@ -1103,7 +1117,9 @@ static void foreach_hog_chrc(struct gatt_db_attribute *attr, void *user_data) * handled by reading it with Read Blob, unless cached. */ hog->report_map_handle = value_handle; - read_char(hog, value_handle, true, report_map_read_cb, hog); + read_char_max_len(hog, value_handle, true, + HOG_REPORT_MAP_MAX_LEN, + report_map_read_cb, hog); gatt_db_service_foreach_desc(attr, foreach_hog_external, hog); return; -- 2.56.1