eir: Add support for parsing DeviceID info
PATCH 1/3 eir: Add support for parsing DeviceID info
--- src/eir.c | 10 ++++++++++ src/eir.h | 4 ++++ 2 files changed, 14 insertions(+)
src/eir.c +10 -0
@@ -223,6 +223,16 @@ void eir_parse(struct eir_data *eir, const uint8_t *eir_data, uint8_t eir_len)break ; eir->randomizer =g_memdup (data,16 );break ; + +case EIR_DEVICE_ID : +if (data_len <8 ) +break ; + + eir->did_source = data[0 ] | (data[1 ] <<8 ); + eir->did_vendor = data[2 ] | (data[3 ] <<8 ); + eir->did_product = data[4 ] | (data[5 ] <<8 ); + eir->did_version = data[6 ] | (data[7 ] <<8 ); +break ; } eir_data += field_len +1 ;
src/eir.h +4 -0
@@ -49,6 +49,10 @@ struct eir_data {uint8_t *hash;uint8_t *randomizer;bdaddr_t addr; +uint16_t did_vendor; +uint16_t did_product; +uint16_t did_version; +uint16_t did_source; };void eir_data_free (struct eir_data *eir);
Signature · 1 line
1.8.5.3
PATCH 2/3 adapter: Add support for setting DID info from EIR
--- src/adapter.c | 7 +++++++ 1 file changed, 7 insertions(+)
src/adapter.c +7 -0
@@ -4147,6 +4147,13 @@ static void update_found_devices(struct btd_adapter *adapter,if (eir_data.class !=0 )device_set_class (dev, eir_data.class); +if (eir_data.did_source || eir_data.did_vendor || + eir_data.did_product || eir_data.did_version) +btd_device_set_pnpid (dev, eir_data.did_source, + eir_data.did_vendor, + eir_data.did_product, + eir_data.did_version); +device_add_eir_uuids (dev, eir_data.services);eir_data_free (&eir_data);
Signature · 1 line
1.8.5.3
PATCH 3/3 input: Add DualShock 4 detection
In reply to Szymon JancDS4 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(-)
profiles/input/server.c +11 -5
@@ -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)
Signature · 1 line
1.8.5.3
Re: [PATCH 3/3] input: Add DualShock 4 detection
Hi
@Simon and Frank:
This patch might help fix your DS4 issues.
Cheers
David
Quoted 47 lines · Szymon Janc
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(-)profiles/input/server.c +11
-6@@ -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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] input: Add DualShock 4 detection
Hi,
Quoted 7 lines · On Saturday 18 January 2014 16:05:26 David Herrmann wrote:
Hi
@Simon and Frank:
This patch might help fix your DS4 issues.Cheers
David
Just for clarification, this does not add DS4 support, just detection for it in input server. There is some problem with getting SDP records from DS4 by bluetoothd (works with sdptool) which prevents idev from being created.
I'm working on fixing this, but no ETA yet.
Quoted 57 lines · Szymon Janc
Quoted 55 lines
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(-)profiles/input/server.c +0
-0@@ -118,18 +118,24 @@ static void sixaxis_browse_sdp(const bdaddr_t *src,const
bdaddr_t*dst,>
static booldev_is_sixaxis(const bdaddr_t *src, const bdaddr_t *dst){struct btd_device *device;profiles/input/server.c +11
-6+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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Signature · 2 lines
Szymon K. Janc [email protected]
Re: [PATCH 3/3] input: Add DualShock 4 detection
Quoted 8 lines · Szymon Janc
Hi,
Quoted 5 lines · On Saturday 18 January 2014 16:05:26 David Herrmann wrote:
Hi
@Simon and Frank:
This patch might help fix your DS4 issues.
Quoted 8 lines
Quoted 2 lines
Cheers
DavidJust for clarification, this does not add DS4 support, just detection for it in input server. There is some problem with getting SDP records from DS4 by bluetoothd (works with sdptool) which prevents idev from being created.
I'm working on fixing this, but no ETA yet.
With this and the IMTU patch I was able to get my controller paired. I played around with it and from watching the traffic in btmon, there are still two issues that are stopping full two way communications:
1. The Dualshock 4 sends communications to the host on PSM 19, but will only receive packets on PSM 17. Currently the bluetooth stack is trying to send data to the controller on PSM 19 so the data packets still aren't reaching the it.
2. The hidp layer always assigns a report type of 0xA2 (HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUTPUT) to every HIDP_OUTPUT_REPORT. The Dualshock 4 only accepts reports with type 0x52 (HIDP_TRANS_SEND_REPORT | HIDP_DATA_RTYPE_OUTPUT). I was able to work around this with a kludge in net/bluetooth/hidp/core.c to catch the Dualshock 4 packets and use the value that the controller wants, but I don't think anyone wants a device-specific hack in a core protocol file. Unfortunately, there seems to be no elegant way to work around this.
Hi Szymon,
Quoted 4 lines · Szymon Janc
--- src/eir.c | 10 ++++++++++ src/eir.h | 4 ++++ 2 files changed, 14 insertions(+)
All three patches have been applied. Thanks.
Johan