All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Bluetooth: hidp: sixaxis dualshock report via ctrl quirk
@ 2018-03-28  3:45 Arnaud Rebillout
  2018-03-28  8:21 ` Bastien Nocera
  2018-03-28  9:30 ` Marcel Holtmann
  0 siblings, 2 replies; 4+ messages in thread
From: Arnaud Rebillout @ 2018-03-28  3:45 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: arnaud.rebillout, marcel, johan.hedberg, vivek

From: vivek <vivek@collabora.com>

The Sixaxis and Dualshock 4 wants report sent via the ctrl channel.

This patch has been used in the SteamOS kernel for a while now.
<https://github.com/ValveSoftware/steamos_kernel/commit/6e215b67a13c85d0cf5a9e0970acd9df7d2b77bd>

Signed-off-by: Vivek Das Mohapatra <vivek@collabora.com>
Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
---
 net/bluetooth/hidp/core.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index 1036e4fa1ea2..fa75da91a559 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -379,9 +379,16 @@ static int hidp_output_report(struct hid_device *hid, __u8 *data, size_t count)
 {
 	struct hidp_session *session = hid->driver_data;
 
-	return hidp_send_intr_message(session,
-				      HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT,
-				      data, count);
+	/* The Sixaxis and Dualshock 4 wants report sent via the ctrl channel */
+	if (hid->vendor == 0x54c && (hid->product == 0x5c4 || hid->product == 0x268)) {
+		return hidp_send_ctrl_message(session,
+					      HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_OUPUT,
+					      data, count);
+	} else {
+		return hidp_send_intr_message(session,
+					      HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT,
+					      data, count);
+	}
 }
 
 static int hidp_raw_request(struct hid_device *hid, unsigned char reportnum,
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Bluetooth: hidp: sixaxis dualshock report via ctrl quirk
  2018-03-28  3:45 [PATCH] Bluetooth: hidp: sixaxis dualshock report via ctrl quirk Arnaud Rebillout
@ 2018-03-28  8:21 ` Bastien Nocera
  2018-03-28  9:30 ` Marcel Holtmann
  1 sibling, 0 replies; 4+ messages in thread
From: Bastien Nocera @ 2018-03-28  8:21 UTC (permalink / raw)
  To: Arnaud Rebillout, linux-bluetooth; +Cc: marcel, johan.hedberg, vivek

On Wed, 2018-03-28 at 10:45 +0700, Arnaud Rebillout wrote:
> From: vivek <vivek@collabora.com>
> 
> The Sixaxis and Dualshock 4 wants report sent via the ctrl channel.
> 
> This patch has been used in the SteamOS kernel for a while now.
> <https://github.com/ValveSoftware/steamos_kernel/commit/6e215b67a13c8
> 5d0cf5a9e0970acd9df7d2b77bd>

Given that both types of devices already work via Bluetooth, what is
this supposed to fix? The commit message will need work.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Bluetooth: hidp: sixaxis dualshock report via ctrl quirk
  2018-03-28  3:45 [PATCH] Bluetooth: hidp: sixaxis dualshock report via ctrl quirk Arnaud Rebillout
  2018-03-28  8:21 ` Bastien Nocera
@ 2018-03-28  9:30 ` Marcel Holtmann
  2018-03-30  7:46   ` Arnaud Rebillout
  1 sibling, 1 reply; 4+ messages in thread
From: Marcel Holtmann @ 2018-03-28  9:30 UTC (permalink / raw)
  To: Arnaud Rebillout; +Cc: Bluez mailing list, Johan Hedberg, vivek

Hi Arnaud,

> The Sixaxis and Dualshock 4 wants report sent via the ctrl channel.
> 
> This patch has been used in the SteamOS kernel for a while now.
> <https://github.com/ValveSoftware/steamos_kernel/commit/6e215b67a13c85d0cf5a9e0970acd9df7d2b77bd>
> 
> Signed-off-by: Vivek Das Mohapatra <vivek@collabora.com>
> Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
> ---
> net/bluetooth/hidp/core.c | 13 ++++++++++---
> 1 file changed, 10 insertions(+), 3 deletions(-)
> 
> diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
> index 1036e4fa1ea2..fa75da91a559 100644
> --- a/net/bluetooth/hidp/core.c
> +++ b/net/bluetooth/hidp/core.c
> @@ -379,9 +379,16 @@ static int hidp_output_report(struct hid_device *hid, __u8 *data, size_t count)
> {
> 	struct hidp_session *session = hid->driver_data;
> 
> -	return hidp_send_intr_message(session,
> -				      HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT,
> -				      data, count);
> +	/* The Sixaxis and Dualshock 4 wants report sent via the ctrl channel */
> +	if (hid->vendor == 0x54c && (hid->product == 0x5c4 || hid->product == 0x268)) {
> +		return hidp_send_ctrl_message(session,
> +					      HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_OUPUT,
> +					      data, count);
> +	} else {
> +		return hidp_send_intr_message(session,
> +					      HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT,
> +					      data, count);
> +	}
> }

see the comment from Bastien, the HIDP layer is just a transport layer and should really not need to know about device specific quirks. Seems these quirks could be easily handled one layer about where the right channel is selected.

Regards

Marcel


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Bluetooth: hidp: sixaxis dualshock report via ctrl quirk
  2018-03-28  9:30 ` Marcel Holtmann
@ 2018-03-30  7:46   ` Arnaud Rebillout
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaud Rebillout @ 2018-03-30  7:46 UTC (permalink / raw)
  To: Marcel Holtmann; +Cc: Bluez mailing list, Johan Hedberg, vivek

Hi Marcel,

On 03/28/2018 04:30 PM, Marcel Holtmann wrote:
> Hi Arnaud,
>
>> The Sixaxis and Dualshock 4 wants report sent via the ctrl channel.
>>
>> This patch has been used in the SteamOS kernel for a while now.
>> <https://github.com/ValveSoftware/steamos_kernel/commit/6e215b67a13c85d0cf5a9e0970acd9df7d2b77bd>
>>
>> Signed-off-by: Vivek Das Mohapatra <vivek@collabora.com>
>> Signed-off-by: Arnaud Rebillout <arnaud.rebillout@collabora.com>
>> ---
>> net/bluetooth/hidp/core.c | 13 ++++++++++---
>> 1 file changed, 10 insertions(+), 3 deletions(-)
>>
>> diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
>> index 1036e4fa1ea2..fa75da91a559 100644
>> --- a/net/bluetooth/hidp/core.c
>> +++ b/net/bluetooth/hidp/core.c
>> @@ -379,9 +379,16 @@ static int hidp_output_report(struct hid_device *hid, __u8 *data, size_t count)
>> {
>> 	struct hidp_session *session = hid->driver_data;
>>
>> -	return hidp_send_intr_message(session,
>> -				      HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT,
>> -				      data, count);
>> +	/* The Sixaxis and Dualshock 4 wants report sent via the ctrl channel */
>> +	if (hid->vendor == 0x54c && (hid->product == 0x5c4 || hid->product == 0x268)) {
>> +		return hidp_send_ctrl_message(session,
>> +					      HIDP_TRANS_SET_REPORT | HIDP_DATA_RTYPE_OUPUT,
>> +					      data, count);
>> +	} else {
>> +		return hidp_send_intr_message(session,
>> +					      HIDP_TRANS_DATA | HIDP_DATA_RTYPE_OUPUT,
>> +					      data, count);
>> +	}
>> }
> see the comment from Bastien, the HIDP layer is just a transport layer and should really not need to know about device specific quirks. Seems these quirks could be easily handled one layer about where the right channel is selected.

I noticed indeed that the fix for the Sixaxis is already present in
`drivers/hid/hid-sony.c`. I'm not sure about the Dualshock 4, but I will
investigate further. If there's anything to fix I will patch `hid-sony.c`.

Thanks for the feedback, and sorry for the noise :)

  Arnaud

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-03-30  7:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-28  3:45 [PATCH] Bluetooth: hidp: sixaxis dualshock report via ctrl quirk Arnaud Rebillout
2018-03-28  8:21 ` Bastien Nocera
2018-03-28  9:30 ` Marcel Holtmann
2018-03-30  7:46   ` Arnaud Rebillout

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.