linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
To: Linux Input ML <linux-input@vger.kernel.org>
Cc: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Jiri Kosina <jikos@kernel.org>,
	Roderick Colenbrander <roderick.colenbrander@sony.com>
Subject: [RFC PATCH] HID: support the NACON / BigBen PS4 / PC Compact controller
Date: Fri, 23 Dec 2022 18:21:30 +0100	[thread overview]
Message-ID: <20221223172130.938395-1-giuseppe.bilotta@gmail.com> (raw)

---

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


             reply	other threads:[~2022-12-23 17:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-12-23 17:21 Giuseppe Bilotta [this message]
2022-12-27 16:28 ` [RFC PATCH] HID: support the NACON / BigBen PS4 / PC Compact controller Roderick Colenbrander
2023-01-22 11:43   ` Giuseppe Bilotta
2023-01-24  0:46     ` Roderick Colenbrander

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=20221223172130.938395-1-giuseppe.bilotta@gmail.com \
    --to=giuseppe.bilotta@gmail.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=jikos@kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=roderick.colenbrander@sony.com \
    /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).