diff mbox series

[BlueZ,v2] Set `SDP_LARGE_MTU` flag for DS4 Rev. 2 product code

Message ID 20241220020818.478090-1-kieran.r.geary@gmail.com
State New
Headers show
Series [BlueZ,v2] Set `SDP_LARGE_MTU` flag for DS4 Rev. 2 product code | expand

Commit Message

Kieran Geary Dec. 20, 2024, 2:08 a.m. UTC
iterate over a table instead of checking individual product codes
---
 src/device.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/src/device.c b/src/device.c
index 2b3d19f55..09121e1b9 100644
--- a/src/device.c
+++ b/src/device.c
@@ -6038,7 +6038,12 @@  static int device_browse_gatt(struct btd_device *device, DBusMessage *msg)
 
 static uint16_t get_sdp_flags(struct btd_device *device)
 {
+	size_t i;
 	uint16_t vid, pid;
+	static const uint16_t device_sdp_flags[][3] = {
+		{0x054c, 0x05c4, SDP_LARGE_MTU},
+		{0x054c, 0x09cc, SDP_LARGE_MTU}
+	};
 
 	vid = btd_device_get_vendor(device);
 	pid = btd_device_get_product(device);
@@ -6047,8 +6052,11 @@  static uint16_t get_sdp_flags(struct btd_device *device)
 	 * results in SDP response being dropped by kernel. Workaround this by
 	 * forcing SDP code to use bigger MTU while connecting.
 	 */
-	if (vid == 0x054c && pid == 0x05c4)
-		return SDP_LARGE_MTU;
+	for (i=0; i<G_N_ELEMENTS(device_sdp_flags); i++) {
+		if (vid == device_sdp_flags[i][0] &&
+				pid == device_sdp_flags[i][1])
+			return device_sdp_flags[i][2];
+	}
 
 	if (btd_adapter_ssp_enabled(device->adapter))
 		return 0;