diff mbox

UBUNTU: SAUCE: Restore hid_get_raw_report in struct hid_device

Message ID 1409246914-5743-1-git-send-email-dualshock3nerd@gmail.com
State New
Headers show

Commit Message

Dualshock3Nerd Aug. 28, 2014, 5:28 p.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1326725

Module hid-sony failed to set usb operational mode for dualshock3/sixaxis
controller using hid_hw_raw_request.
Up to Linux 3.13 this driver requires hid_get_raw_report because it
needs special quirks to set it's operational mode.

Signed-off-by: Dualshock3Nerd <dualshock3nerd@gmail.com>
---
 drivers/hid/hid-sony.c        | 3 +--
 drivers/hid/i2c-hid/i2c-hid.c | 1 +
 drivers/hid/uhid.c            | 1 +
 drivers/hid/usbhid/hid-core.c | 1 +
 include/linux/hid.h           | 3 +++
 net/bluetooth/hidp/core.c     | 1 +
 6 files changed, 8 insertions(+), 2 deletions(-)

Comments

James Hughes Aug. 28, 2014, 11:45 p.m. UTC | #1
I¹ve run into what probably is the same issue when using Oculus' DK1 and
DK2. I¹ve tested and resolved the feature report issue by patching my
3.13.0-34 kernel with commit 975a68327 from mainline upstream. I believe
this upstream commit should probably resolve your issue as well.

James
Dualshock3Nerd Aug. 29, 2014, 1:06 p.m. UTC | #2
Thank you for pointing out mainline commit 975a68327.
I tested it for a while and I can confirm that applying that patch 
solves all of trusty's Sixaxis/Dualshock3 issues.
If it solves Oculus Rift's issues too I hope that the mainline patch is 
accepted.
Tim Gardner Aug. 29, 2014, 1:44 p.m. UTC | #3
On 08/29/2014 07:06 AM, Dualshock3Nerd wrote:
> Thank you for pointing out mainline commit 975a68327.
> I tested it for a while and I can confirm that applying that patch
> solves all of trusty's Sixaxis/Dualshock3 issues.
> If it solves Oculus Rift's issues too I hope that the mainline patch is
> accepted.
> 

Upstream commit 975a68327 (http://bugs.launchpad.net/bugs/1353021) is
already on master-next.
diff mbox

Patch

diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 5b86b77..098af2f8 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -432,8 +432,7 @@  static int sixaxis_set_operational_usb(struct hid_device *hdev)
 	if (!buf)
 		return -ENOMEM;
 
-	ret = hid_hw_raw_request(hdev, 0xf2, buf, 17, HID_FEATURE_REPORT,
-				 HID_REQ_GET_REPORT);
+	ret = hdev->hid_get_raw_report(hdev, 0xf2, buf, 17, HID_FEATURE_REPORT);
 
 	if (ret < 0)
 		hid_err(hdev, "can't set operational mode\n");
diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid.c
index bc7a77e..f977af0 100644
--- a/drivers/hid/i2c-hid/i2c-hid.c
+++ b/drivers/hid/i2c-hid/i2c-hid.c
@@ -1056,6 +1056,7 @@  static int i2c_hid_probe(struct i2c_client *client,
 
 	hid->driver_data = client;
 	hid->ll_driver = &i2c_hid_ll_driver;
+	hid->hid_get_raw_report = i2c_hid_get_raw_report;
 	hid->hid_output_raw_report = __i2c_hid_output_raw_report;
 	hid->dev.parent = &client->dev;
 	ACPI_COMPANION_SET(&hid->dev, ACPI_COMPANION(&client->dev));
diff --git a/drivers/hid/uhid.c b/drivers/hid/uhid.c
index b2b83be..cedc6da 100644
--- a/drivers/hid/uhid.c
+++ b/drivers/hid/uhid.c
@@ -377,6 +377,7 @@  static int uhid_dev_create(struct uhid_device *uhid,
 	hid->uniq[63] = 0;
 
 	hid->ll_driver = &uhid_hid_driver;
+	hid->hid_get_raw_report = uhid_hid_get_raw;
 	hid->hid_output_raw_report = uhid_hid_output_raw;
 	hid->bus = ev->u.create.bus;
 	hid->vendor = ev->u.create.vendor;
diff --git a/drivers/hid/usbhid/hid-core.c b/drivers/hid/usbhid/hid-core.c
index 8860329..44df131 100644
--- a/drivers/hid/usbhid/hid-core.c
+++ b/drivers/hid/usbhid/hid-core.c
@@ -1253,6 +1253,7 @@  static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
 
 	usb_set_intfdata(intf, hid);
 	hid->ll_driver = &usb_hid_driver;
+	hid->hid_get_raw_report = usbhid_get_raw_report;
 	hid->hid_output_raw_report = usbhid_output_raw_report;
 	hid->ff_init = hid_pidff_init;
 #ifdef CONFIG_USB_HIDDEV
diff --git a/include/linux/hid.h b/include/linux/hid.h
index 1653084..4373304 100644
--- a/include/linux/hid.h
+++ b/include/linux/hid.h
@@ -516,6 +516,9 @@  struct hid_device {							/* device report descriptor */
 				  struct hid_usage *, __s32);
 	void (*hiddev_report_event) (struct hid_device *, struct hid_report *);
 
+	/* handler for raw input (Get_Report) data, used by hidraw */
+	int (*hid_get_raw_report) (struct hid_device *, unsigned char, __u8 *, size_t, unsigned char);
+
 	/* handler for raw output data, used by hidraw */
 	int (*hid_output_raw_report) (struct hid_device *, __u8 *, size_t, unsigned char);
 
diff --git a/net/bluetooth/hidp/core.c b/net/bluetooth/hidp/core.c
index f41f637..d9fb934 100644
--- a/net/bluetooth/hidp/core.c
+++ b/net/bluetooth/hidp/core.c
@@ -787,6 +787,7 @@  static int hidp_setup_hid(struct hidp_session *session,
 	hid->dev.parent = &session->conn->hcon->dev;
 	hid->ll_driver = &hidp_hid_driver;
 
+	hid->hid_get_raw_report = hidp_get_raw_report;
 	hid->hid_output_raw_report = hidp_output_raw_report;
 
 	/* True if device is blacklisted in drivers/hid/hid-core.c */