[PATCH 3/3] input: Add DualShock 4 detection

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

 



DS4 tries to connect right after pairing before SDP search completed
and no idev is present yet.
---
 profiles/input/server.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/profiles/input/server.c b/profiles/input/server.c
index 3814eaf..21c589c 100644
--- a/profiles/input/server.c
+++ b/profiles/input/server.c
@@ -118,18 +118,24 @@ static void sixaxis_browse_sdp(const bdaddr_t *src, const bdaddr_t *dst,
 static bool dev_is_sixaxis(const bdaddr_t *src, const bdaddr_t *dst)
 {
 	struct btd_device *device;
+	uint16_t vid, pid;
 
 	device = btd_adapter_find_device(adapter_find(src), dst);
 	if (!device)
 		return false;
 
-	if (btd_device_get_vendor(device) != 0x054c)
-		return false;
+	vid = btd_device_get_vendor(device);
+	pid = btd_device_get_product(device);
 
-	if (btd_device_get_product(device) != 0x0268)
-		return false;
+	/* DualShock 3 */
+	if (vid == 0x054c && pid == 0x0268)
+		return true;
+
+	/* DualShock 4 */
+	if (vid == 0x054c && pid == 0x05c4)
+		return true;
 
-	return true;
+	return false;
 }
 
 static void connect_event_cb(GIOChannel *chan, GError *err, gpointer data)
-- 
1.8.5.3

--
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