Skip to contentSkip to conversation

HID: sony: Add nyko core controller support

PATCH Applied Scott Moreau 2 participants 3 messages Jan 13, 2016 – Jan 18, 2016 HID

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 HID: sony: Add nyko core controller support

This adds rumble and LED support for nyko core controllers using the sino lite chip vendor:1345 product:3008, for PS3.

Setting operational mode and output reports are the same as sixaxis but the input report has a different format since the PS3 accepts HID usb devices. For it to work, an exception is needed to skip overriding the report descriptor and use the original one.

---

For proper functionality, this patch depends on
http://article.gmane.org/gmane.linux.kernel.input/47590

 drivers/hid/hid-core.c | 1 +
 drivers/hid/hid-ids.h  | 3 +++
 drivers/hid/hid-sony.c | 7 +++++++
 3 files changed, 11 insertions(+)
drivers/hid/hid-core.c +1 -0
index c6f7a69..bcaf96e 100644
@@ -2008,6 +2008,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_SINO_LITE, USB_DEVICE_ID_SINO_LITE_CONTROLLER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_STEELSERIES, USB_DEVICE_ID_STEELSERIES_SRWS1) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_THINGM, USB_DEVICE_ID_BLINK1) },
drivers/hid/hid-ids.h +3 -0
index 8b78a7f..a6b2dee 100644
@@ -869,6 +869,9 @@
 #define USB_DEVICE_ID_SONY_BUZZ_CONTROLLER		0x0002
 #define USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER	0x1000
 
+#define USB_VENDOR_ID_SINO_LITE			0x1345
+#define USB_DEVICE_ID_SINO_LITE_CONTROLLER	0x3008
+
 #define USB_VENDOR_ID_SOUNDGRAPH	0x15c2
 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_FIRST	0x0034
 #define USB_DEVICE_ID_SOUNDGRAPH_IMON_LAST	0x0046
drivers/hid/hid-sony.c +7 -0
index 774cd22..ea13de0 100644
@@ -50,6 +50,7 @@
 #define MOTION_CONTROLLER_BT      BIT(8)
 #define NAVIGATION_CONTROLLER_USB BIT(9)
 #define NAVIGATION_CONTROLLER_BT  BIT(10)
+#define SINO_LITE_CONTROLLER      BIT(11)
 
 #define SIXAXIS_CONTROLLER (SIXAXIS_CONTROLLER_USB | SIXAXIS_CONTROLLER_BT)
 #define MOTION_CONTROLLER (MOTION_CONTROLLER_USB | MOTION_CONTROLLER_BT)
@@ -1116,6 +1117,9 @@ static __u8 *sony_report_fixup(struct hid_device *hdev, __u8 *rdesc,
 {
 	struct sony_sc *sc = hid_get_drvdata(hdev);
 
+	if (sc->quirks & SINO_LITE_CONTROLLER)
+		return rdesc;
+
 	/*
 	 * Some Sony RF receivers wrongly declare the mouse pointer as a
 	 * a constant non-data variable.
@@ -2458,6 +2462,9 @@ static const struct hid_device_id sony_devices[] = {
 		.driver_data = DUALSHOCK4_CONTROLLER_USB },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER),
 		.driver_data = DUALSHOCK4_CONTROLLER_BT },
+	/* Nyko Core Controller for PS3 */
+	{ HID_USB_DEVICE(USB_VENDOR_ID_SINO_LITE, USB_DEVICE_ID_SINO_LITE_CONTROLLER),
+		.driver_data = SIXAXIS_CONTROLLER_USB | SINO_LITE_CONTROLLER },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, sony_devices);
Signature · 1 line
2.5.0
#1 lore raw

PATCH 2/2 HID: sony: Fixup output reports for the nyko core controller

The nyko core controller uses the same output report format as the sixaxis controllers, but it expects the report id at offset 1.

This does not interfere with the official controllers as this byte is considered a padding byte by the current code.

---
 drivers/hid/hid-sony.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/hid-sony.c +1 -1
index ea13de0..fdd92a1 100644
@@ -1798,7 +1798,7 @@ static void sixaxis_state_worker(struct work_struct *work)
 	static const union sixaxis_output_report_01 default_report = {
 		.buf = {
 			0x01,
-			0x00, 0xff, 0x00, 0xff, 0x00,
+			0x01, 0xff, 0x00, 0xff, 0x00,
 			0x00, 0x00, 0x00, 0x00, 0x00,
 			0xff, 0x27, 0x10, 0x00, 0x32,
 			0xff, 0x27, 0x10, 0x00, 0x32,
Signature · 1 line
2.5.0
maintainer Applied
#2 lore raw
In reply to Scott Moreau
Quoted 10 lines · Scott Moreau

This adds rumble and LED support for nyko core controllers using the sino lite chip vendor:1345 product:3008, for PS3.

Setting operational mode and output reports are the same as sixaxis but the input report has a different format since the PS3 accepts HID usb devices. For it to work, an exception is needed to skip overriding the report descriptor and use the original one.

Applied both patches to for-4.6/sony.

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs