Linux bluetooth development
 help / color / mirror / Atom feed
* [PATCH BlueZ] hog: Fix starting encryption on some BLE remotes
@ 2026-06-08  9:11 Simon Mikuda
  2026-06-08 12:00 ` [BlueZ] " bluez.test.bot
  2026-06-08 14:23 ` [PATCH BlueZ] " Luiz Augusto von Dentz
  0 siblings, 2 replies; 6+ messages in thread
From: Simon Mikuda @ 2026-06-08  9:11 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Simon Mikuda

When BLE remote doesn't reply with Insufficient Authentication Error
encryption is not started.

Good remote:
< ACL Data TX: Handle 64 flags 0x00 dlen 7
      ATT: Read Request (0x0a) len 2
        Handle: 0x0021 Type: HID Information (0x2a4a)
> ACL Data RX: Handle 64 flags 0x02 dlen 9
      ATT: Error Response (0x01) len 4
        Read Request (0x0a)
        Handle: 0x0000
        Error: Insufficient Authentication (0x05)
< HCI Command: LE Start Encryption (0x08|0x0019) plen 28
        Handle: 64 Address: xx:xx:xx:xx:xx:xx (OUI xx-xx-xx)
        Random number: ...
        Encrypted diversifier: ...
        Long term key: ...

Bad remote:
< ACL Data TX: Handle 64 flags 0x00 dlen 7
      ATT: Read Request (0x0a) len 2
        Handle: 0x001e Type: HID Information (0x2a4a)
> ACL Data RX: Handle 64 flags 0x02 dlen 9
      ATT: Read Response (0x0b) len 4
---
 profiles/input/hog.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index f50a0f217..845087c9d 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -189,6 +189,9 @@ static int hog_accept(struct btd_service *service)
 		if (!bt_gatt_client_set_security(client,
 						BT_ATT_SECURITY_MEDIUM))
 			return -ECONNREFUSED;
+	} else if (auto_sec) {
+		bt_gatt_client_set_security(btd_device_get_gatt_client(device),
+				BT_ATT_SECURITY_MEDIUM);
 	}
 
 	/* TODO: Replace GAttrib with bt_gatt_client */
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-06-09 16:46 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-08  9:11 [PATCH BlueZ] hog: Fix starting encryption on some BLE remotes Simon Mikuda
2026-06-08 12:00 ` [BlueZ] " bluez.test.bot
2026-06-08 14:23 ` [PATCH BlueZ] " Luiz Augusto von Dentz
2026-06-09 16:25   ` Simon Mikuda
2026-06-09 16:35     ` Luiz Augusto von Dentz
2026-06-09 16:46       ` Simon Mikuda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox