bluez/0005-profiles-input-Use-sixaxis-header-to-simplify-device.patch
Bastien Nocera 88e5001cf2 + bluez-5.46-4
Patches cleanup
Add DualShock4 cable pairing support
BIND_NOW support for RELRO
iCade autopairing support
2017-09-05 11:11:13 +02:00

57 lines
1.5 KiB
Diff

From 493f46056fba02eb767fc881089de2b204b9166a Mon Sep 17 00:00:00 2001
From: Bastien Nocera <hadess@hadess.net>
Date: Fri, 25 Aug 2017 19:04:16 +0200
Subject: [PATCH 5/9] profiles/input: Use sixaxis header to simplify device
detection
Use the shared header to recognise whether a device is a Sixaxis device
or not.
---
profiles/input/server.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/profiles/input/server.c b/profiles/input/server.c
index eb3fcf843..121c334d3 100644
--- a/profiles/input/server.c
+++ b/profiles/input/server.c
@@ -43,6 +43,7 @@
#include "src/device.h"
#include "src/profile.h"
+#include "sixaxis.h"
#include "device.h"
#include "server.h"
@@ -123,6 +124,7 @@ static bool dev_is_sixaxis(const bdaddr_t *src, const bdaddr_t *dst)
{
struct btd_device *device;
uint16_t vid, pid;
+ CablePairingType type;
device = btd_adapter_find_device(adapter_find(src), dst, BDADDR_BREDR);
if (!device)
@@ -131,18 +133,14 @@ static bool dev_is_sixaxis(const bdaddr_t *src, const bdaddr_t *dst)
vid = btd_device_get_vendor(device);
pid = btd_device_get_product(device);
- /* DualShock 3 */
- if (vid == 0x054c && pid == 0x0268)
+ type = get_pairing_type(vid, pid, NULL, NULL, NULL);
+ if (type == CABLE_PAIRING_SIXAXIS)
return true;
/* DualShock 4 */
if (vid == 0x054c && pid == 0x05c4)
return true;
- /* Navigation Controller */
- if (vid == 0x054c && pid == 0x042f)
- return true;
-
return false;
}
--
2.14.1