* [PATCH 1/3] eir: Add support for parsing DeviceID info
@ 2014-01-18 14:57 Szymon Janc
2014-01-18 14:57 ` [PATCH 2/3] adapter: Add support for setting DID info from EIR Szymon Janc
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Szymon Janc @ 2014-01-18 14:57 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
src/eir.c | 10 ++++++++++
src/eir.h | 4 ++++
2 files changed, 14 insertions(+)
diff --git a/src/eir.c b/src/eir.c
index 5f3f059..d85ac7e 100644
--- a/src/eir.c
+++ b/src/eir.c
@@ -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;
diff --git a/src/eir.h b/src/eir.h
index 888f382..3fa1cb3 100644
--- a/src/eir.h
+++ b/src/eir.h
@@ -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);
--
1.8.5.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/3] adapter: Add support for setting DID info from EIR
2014-01-18 14:57 [PATCH 1/3] eir: Add support for parsing DeviceID info Szymon Janc
@ 2014-01-18 14:57 ` Szymon Janc
2014-01-18 14:57 ` [PATCH 3/3] input: Add DualShock 4 detection Szymon Janc
2014-01-18 19:09 ` [PATCH 1/3] eir: Add support for parsing DeviceID info Johan Hedberg
2 siblings, 0 replies; 7+ messages in thread
From: Szymon Janc @ 2014-01-18 14:57 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Szymon Janc
---
src/adapter.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/adapter.c b/src/adapter.c
index 230f3ce..c117508 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -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);
--
1.8.5.3
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/3] input: Add DualShock 4 detection
2014-01-18 14:57 [PATCH 1/3] eir: Add support for parsing DeviceID info Szymon Janc
2014-01-18 14:57 ` [PATCH 2/3] adapter: Add support for setting DID info from EIR Szymon Janc
@ 2014-01-18 14:57 ` Szymon Janc
2014-01-18 15:05 ` David Herrmann
2014-01-18 19:09 ` [PATCH 1/3] eir: Add support for parsing DeviceID info Johan Hedberg
2 siblings, 1 reply; 7+ messages in thread
From: Szymon Janc @ 2014-01-18 14:57 UTC (permalink / raw)
To: linux-bluetooth; +Cc: 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(-)
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
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] input: Add DualShock 4 detection
2014-01-18 14:57 ` [PATCH 3/3] input: Add DualShock 4 detection Szymon Janc
@ 2014-01-18 15:05 ` David Herrmann
2014-01-18 15:13 ` Szymon Janc
0 siblings, 1 reply; 7+ messages in thread
From: David Herrmann @ 2014-01-18 15:05 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth@vger.kernel.org, Simon Wood, Frank Praznik
Hi
@Simon and Frank:
This patch might help fix your DS4 issues.
Cheers
David
On Sat, Jan 18, 2014 at 3:57 PM, Szymon Janc <szymon.janc@gmail.com> wrote:
> 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@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] input: Add DualShock 4 detection
2014-01-18 15:05 ` David Herrmann
@ 2014-01-18 15:13 ` Szymon Janc
2014-01-20 4:37 ` Frank Praznik
0 siblings, 1 reply; 7+ messages in thread
From: Szymon Janc @ 2014-01-18 15:13 UTC (permalink / raw)
To: David Herrmann; +Cc: linux-bluetooth@vger.kernel.org, Simon Wood, Frank Praznik
Hi,
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.
>
> On Sat, Jan 18, 2014 at 3:57 PM, Szymon Janc <szymon.janc@gmail.com> wrote:
> > 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@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
--
Szymon K. Janc
szymon.janc@gmail.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/3] eir: Add support for parsing DeviceID info
2014-01-18 14:57 [PATCH 1/3] eir: Add support for parsing DeviceID info Szymon Janc
2014-01-18 14:57 ` [PATCH 2/3] adapter: Add support for setting DID info from EIR Szymon Janc
2014-01-18 14:57 ` [PATCH 3/3] input: Add DualShock 4 detection Szymon Janc
@ 2014-01-18 19:09 ` Johan Hedberg
2 siblings, 0 replies; 7+ messages in thread
From: Johan Hedberg @ 2014-01-18 19:09 UTC (permalink / raw)
To: Szymon Janc; +Cc: linux-bluetooth
Hi Szymon,
On Sat, Jan 18, 2014, Szymon Janc wrote:
> ---
> src/eir.c | 10 ++++++++++
> src/eir.h | 4 ++++
> 2 files changed, 14 insertions(+)
All three patches have been applied. Thanks.
Johan
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/3] input: Add DualShock 4 detection
2014-01-18 15:13 ` Szymon Janc
@ 2014-01-20 4:37 ` Frank Praznik
0 siblings, 0 replies; 7+ messages in thread
From: Frank Praznik @ 2014-01-20 4:37 UTC (permalink / raw)
To: Szymon Janc, David Herrmann
Cc: linux-bluetooth@vger.kernel.org, Simon Wood, Frank Praznik
On 1/18/2014 10:13, Szymon Janc wrote:
> Hi,
>
> 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.
>
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.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2014-01-20 4:37 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-18 14:57 [PATCH 1/3] eir: Add support for parsing DeviceID info Szymon Janc
2014-01-18 14:57 ` [PATCH 2/3] adapter: Add support for setting DID info from EIR Szymon Janc
2014-01-18 14:57 ` [PATCH 3/3] input: Add DualShock 4 detection Szymon Janc
2014-01-18 15:05 ` David Herrmann
2014-01-18 15:13 ` Szymon Janc
2014-01-20 4:37 ` Frank Praznik
2014-01-18 19:09 ` [PATCH 1/3] eir: Add support for parsing DeviceID info Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).