From: Frank Praznik <frank.praznik@oh.rr.com>
To: linux-input@vger.kernel.org
Cc: jkosina@suse.cz, dh.herrmann@gmail.com,
Frank Praznik <frank.praznik@oh.rr.com>
Subject: [PATCH v2 3/6] HID: sony: Add Bluetooth output report formatting
Date: Thu, 30 Jan 2014 12:24:05 -0500 [thread overview]
Message-ID: <1391102648-19381-4-git-send-email-frank.praznik@oh.rr.com> (raw)
In-Reply-To: <1391102648-19381-1-git-send-email-frank.praznik@oh.rr.com>
Add formatting and reporting for Dualshock 4 output reports on Bluetooth.
Signed-off-by: Frank Praznik <frank.praznik@oh.rr.com>
---
drivers/hid/hid-sony.c | 29 +++++++++++++++++++++++------
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 52162a9..4d12b4e 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -1268,11 +1268,18 @@ static void dualshock4_state_worker(struct work_struct *work)
struct hid_device *hdev = sc->hdev;
int offset;
- __u8 buf[32] = { 0 };
+ __u8 buf[78] = { 0 };
- buf[0] = 0x05;
- buf[1] = 0x03;
- offset = 4;
+ if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) {
+ buf[0] = 0x05;
+ buf[1] = 0x03;
+ offset = 4;
+ } else {
+ buf[0] = 0x11;
+ buf[1] = 0xB0;
+ buf[3] = 0x0F;
+ offset = 6;
+ }
#ifdef CONFIG_SONY_FF
buf[offset++] = sc->right;
@@ -1285,7 +1292,11 @@ static void dualshock4_state_worker(struct work_struct *work)
buf[offset++] = sc->led_state[1];
buf[offset++] = sc->led_state[2];
- hdev->ll_driver->output_report(hdev, buf, sizeof(buf));
+ if (sc->quirks & DUALSHOCK4_CONTROLLER_USB)
+ hdev->ll_driver->output_report(hdev, buf, 32);
+ else
+ hdev->ll_driver->raw_request(hdev, 0x11, buf, 78,
+ HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
}
#ifdef CONFIG_SONY_FF
@@ -1482,10 +1493,16 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
else if (sc->quirks & SIXAXIS_CONTROLLER_BT)
ret = sixaxis_set_operational_bt(hdev);
else if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) {
- if (hdev->ll_driver->output_report == NULL) {
+ if ((sc->quirks & DUALSHOCK4_CONTROLLER_USB) &&
+ hdev->ll_driver->output_report == NULL) {
hid_err(hdev, "NULL output_report handler\n");
ret = -EINVAL;
goto err_stop;
+ } else if ((sc->quirks & DUALSHOCK4_CONTROLLER_BT) &&
+ hdev->ll_driver->raw_request == NULL) {
+ hid_err(hdev, "NULL raw_request handler\n");
+ ret = -EINVAL;
+ goto err_stop;
}
/* The Dualshock 4 touchpad supports 2 touches and has a
--
1.8.5.3
next prev parent reply other threads:[~2014-01-30 17:24 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-30 17:24 [PATCH v2 0/6] HID: sony: Add full Dualshock 4 support in Bluetooth mode Frank Praznik
2014-01-30 17:24 ` [PATCH v2 1/6] HID: sony: Use low-level transport driver functions Frank Praznik
2014-02-03 16:26 ` David Herrmann
2014-01-30 17:24 ` [PATCH v2 2/6] HID: sony: Add modified Dualshock 4 Bluetooth HID descriptor Frank Praznik
2014-01-30 17:24 ` Frank Praznik [this message]
2014-02-03 16:29 ` [PATCH v2 3/6] HID: sony: Add Bluetooth output report formatting David Herrmann
2014-01-30 17:24 ` [PATCH v2 4/6] HID: sony: Add Dualshock 4 Bluetooth battery and touchpad parsing Frank Praznik
2014-01-30 17:24 ` [PATCH v2 5/6] HID: sony: Set initial battery level to 100% to avoid false low battery warnings Frank Praznik
2014-01-30 17:24 ` [PATCH v2 6/6] HID: sony: Add conditionals to enable all features in Bluetooth mode Frank Praznik
2014-02-03 16:31 ` David Herrmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1391102648-19381-4-git-send-email-frank.praznik@oh.rr.com \
--to=frank.praznik@oh.rr.com \
--cc=dh.herrmann@gmail.com \
--cc=jkosina@suse.cz \
--cc=linux-input@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).