[PATCH v2 05/11] profiles/input: Add DS4 devices to the shared header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



And simplify the detection code in server.c some more.
---
 profiles/input/server.c  |  7 ++-----
 profiles/input/sixaxis.h | 17 +++++++++++++++++
 2 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/profiles/input/server.c b/profiles/input/server.c
index 121c334d3..ef428fefe 100644
--- a/profiles/input/server.c
+++ b/profiles/input/server.c
@@ -134,11 +134,8 @@ static bool dev_is_sixaxis(const bdaddr_t *src, const bdaddr_t *dst)
 	pid = btd_device_get_product(device);
 
 	type = get_pairing_type(vid, pid, NULL, NULL, NULL);
-	if (type == CABLE_PAIRING_SIXAXIS)
-		return true;
-
-	/* DualShock 4 */
-	if (vid == 0x054c && pid == 0x05c4)
+	if (type == CABLE_PAIRING_SIXAXIS ||
+	    type == CABLE_PAIRING_DS4)
 		return true;
 
 	return false;
diff --git a/profiles/input/sixaxis.h b/profiles/input/sixaxis.h
index 0b3c4e397..17a7dc3f7 100644
--- a/profiles/input/sixaxis.h
+++ b/profiles/input/sixaxis.h
@@ -29,6 +29,7 @@
 typedef enum {
 	CABLE_PAIRING_UNSUPPORTED = 0,
 	CABLE_PAIRING_SIXAXIS,
+	CABLE_PAIRING_DS4,
 } CablePairingType;
 
 static inline CablePairingType get_pairing_type(uint16_t   vid,
@@ -61,6 +62,22 @@ static inline CablePairingType get_pairing_type(uint16_t   vid,
 			.version = 0x0000,
 			.type = CABLE_PAIRING_SIXAXIS,
 		},
+		{
+			.name = "Wireless Controller",
+			.source = 0x0002,
+			.vid = 0x054c,
+			.pid = 0x05c4,
+			.version = 0x0001,
+			.type = CABLE_PAIRING_DS4,
+		},
+		{
+			.name = "Wireless Controller",
+			.source = 0x0002,
+			.vid = 0x054c,
+			.pid = 0x09cc,
+			.version = 0x0001,
+			.type = CABLE_PAIRING_DS4,
+		},
 	};
 	guint i;
 
-- 
2.14.2

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux