From patchwork Thu Apr 24 14:48:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ludovico de Nittis X-Patchwork-Id: 884066 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 660E219DF7D for ; Thu, 24 Apr 2025 14:49:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506176; cv=none; b=q0JgZrXJ6obUcJZvGM0eXzlOmoFxndRuoV80nU48tXCrpGSO8Ac8qus2cfXkF/bjByJdyfvKaue9QROCZlfU7TaJF6WD0AV/Y2Ok92jHoiQq12e1EXtd7t5totsbwaEhgcmzcolLz55klf//uwgfQa3N6DbGxB8gk5GVDhg5/I4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506176; c=relaxed/simple; bh=VbhOsvfPzj15yFnYL9KtWMl5bGSXIe6QDJnauWIS+TI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nnqBpAAwjCehECgRJ8mOfQPJOdVGMHWinKEJ+KfuYgfYo/RuODzo5k7mmKvPsG7u5Avu67jk36qrWwPoLK179oG3bUUxmQpAv01wZqYh0aXvgUaksLzgNlW0pgJIJ7KE1quIlpRslMBSdfbY3JTcvbMF5ZQpWDd9Bz3y0dux/5I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=LnubI00o; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="LnubI00o" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1745506167; bh=VbhOsvfPzj15yFnYL9KtWMl5bGSXIe6QDJnauWIS+TI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LnubI00o7RLJ55pY3GHKKG4ShsZHxSN12YjWMZ+RDzLQNngKQkm7+MIwBeaxrWznV uTshNIsI8LIPc0j7DsB5GRQfmtHuhMBH3o3lvCqImt2xO/L6sj+p+XxUNAsfn8NaJS Aklr0R5X9eQTGI8/Mn/vaS6Bph2fcHNI9Q97UkjN+z0jfpKhZL1mHBzCS2Xow2yn85 /+suMLUQZYswvBTMXcLdCg3GABthRNQIk2Z8kfysaaOhmxf59nEmTe2/lGxI3osaRx vFYfxPD+LZbYCSbgplcmLJ1L4Pfn4MQRADl3tqQXhtFqGPfc4IljZFJhBwTZLtQCf1 q+aL57aNXbWzA== Received: from localhost.localdomain (unknown [81.56.51.115]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: denittis) by bali.collaboradmins.com (Postfix) with ESMTPSA id 1E31C17E0C10; Thu, 24 Apr 2025 16:49:27 +0200 (CEST) From: Ludovico de Nittis To: linux-bluetooth@vger.kernel.org Cc: Ludovico de Nittis Subject: [PATCH BlueZ v3 1/7] src: Add new CablePairing property Date: Thu, 24 Apr 2025 16:48:25 +0200 Message-ID: <20250424144831.95766-2-ludovico.denittis@collabora.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250424144831.95766-1-ludovico.denittis@collabora.com> References: <20250424144831.95766-1-ludovico.denittis@collabora.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This adds initial support for a new CablePairing property. The property can be used for devices that are paired using a cable and don't support the expected bonding (with pairing/encryption), for example like the Sixaxis gamepads. --- doc/org.bluez.Device.rst | 7 +++++++ src/device.c | 40 ++++++++++++++++++++++++++++++++++++++++ src/device.h | 2 ++ 3 files changed, 49 insertions(+) diff --git a/doc/org.bluez.Device.rst b/doc/org.bluez.Device.rst index 13328249b..80501eddd 100644 --- a/doc/org.bluez.Device.rst +++ b/doc/org.bluez.Device.rst @@ -279,6 +279,13 @@ boolean LegacyPairing [readonly] Bluetooth 2.1 (or newer) devices that have disabled Extended Inquiry Response support. +boolean CablePairing [readonly] +``````````````````````````````` + + Set to true if the device was cable paired and it doesn't support the + canonical bonding with encryption, e.g. the Sixaxis gamepad. + If true, BlueZ will establish a connection without enforcing encryption. + string Modalias [readonly, optional] ```````````````````````````````````` diff --git a/src/device.c b/src/device.c index b82a905f9..123d44c14 100644 --- a/src/device.c +++ b/src/device.c @@ -239,6 +239,7 @@ struct btd_device { GSList *watches; /* List of disconnect_data */ bool temporary; bool connectable; + bool cable_pairing; unsigned int disconn_timer; unsigned int discov_timer; unsigned int temporary_timer; /* Temporary/disappear timer */ @@ -507,6 +508,9 @@ static gboolean store_device_info_cb(gpointer user_data) g_key_file_set_boolean(key_file, "General", "Blocked", device->blocked); + g_key_file_set_boolean(key_file, "General", "CablePairing", + device->cable_pairing); + if (device->wake_override != WAKE_FLAG_DEFAULT) { g_key_file_set_boolean(key_file, "General", "WakeAllowed", device->wake_override == @@ -908,6 +912,11 @@ bool btd_device_is_trusted(struct btd_device *device) return device->trusted; } +bool device_is_cable_pairing(struct btd_device *device) +{ + return device->cable_pairing; +} + static gboolean dev_property_get_address(const GDBusPropertyTable *property, DBusMessageIter *iter, void *data) { @@ -1153,6 +1162,17 @@ static gboolean dev_property_get_legacy(const GDBusPropertyTable *property, return TRUE; } +static gboolean dev_property_get_cable_pairing(const GDBusPropertyTable *property, + DBusMessageIter *iter, void *data) +{ + struct btd_device *device = data; + dbus_bool_t val = device->cable_pairing; + + dbus_message_iter_append_basic(iter, DBUS_TYPE_BOOLEAN, &val); + + return TRUE; +} + static gboolean dev_property_get_rssi(const GDBusPropertyTable *property, DBusMessageIter *iter, void *data) { @@ -3483,6 +3503,7 @@ static const GDBusPropertyTable device_properties[] = { { "Trusted", "b", dev_property_get_trusted, dev_property_set_trusted }, { "Blocked", "b", dev_property_get_blocked, dev_property_set_blocked }, { "LegacyPairing", "b", dev_property_get_legacy }, + { "CablePairing", "b", dev_property_get_cable_pairing }, { "RSSI", "n", dev_property_get_rssi, NULL, dev_property_exists_rssi }, { "Connected", "b", dev_property_get_connected }, { "UUIDs", "as", dev_property_get_uuids }, @@ -4062,6 +4083,9 @@ next: if (blocked) device_block(device, FALSE); + device->cable_pairing = g_key_file_get_boolean(key_file, "General", + "CablePairing", NULL); + /* Load device profile list */ uuids = g_key_file_get_string_list(key_file, "General", "Services", NULL, NULL); @@ -6416,6 +6440,22 @@ void device_set_legacy(struct btd_device *device, bool legacy) DEVICE_INTERFACE, "LegacyPairing"); } +void device_set_cable_pairing(struct btd_device *device, bool cable_pairing) +{ + if (!device) + return; + + if (device->cable_pairing == cable_pairing) + return; + + DBG("setting cable pairing %d", cable_pairing); + + device->cable_pairing = cable_pairing; + + g_dbus_emit_property_changed(dbus_conn, device->path, + DEVICE_INTERFACE, "CablePairing"); +} + void device_store_svc_chng_ccc(struct btd_device *device, uint8_t bdaddr_type, uint16_t value) { diff --git a/src/device.h b/src/device.h index 2e4a9771d..a35bb1386 100644 --- a/src/device.h +++ b/src/device.h @@ -94,6 +94,7 @@ bool device_is_connectable(struct btd_device *device); bool device_is_paired(struct btd_device *device, uint8_t bdaddr_type); bool device_is_bonded(struct btd_device *device, uint8_t bdaddr_type); bool btd_device_is_trusted(struct btd_device *device); +bool device_is_cable_pairing(struct btd_device *device); void device_set_paired(struct btd_device *dev, uint8_t bdaddr_type); void device_set_unpaired(struct btd_device *dev, uint8_t bdaddr_type); void btd_device_set_temporary(struct btd_device *device, bool temporary); @@ -101,6 +102,7 @@ void btd_device_set_trusted(struct btd_device *device, gboolean trusted); void btd_device_set_connectable(struct btd_device *device, bool connectable); void device_set_bonded(struct btd_device *device, uint8_t bdaddr_type); void device_set_legacy(struct btd_device *device, bool legacy); +void device_set_cable_pairing(struct btd_device *device, bool cable_pairing); void device_set_rssi_with_delta(struct btd_device *device, int8_t rssi, int8_t delta_threshold); void device_set_rssi(struct btd_device *device, int8_t rssi); From patchwork Thu Apr 24 14:48:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ludovico de Nittis X-Patchwork-Id: 885075 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B4541A0B08 for ; Thu, 24 Apr 2025 14:49:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506177; cv=none; b=OMmX+q5Lv+faMYAGWJ2C6YXXNkBvEjPTZyWEWZa0WnZ4AwbgWt/41DsEM4vxDKN2WYEzzNN1SapYSsqeZZb+PwAZMQLavPCZSee5AGlfvs7sU0NVoXkxYlZ1Z1A9x3sQmNTWeokV6Zp9Vksvu4HLNjwX/wY+KA0fAye23/Tkd9o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506177; c=relaxed/simple; bh=bzbxsFCYgrgxafRDANaBXMfZ86UQF2dBN1yjTIj/svQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=d95C9GUcU7o92yA/F7PtpYbFAG7otEHQjzaYOX5V25kEWU5ufFKZRovCY/st5itbobFcgYUjID/iYFkIHj0WAnn8wvukpDexUasWYB8hsi/Am7GJmDGPZCVg/nLMpV5nDrOgVJXZyGZO3bUJSevftVJOCAfYr2QD//jWn/D7Rbg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=mjyuOxpl; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="mjyuOxpl" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1745506167; bh=bzbxsFCYgrgxafRDANaBXMfZ86UQF2dBN1yjTIj/svQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mjyuOxplFApxbxRxLHpaTktbk6AWVRfU9dsaBDfvzJPHFyX/YduG0KLd2n01jgE0z Nvx+2LzCoHeF3fCvDCBhAU8hawELr+56zGyjKNVXxEquTtaxWxJYfsIFyFAGsVeSQf Ah4z/JybmMLqfsCojCdry6cHk863Zc9BDk7eZI1nBBICv1WkXPa1PiIp9eF1Gcb3ZM vvSMo0m3y5T/FpEmFlYliYwoep12LFWHtWShU3wDxsYsEtsUxaTqtQ8KoD4E+aqOnO JlIISIHUAobxS4PXi9esuISsfDuFr3B4NJOVXqxTaiJGgP6JbnVnt6wdrmDHiACiv+ 4kCaJSqfcDMEw== Received: from localhost.localdomain (unknown [81.56.51.115]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: denittis) by bali.collaboradmins.com (Postfix) with ESMTPSA id 72BA417E0F66; Thu, 24 Apr 2025 16:49:27 +0200 (CEST) From: Ludovico de Nittis To: linux-bluetooth@vger.kernel.org Cc: Ludovico de Nittis Subject: [PATCH BlueZ v3 2/7] client: Print CablePairing property Date: Thu, 24 Apr 2025 16:48:26 +0200 Message-ID: <20250424144831.95766-3-ludovico.denittis@collabora.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250424144831.95766-1-ludovico.denittis@collabora.com> References: <20250424144831.95766-1-ludovico.denittis@collabora.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When using the `info` command, include the new CablePairing value. --- client/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/client/main.c b/client/main.c index 6039aa50c..a2d9d88bf 100644 --- a/client/main.c +++ b/client/main.c @@ -1705,6 +1705,7 @@ static void cmd_info(int argc, char *argv[]) print_property(proxy, "Connected"); print_property(proxy, "WakeAllowed"); print_property(proxy, "LegacyPairing"); + print_property(proxy, "CablePairing"); print_uuids(proxy); print_property(proxy, "Modalias"); print_property(proxy, "ManufacturerData"); From patchwork Thu Apr 24 14:48:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ludovico de Nittis X-Patchwork-Id: 885076 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B4AA1A0BF1 for ; Thu, 24 Apr 2025 14:49:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506177; cv=none; b=JFpVXdV1klBCJlHv+s/ceE5/l3Zq+/2VENYM2ab9JBjEnDRNEfrzYycDr7Xm07L+2N0BMBVAHfpIyoa/G8NL3P4OnzBJr+ZIoq+SyoZ4o4rWFSrk9TCA6QH/wyY+WemKbCpJJ3C0hL0uqGuXzwaFZwmKgjuNkc4FEkzn2KYk2Gk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506177; c=relaxed/simple; bh=hHHfXQPELtG6DWgR/nCNtb6UfaVSn0ZO1qZBFKpyzm4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H/MTMOpNsFHdeDWiRIopOFWy2OA941mJol45WwPySfXK2f5atJgdJiz9xhQ5y/YqSwU8cvRL5W2azOUpzWQPX6cSkW9zJfEqkzyyVVWJuT0rTA9CWWNqOY8vZXGRCHqyNgm2TFPM0QeW0S0Tla7lQpHllYi25jskNOV/VxeXkUA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=iYO3Flnq; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="iYO3Flnq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1745506168; bh=hHHfXQPELtG6DWgR/nCNtb6UfaVSn0ZO1qZBFKpyzm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iYO3FlnqDqYue5YL7gKxEACgdwOhRXeyJ3vHziXFgomf5r9Tf9R8kMcQoi/guYdWj pQX0G9lFfTWSq1DwlhpzJdYk8v6HHyM9knkhXAK9s9RptatEJToOpiaDXqu4m11Fw2 UP+7jIzXzrdpMo/XjpMFQfYg2LagmGiR/JqRtzz9Vys4CfH+RsatnG2tfpXIs/CHAI W/5R2D1ftFIw+Yg9wULcvx5PMn5fai0t7zczWYOXVg4nISLUwtfxDdiG2X6XpVng/f 0etTtFlVuUr29+FuRXDgC93dQ/IkmQHpyhBem8/JCTJULw4hdl6tb5uN+ttuFA9RRB KGA1PuBMOhy6g== Received: from localhost.localdomain (unknown [81.56.51.115]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: denittis) by bali.collaboradmins.com (Postfix) with ESMTPSA id D368F17E3613; Thu, 24 Apr 2025 16:49:27 +0200 (CEST) From: Ludovico de Nittis To: linux-bluetooth@vger.kernel.org Cc: Ludovico de Nittis Subject: [PATCH BlueZ v3 3/7] sixaxis: Set CablePairing when pairing a Sixaxis with USB Date: Thu, 24 Apr 2025 16:48:27 +0200 Message-ID: <20250424144831.95766-4-ludovico.denittis@collabora.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250424144831.95766-1-ludovico.denittis@collabora.com> References: <20250424144831.95766-1-ludovico.denittis@collabora.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Sixaxis gamepads don't support encryption. When doing the USB cable pairing, set the CablePairing property to keep the connection to the device unencrypted. --- plugins/sixaxis.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c index 3e69f1dd2..ea160c65d 100644 --- a/plugins/sixaxis.c +++ b/plugins/sixaxis.c @@ -296,10 +296,13 @@ static void agent_auth_cb(DBusError *derr, void *user_data) remove_device = false; btd_device_set_temporary(closure->device, false); - if (closure->type == CABLE_PAIRING_SIXAXIS) + if (closure->type == CABLE_PAIRING_SIXAXIS) { btd_device_set_record(closure->device, HID_UUID, SIXAXIS_HID_SDP_RECORD); + device_set_cable_pairing(closure->device, true); + } + ba2str(&closure->bdaddr, device_addr); ba2str(¢ral_bdaddr, central_addr); ba2str(adapter_bdaddr, adapter_addr); From patchwork Thu Apr 24 14:48:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ludovico de Nittis X-Patchwork-Id: 884065 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5B4FD1A2381 for ; Thu, 24 Apr 2025 14:49:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506177; cv=none; b=RXqw0BWYtos7O+RpDJhChbiKjCSn+wGAF0XFuuV1ww4afCD4ZHc+htVO5TbZg5/m7PK4LguFo1VmDF3oIhg/8xrWFlyrlYpVaOG8YUplecnN/bzyipST3DmLhkQPGd1MPRuvLqyGzjqQZoo7ajxIRqwNS1p0SQJgUyuzzLLKlws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506177; c=relaxed/simple; bh=Z8dAh6lcf30KxGjHfgKPuIjnDT7b8gS7qlLzh3QOptA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=U91X4CZmIMxH3uS/4ftNUy15RRHeby4fYoMio1ZPAgxrSejnpUR9g0m1nNAABv3sgBpR7vcrs4Vv0u1LF68kH97JY5DgF9lMfEGYDrN/UtTJ26M3m2I1Kao7tsTEn+SwsgXRh8QMiQFxSuBC5Qs3noIQRyO7A9AYWy64+0QCWnM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=E6uuiy+y; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="E6uuiy+y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1745506168; bh=Z8dAh6lcf30KxGjHfgKPuIjnDT7b8gS7qlLzh3QOptA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=E6uuiy+yWfQOzrnZCCCpzMEOX7rNovSda6JfWCVYuZN30HeDaixEifDmDwc6KLK9y V97g0Pmdx52KL6OTKEswfd/L5N3gtSapXJ5Gpl/Xu56tqCArjUQunMrGdPC9D3KEn9 knIgLsl/EaItUFHgyLyR1jPVaZvPXlX2qC/YIZrLbFhinG0VjzY97GqqZig7xjNzq1 jVzwS8SzovmAXl/2RtAWNUJhQipPaBg2q7KFSmZevvvDFY+mKCuy/mnAG7MN6V6i45 2tvpGczz2qyt2LvO3ltT0vkw70rq1EpL/kfBhfM/BSdKODQFC7v6QMkMAgieuPozzX BRqxwNK3epl7Q== Received: from localhost.localdomain (unknown [81.56.51.115]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: denittis) by bali.collaboradmins.com (Postfix) with ESMTPSA id 3566117E3614; Thu, 24 Apr 2025 16:49:28 +0200 (CEST) From: Ludovico de Nittis To: linux-bluetooth@vger.kernel.org Cc: Ludovico de Nittis Subject: [PATCH BlueZ v3 4/7] adapter: Add btd_adapter_has_cable_pairing_devices() Date: Thu, 24 Apr 2025 16:48:28 +0200 Message-ID: <20250424144831.95766-5-ludovico.denittis@collabora.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250424144831.95766-1-ludovico.denittis@collabora.com> References: <20250424144831.95766-1-ludovico.denittis@collabora.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Add a function that can be used to know if any of the known devices have the `CablePaired` property set. --- src/adapter.c | 17 +++++++++++++++++ src/adapter.h | 1 + 2 files changed, 18 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index c21b38095..fd425e6d2 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -412,6 +412,23 @@ uint16_t btd_adapter_get_index(struct btd_adapter *adapter) return adapter->dev_id; } +bool btd_adapter_has_cable_pairing_devices(struct btd_adapter *adapter) +{ + GSList *l; + + if (!adapter) + return false; + + for (l = adapter->devices; l; l = l->next) { + struct btd_device *device = l->data; + + if (device_is_cable_pairing(device)) + return true; + } + + return false; +} + static gboolean process_auth_queue(gpointer user_data); static void dev_class_changed_callback(uint16_t index, uint16_t length, diff --git a/src/adapter.h b/src/adapter.h index 8dfbe762e..6b2bc28f6 100644 --- a/src/adapter.h +++ b/src/adapter.h @@ -30,6 +30,7 @@ struct queue; struct btd_adapter *btd_adapter_get_default(void); bool btd_adapter_is_default(struct btd_adapter *adapter); uint16_t btd_adapter_get_index(struct btd_adapter *adapter); +bool btd_adapter_has_cable_pairing_devices(struct btd_adapter *adapter); typedef void (*adapter_cb) (struct btd_adapter *adapter, gpointer user_data); From patchwork Thu Apr 24 14:48:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ludovico de Nittis X-Patchwork-Id: 885074 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 694DA1ACEC7 for ; Thu, 24 Apr 2025 14:49:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506180; cv=none; b=doIye5zepllLO3rbKnddl1GTZfXjTfgUrd+Xut5DiaU/mqrTjvzl7v0RWoj3w6jhNLOuGZpcJvrAIHZKLvAlr0cwZpG5iBAT8+oZ+3VQzGS8CWfk3uDWzbwiwdiWbl0VvxIZml7plfGCF+ePs8FpPDH7wkjd2BVsedmKxg7d1cQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506180; c=relaxed/simple; bh=lyXRXdTBgmZO9hqDz99rMOZWatIae0d9BbX5KDVxKyE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Q+gmpOigGsFIZNXtKKzBQemA/XN/a/Mgza8UTgB6c3lJvFVNq3gY0LT27FSCL2QavNh4DSE7zjnzhiCCIDinxuTI/pexQY+2ArbulowXvC34jP11uAjPZPWRmVK4j9j58+ybcR2WkaCqyxpyLeZk4Wr9FJ94X70cB+T5fJWQvTE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=omPz57Qt; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="omPz57Qt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1745506168; bh=lyXRXdTBgmZO9hqDz99rMOZWatIae0d9BbX5KDVxKyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=omPz57QtCUtt35EhABIcNvLx9VF5ZECl99nW6KVWCbXP9u24wUyNzIDBQAsxxtdpY 1WCC2KHo94l1C7GxF1SLMuKi/qY9vgY7HA8ilt6SqUgAAfr1h2H61aRs9laPPdBjR/ MgFZZp8ZyzaPk5AJe7oaBGXQkrbfJpPLiaiNB0AKry87wSELsCQFSeQk9wDs2giNVc 4LaemLKvrGRDmuKQVYU1jRQVRqVV3KmTYcARs/W/Mo/ZmkMUQ4VLXMplCXach55S3+ onnnLC1ANgUazqrNNDrN24Xq64fDwXC2tm8PY/N8Vf3QrNa6rsuwHg7Kmfnr+WIvT1 cA2qvbkuKTaFg== Received: from localhost.localdomain (unknown [81.56.51.115]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: denittis) by bali.collaboradmins.com (Postfix) with ESMTPSA id 8A8ED17E3626; Thu, 24 Apr 2025 16:49:28 +0200 (CEST) From: Ludovico de Nittis To: linux-bluetooth@vger.kernel.org Cc: Ludovico de Nittis Subject: [PATCH BlueZ v3 5/7] input: Automatically use sec level low when using a cable paired device Date: Thu, 24 Apr 2025 16:48:29 +0200 Message-ID: <20250424144831.95766-6-ludovico.denittis@collabora.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250424144831.95766-1-ludovico.denittis@collabora.com> References: <20250424144831.95766-1-ludovico.denittis@collabora.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 BT_IO_SEC_LOW is the only way to allow devices that use cable pairing to establish a connection. This adds the ability to start the listening input server with BT_IO_SEC_LOW to avoid breaking support for these devices, and then, in `hidp_add_connection()`, we check if either `classic_bonded_only` was disabled or if this device has `CablePairing`. If neither are true, we bump the security back to BT_IO_SEC_MEDIUM, i.e. enforcing encryption. This allows supporting these devices without having to change the classic bonded only option. This doesn't cover the case where a device with `CablePairing` gets loaded from storage. That case will be handled with a followup commit. --- profiles/input/device.c | 9 ++++-- profiles/input/manager.c | 3 +- profiles/input/server.c | 63 ++++++++++++++++++++++++++++++++++++++-- profiles/input/server.h | 3 +- 4 files changed, 71 insertions(+), 7 deletions(-) diff --git a/profiles/input/device.c b/profiles/input/device.c index 3627573e7..806177a0b 100644 --- a/profiles/input/device.c +++ b/profiles/input/device.c @@ -1065,6 +1065,7 @@ static gboolean encrypt_notify(GIOChannel *io, GIOCondition condition, static int hidp_add_connection(struct input_device *idev) { struct hidp_connadd_req *req; + bool cable_pairing; GError *gerr = NULL; int err; @@ -1088,8 +1089,10 @@ static int hidp_add_connection(struct input_device *idev) if (device_name_known(idev->device)) device_get_name(idev->device, req->name, sizeof(req->name)); + cable_pairing = device_is_cable_pairing(idev->device); + /* Make sure the device is bonded if required */ - if (classic_bonded_only && !input_device_bonded(idev)) { + if (!cable_pairing && classic_bonded_only && !input_device_bonded(idev)) { error("Rejected connection from !bonded device %s", idev->path); goto cleanup; } @@ -1098,7 +1101,9 @@ static int hidp_add_connection(struct input_device *idev) /* Some platforms may choose to require encryption for all devices */ /* Note that this only matters for pre 2.1 devices as otherwise the */ /* device is encrypted by default by the lower layers */ - if (classic_bonded_only || idev->type == BT_UHID_KEYBOARD) { + /* Don't enforce encryption for cable paired devices because they */ + /* don't support it */ + if (!cable_pairing && (classic_bonded_only || idev->type == BT_UHID_KEYBOARD)) { if (!bt_io_set(idev->intr_io, &gerr, BT_IO_OPT_SEC_LEVEL, BT_IO_SEC_MEDIUM, BT_IO_OPT_INVALID)) { diff --git a/profiles/input/manager.c b/profiles/input/manager.c index d1accc24f..95ca0a7ee 100644 --- a/profiles/input/manager.c +++ b/profiles/input/manager.c @@ -33,7 +33,8 @@ static int hid_server_probe(struct btd_profile *p, struct btd_adapter *adapter) { - return server_start(btd_adapter_get_address(adapter)); + return server_start(btd_adapter_get_address(adapter), + btd_adapter_has_cable_pairing_devices(adapter)); } static void hid_server_remove(struct btd_profile *p, diff --git a/profiles/input/server.c b/profiles/input/server.c index 79cf08a66..e1160d668 100644 --- a/profiles/input/server.c +++ b/profiles/input/server.c @@ -266,12 +266,23 @@ drop: g_io_channel_shutdown(chan, TRUE, NULL); } -int server_start(const bdaddr_t *src) +static BtIOSecLevel get_necessary_sec_level(bool device_cable_pairing) +{ + /* Use lower security to allow the cable paired devices to connect. */ + /* Unless classic bonded only mode is disabled, the security level */ + /* will be bumped again for non cable paired devices in + /* hidp_add_connection() */ + if (device_cable_pairing) + return BT_IO_SEC_LOW; + + return input_get_classic_bonded_only() ? BT_IO_SEC_MEDIUM : BT_IO_SEC_LOW; +} + +int server_start(const bdaddr_t *src, bool device_sixaxis_cable_pairing) { struct input_server *server; GError *err = NULL; - BtIOSecLevel sec_level = input_get_classic_bonded_only() ? - BT_IO_SEC_MEDIUM : BT_IO_SEC_LOW; + const BtIOSecLevel sec_level = get_necessary_sec_level(device_sixaxis_cable_pairing); server = g_new0(struct input_server, 1); bacpy(&server->src, src); @@ -308,6 +319,52 @@ int server_start(const bdaddr_t *src) return 0; } +int server_set_cable_pairing(const bdaddr_t *src, bool device_cable_pairing) +{ + struct input_server *server; + GSList *l; + BtIOSecLevel sec_level; + const BtIOSecLevel new_sec_level = get_necessary_sec_level(device_cable_pairing); + GError *err = NULL; + + l = g_slist_find_custom(servers, src, server_cmp); + if (!l) + return -1; + + server = l->data; + + bt_io_get(server->ctrl, &err, BT_IO_OPT_SEC_LEVEL, &sec_level, + BT_IO_OPT_INVALID); + if (err) { + error("%s", err->message); + g_error_free(err); + return -1; + } + + if (sec_level == new_sec_level) { + DBG("The listening input server is already using the expected security level"); + return -1; + } + + DBG("Applying the new security level to the listening input server"); + + if (!bt_io_set(server->ctrl, &err, BT_IO_OPT_SEC_LEVEL, new_sec_level, + BT_IO_OPT_INVALID)) { + error("bt_io_set(OPT_SEC_LEVEL): %s", err->message); + g_error_free(err); + return -1; + } + + if (!bt_io_set(server->intr, &err, BT_IO_OPT_SEC_LEVEL, new_sec_level, + BT_IO_OPT_INVALID)) { + error("bt_io_set(OPT_SEC_LEVEL): %s", err->message); + g_error_free(err); + return -1; + } + + return 0; +} + void server_stop(const bdaddr_t *src) { struct input_server *server; diff --git a/profiles/input/server.h b/profiles/input/server.h index 50f4b6135..4ad82c10e 100644 --- a/profiles/input/server.h +++ b/profiles/input/server.h @@ -8,5 +8,6 @@ * */ -int server_start(const bdaddr_t *src); +int server_start(const bdaddr_t *src, bool device_cable_pairing); +int server_set_cable_pairing(const bdaddr_t *src, bool device_cable_pairing); void server_stop(const bdaddr_t *src); From patchwork Thu Apr 24 14:48:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ludovico de Nittis X-Patchwork-Id: 884064 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 694881AA1F4 for ; Thu, 24 Apr 2025 14:49:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506180; cv=none; b=BX40JbnxQJ5fTrIsp6z7+ne7Jd0jZ16rTb0isTJ3GTHWXT/tmcJEfdQHnQQ4Xh8yiL+PNOUVkpT48C40M6l2iqMQMHBygQHbQkrDu+LHc9Jcwg+EpwtA3hK1cQ7JnC34fPjzH83usMrkto8G0DYMt5rvzLYfTbc9wAYBw36aalw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506180; c=relaxed/simple; bh=sO2suyNYTHAjKiC5MF2Eyb4a1RhA3eniOwJ0ja+qevw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=gl8EOgErukbkuJAxcLJhpSQ0AewQqdI4loB3FljYvxZRlu4sXkj/DOLNsGkCN6XZ2gDYm30TcMaJP6bHpqsU7UjjwJt2NR5bbrA0TrAXJWUxd2KhqBuHrlbn/2+ahXf/+aZNcBcuyUbZcFWBrnWHj7R3QQxW0loo74nr1qdo+W4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=N/kAoQLa; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="N/kAoQLa" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1745506169; bh=sO2suyNYTHAjKiC5MF2Eyb4a1RhA3eniOwJ0ja+qevw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N/kAoQLa1OgZezCU++pNFq/9WfhEJg4T4VKBEqSeaPoPf5O3ddU/ceDai8r/xqNgN TCDIC90Dnrv/poTD02F3NR61EPnubdu8IS8wQNzSSbV7/TApSXQULdUHn8f6KdkH4N sxjiGbggnyaSq78HuVWs7xC602aWg0ORPqGwNDjZv8DJwgnvN0m13yUzPudKm0GIbw kq9xZBb2gNPJv1UQEWe2HSdFS+312KLKYb521ypKeMooHMYMaEn+OAko0CmmaX0I93 8U3WyO8V3K2qYdEG8yEUYhCgbkszxhmd5wn4UUCM3EtpFKhMV1XIrZf43c2isewmIw HSUuWFRLAa4zg== Received: from localhost.localdomain (unknown [81.56.51.115]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: denittis) by bali.collaboradmins.com (Postfix) with ESMTPSA id E034A17E362C; Thu, 24 Apr 2025 16:49:28 +0200 (CEST) From: Ludovico de Nittis To: linux-bluetooth@vger.kernel.org Cc: Ludovico de Nittis Subject: [PATCH BlueZ v3 6/7] adapter: Set server security level in load_devices() Date: Thu, 24 Apr 2025 16:48:30 +0200 Message-ID: <20250424144831.95766-7-ludovico.denittis@collabora.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250424144831.95766-1-ludovico.denittis@collabora.com> References: <20250424144831.95766-1-ludovico.denittis@collabora.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 After loading known devices from storage, change the security level if we have a device with `CablePairing`. This will allow it to successfully establish a connection. --- src/adapter.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/adapter.c b/src/adapter.c index fd425e6d2..8d875013c 100644 --- a/src/adapter.c +++ b/src/adapter.c @@ -68,6 +68,7 @@ #include "adv_monitor.h" #include "eir.h" #include "battery.h" +#include "profiles/input/server.h" #define MODE_OFF 0x00 #define MODE_CONNECTABLE 0x01 @@ -5090,6 +5091,12 @@ free: g_key_file_free(key_file); } + if (btd_adapter_has_cable_pairing_devices(adapter)) { + DBG("There is at least one known cable paired device, setting the " + "listening input server security level accordingly"); + server_set_cable_pairing(&adapter->bdaddr, true); + } + closedir(dir); load_link_keys(adapter, keys, btd_opts.debug_keys); From patchwork Thu Apr 24 14:48:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ludovico de Nittis X-Patchwork-Id: 884063 Received: from bali.collaboradmins.com (bali.collaboradmins.com [148.251.105.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6940F1AA1D2 for ; Thu, 24 Apr 2025 14:49:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=148.251.105.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506181; cv=none; b=bZJ6RcVF6puAFyZ9VkkVkCOg4tsAhR4+kM8gOY120ElUARxlHwxFs5ZK1FiAWopeLmRV4ioAbWkPkmAWTWVOGzLH/hEdy5EzIMH1v0K17V3wkx/zVuijRYQRQOciptkGTgq7jlpFYt9YdYjGRm+ro+oaDZh5yEd7RqIVysc1z0I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745506181; c=relaxed/simple; bh=2lyiIniWEG0DJoQfeCCzixYYIF3vFCiCN1jEqIf9zeU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=knTOPydQ+vclkb+WRzg5xsZVec8pbY2z08pqEmVxPOvFy1CbC7+110M0hmgAr2SdL/s6gYEIqYl410gGpMZs8WeszpsFsQ528z7z+bZN5ibLcZTzqo/1SimMg8VtcAvPukoA2y6kr2CY7xsZSGExEfTjhxtnjAvcbBdPHZHKyYI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b=WYUrAk9I; arc=none smtp.client-ip=148.251.105.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=collabora.com header.i=@collabora.com header.b="WYUrAk9I" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1745506169; bh=2lyiIniWEG0DJoQfeCCzixYYIF3vFCiCN1jEqIf9zeU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WYUrAk9Id7v4zBqi/Y5t82fY2pMSAH9yOk5TFSxNMgetK2icFvaGSV1mNfQr3CDX4 puIw0K/fQde/1AE+A71U0PmBTBnGID3dAU1QTTFQVEGhJDI8eL/FlSzW2L3gIzdfq/ X0242NP6wyZZMj5mjH0LasayWWOxlkdpt90bzDyKsC6rr1kDJfDiDsERyM0Gj0TPpP cfChUqUEqXhNt5QjTGo+W8MSwYLayr+KhPOnT/22IGe9x9K274aTYH3wvW8QQGpJE9 emc9KZfoOOH7e16kLQWWy38CCc3uZa4B/dp8YbXwArHJ1j8+7QN5btk4rBt3EtWI6a g1FTuQ1NjxkhQ== Received: from localhost.localdomain (unknown [81.56.51.115]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: denittis) by bali.collaboradmins.com (Postfix) with ESMTPSA id 3F29A17E36BB; Thu, 24 Apr 2025 16:49:29 +0200 (CEST) From: Ludovico de Nittis To: linux-bluetooth@vger.kernel.org Cc: Ludovico de Nittis Subject: [PATCH BlueZ v3 7/7] sixaxis: Set security level when adding a sixaxis device Date: Thu, 24 Apr 2025 16:48:31 +0200 Message-ID: <20250424144831.95766-8-ludovico.denittis@collabora.com> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250424144831.95766-1-ludovico.denittis@collabora.com> References: <20250424144831.95766-1-ludovico.denittis@collabora.com> Precedence: bulk X-Mailing-List: linux-bluetooth@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 When doing the cable pairing for a sixaxis, we may need to change the listening input server security level. This is because sixaxis gamepads can only work with the level BT_IO_SEC_LOW. --- plugins/sixaxis.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c index ea160c65d..1fab8ae59 100644 --- a/plugins/sixaxis.c +++ b/plugins/sixaxis.c @@ -36,6 +36,7 @@ #include "src/plugin.h" #include "src/log.h" #include "src/shared/util.h" +#include "profiles/input/server.h" #include "profiles/input/sixaxis.h" struct authentication_closure { @@ -301,6 +302,8 @@ static void agent_auth_cb(DBusError *derr, void *user_data) SIXAXIS_HID_SDP_RECORD); device_set_cable_pairing(closure->device, true); + + server_set_cable_pairing(adapter_bdaddr, true); } ba2str(&closure->bdaddr, device_addr);