[RFC PATCH] HID: support the NACON / BigBen PS4 / PC Compact controller

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



---

I have recently come into possession of a NACON / Big Ben Interactive
USB wired PC Compact controller (USB vendor:device 146b:0603).
This is advertised as an «officially licensed PS4™ wired controller»
that «also boasts full compatibility with PC games».

It is supposed to be similar to a DualShock 4 controller except for the
lack of built-in speaker, light bar and “SIXAXIS” motion sensor.
In particular, in addition to the typical gamepad goodies, it has a
built-in touchpad and an audio jack.

As things are currently, the Linux kernel automatically matches it with
the xpad driver, that detects this as a “Generic X-Box controller”.
This kind of works, but in addition to minor issues such as the default
axis mapping being wrong (which could be fixed in the xpad driver),
the major downside for the xpad driver binding to the controller
is that it fails to expose the touchpad and the audio jack.

My hope was to let the xpad driver skip this device, and to manage it
through the hid subsystem, expecting the hid-sony and/or hid-playstation
drivers to be able to manage it.

However, I obviously don't understand enough about how the hid driver
manages the bindings, and so far I've been at a loss about making this
work. The hack to ignore the device in xpad works, although it's a
horrible hack that probably shouldn't be needed in the first place,
but the HID subsystem doesn't seem to pick up the device.
This patch is my very poor (and currently NOT WORKING) attempt,
and since I'm obviously going at this all wrong, I'd be glad for
any recommendations on how to approach this.

Cheers,

Giuseppe Bilotta


 drivers/hid/hid-ids.h         | 1 +
 drivers/hid/hid-playstation.c | 5 ++++-
 drivers/hid/hid-quirks.c      | 1 +
 drivers/hid/hid-sony.c        | 3 +++
 drivers/input/joystick/xpad.c | 5 +++++
 5 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 82713ef3aaa6..78d993415071 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -250,6 +250,7 @@
 #define USB_VENDOR_ID_BETOP_2185V2BFM	0x20bc
 
 #define USB_VENDOR_ID_BIGBEN	0x146b
+#define USB_DEVICE_ID_BIGBEN_PC_COMPACT_CONTROLLER	0x0603
 #define USB_DEVICE_ID_BIGBEN_PS3OFMINIPAD	0x0902
 
 #define USB_VENDOR_ID_BTC		0x046e
diff --git a/drivers/hid/hid-playstation.c b/drivers/hid/hid-playstation.c
index f399bf0d3c8c..8302394479bd 100644
--- a/drivers/hid/hid-playstation.c
+++ b/drivers/hid/hid-playstation.c
@@ -2589,7 +2589,8 @@ static int ps_probe(struct hid_device *hdev, const struct hid_device_id *id)
 		goto err_stop;
 	}
 
-	if (hdev->product == USB_DEVICE_ID_SONY_PS4_CONTROLLER ||
+	if (hdev->product == USB_DEVICE_ID_BIGBEN_PC_COMPACT_CONTROLLER ||
+		hdev->product == USB_DEVICE_ID_SONY_PS4_CONTROLLER ||
 		hdev->product == USB_DEVICE_ID_SONY_PS4_CONTROLLER_2 ||
 		hdev->product == USB_DEVICE_ID_SONY_PS4_CONTROLLER_DONGLE) {
 		dev = dualshock4_create(hdev);
@@ -2632,6 +2633,8 @@ static void ps_remove(struct hid_device *hdev)
 }
 
 static const struct hid_device_id ps_devices[] = {
+	/* NACON / BigBen Interact Wired PC Compact controller */
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_BIGBEN, USB_DEVICE_ID_BIGBEN_PC_COMPACT_CONTROLLER) },
 	/* Sony DualShock 4 controllers for PS4 */
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER) },
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index 0e9702c7f7d6..fa9503257621 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -639,6 +639,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) },
 #endif
 #if IS_ENABLED(CONFIG_HID_SONY)
+	{ HID_USB_DEVICE(USB_VENDOR_ID_BIGBEN, USB_DEVICE_ID_BIGBEN_PC_COMPACT_CONTROLLER) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE) },
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_NSG_MR5U_REMOTE) },
diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c
index 13125997ab5e..4f5d5643dd19 100644
--- a/drivers/hid/hid-sony.c
+++ b/drivers/hid/hid-sony.c
@@ -3180,6 +3180,9 @@ static const struct hid_device_id sony_devices[] = {
 	/* SMK-Link PS3 BD Remote Control */
 	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE),
 		.driver_data = PS3REMOTE },
+	/* NACON / BigBen Interact Wired PC Compact controller */
+	{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_BIGBEN, USB_DEVICE_ID_BIGBEN_PC_COMPACT_CONTROLLER),
+		.driver_data = DUALSHOCK4_CONTROLLER_USB },
 	/* Sony Dualshock 4 controllers for PS4 */
 	{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER),
 		.driver_data = DUALSHOCK4_CONTROLLER_USB },
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 2959d80f7fdb..d3d3ce84bd6c 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -92,6 +92,7 @@
 #define XTYPE_XBOX360W    2
 #define XTYPE_XBOXONE     3
 #define XTYPE_UNKNOWN     4
+#define XTYPE_NOTXBOX     0xff
 
 /* Send power-off packet to xpad360w after holding the mode button for this many
  * seconds
@@ -281,6 +282,7 @@ static const struct xpad_device {
 	{ 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX },
 	{ 0x1430, 0xf801, "RedOctane Controller", 0, XTYPE_XBOX360 },
 	{ 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 },
+	{ 0x146b, 0x0603, "BigBen Interactive PC Compact Controller", 0, XTYPE_NOTXBOX },
 	{ 0x146b, 0x0604, "Bigben Interactive DAIJA Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOX360 },
 	{ 0x1532, 0x0037, "Razer Sabertooth", 0, XTYPE_XBOX360 },
 	{ 0x1532, 0x0a00, "Razer Atrox Arcade Stick", MAP_TRIGGERS_TO_BUTTONS, XTYPE_XBOXONE },
@@ -1951,6 +1953,9 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
 			break;
 	}
 
+	if (xpad_device[i].xtype == XTYPE_NOTXBOX)
+		return -ENODEV;
+
 	xpad = kzalloc(sizeof(struct usb_xpad), GFP_KERNEL);
 	if (!xpad)
 		return -ENOMEM;
-- 
2.39.0




[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux