linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] HID: add support for 0079:1846 Mayflash/Dragonrise USB Gamecube Adapter
@ 2020-11-17  8:48 Wladimir J. van der Laan
  2020-11-25 13:32 ` Jiri Kosina
  0 siblings, 1 reply; 5+ messages in thread
From: Wladimir J. van der Laan @ 2020-11-17  8:48 UTC (permalink / raw)
  To: linux-input
  Cc: jikos, benjamin.tissoires, Ethan Warth, Wladimir J . van der Laan

From: Ethan Warth <redyoshi49q@gmail.com>

Mayflash/Dragonrise seems to have yet another device ID for one of their
Gamecube controller adapters.  Previous to this commit, the adapter
registered only one /dev/input/js* device, and all controller inputs (from
any controller) were mapped to this device.  This patch defines the 1846
USB device ID and enables the HID_QUIRK_MULTI_INPUT quirk for it, which
fixes that (with the patch, four /dev/input/js* devices are created, one
for each of the four controller ports).

Signed-off-by: Ethan Warth <redyoshi49q@gmail.com>
Tested-by: Wladimir J. van der Laan <laanwj@gmail.com>
---
 drivers/hid/hid-ids.h    | 1 +
 drivers/hid/hid-mf.c     | 2 ++
 drivers/hid/hid-quirks.c | 2 ++
 3 files changed, 5 insertions(+)

This patch is not my work but a direct repost of
https://lore.kernel.org/lkml/CAAPc1Th4mgE=ntLY=NXn2Jbfgi0OBpZ5R2sYGhWJ_4+syuPA9w@mail.gmail.com/T/.

The original patch was not merged due to a line break issue. I have corrected this.

I have tested it against current master as well as ubuntu focal's 5.4.0,
and it works, it separates the adapter into four different evdev devices,
making it usable in Linux. It also enables rumble (which I have not tested due to lack
of a capable controller).

[   67.150155] usb 2-1: new full-speed USB device number 2 using xhci_hcd
[   67.325014] usb 2-1: New USB device found, idVendor=0079, idProduct=1846, bcdDevice= 1.00
[   67.325020] usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   67.325024] usb 2-1: Product: GameCube Controller Adapter
[   67.325026] usb 2-1: Manufacturer: Nintendo
[   67.367729] input: Nintendo GameCube Controller Adapter as /devices/pci0000:00/0000:00:10.0/usb2/2-1/2-1:1.0/0003:0079:1846.0004/input/input21
[   67.367906] input: Nintendo GameCube Controller Adapter as /devices/pci0000:00/0000:00:10.0/usb2/2-1/2-1:1.0/0003:0079:1846.0004/input/input22
[   67.367992] input: Nintendo GameCube Controller Adapter as /devices/pci0000:00/0000:00:10.0/usb2/2-1/2-1:1.0/0003:0079:1846.0004/input/input23
[   67.368066] input: Nintendo GameCube Controller Adapter as /devices/pci0000:00/0000:00:10.0/usb2/2-1/2-1:1.0/0003:0079:1846.0004/input/input24
[   67.368143] hid_mf 0003:0079:1846.0004: input,hidraw3: USB HID v1.10 Joystick [Nintendo GameCube Controller Adapter] on usb-0000:00:10.0-1/input0
[   67.368155] hid_mf 0003:0079:1846.0004: Force feedback for HJZ Mayflash game controller adapters by Marcel Hasler <mahasler@gmail.com>

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index d69842f79fc665c53243331c3efc9e458233ca65..9132f007fee468099fa08446b7092e0be8ab64f6 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -357,6 +357,7 @@
 #define USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR	0x1803
 #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE1	0x1843
 #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE2	0x1844
+#define USB_DEVICE_ID_DRAGONRISE_GAMECUBE3	0x1846
 
 #define USB_VENDOR_ID_DWAV		0x0eef
 #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER	0x0001
diff --git a/drivers/hid/hid-mf.c b/drivers/hid/hid-mf.c
index fc75f30f537c95dbc7a4c19581c6953ef76e40a8..92d7ecd41a78fb94910f044daf4bfb91594f93d3 100644
--- a/drivers/hid/hid-mf.c
+++ b/drivers/hid/hid-mf.c
@@ -153,6 +153,8 @@ static const struct hid_device_id mf_devices[] = {
 		.driver_data = HID_QUIRK_MULTI_INPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE2),
 		.driver_data = 0 }, /* No quirk required */
+	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE3),
+		.driver_data = HID_QUIRK_MULTI_INPUT },
 	{ }
 };
 MODULE_DEVICE_TABLE(hid, mf_devices);
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index 7a2be0205dfd12a81a82e963893ca664512bb526..e67134a4c3dec7533a9fecefb293a8a624bf28de 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -72,6 +72,7 @@ static const struct hid_device_id hid_quirks[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_REDRAGON_SEYMUR2), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR), HID_QUIRK_MULTI_INPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1), HID_QUIRK_MULTI_INPUT },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE3), HID_QUIRK_MULTI_INPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3), HID_QUIRK_MULTI_INPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU), HID_QUIRK_MULTI_INPUT },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER), HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET },
@@ -479,6 +480,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1) },
 	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE2) },
+	{ HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE3) },
 #endif
 #if IS_ENABLED(CONFIG_HID_MICROSOFT)
 	{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) },
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] HID: add support for 0079:1846 Mayflash/Dragonrise USB Gamecube Adapter
  2020-11-17  8:48 [PATCH] HID: add support for 0079:1846 Mayflash/Dragonrise USB Gamecube Adapter Wladimir J. van der Laan
@ 2020-11-25 13:32 ` Jiri Kosina
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Kosina @ 2020-11-25 13:32 UTC (permalink / raw)
  To: Wladimir J. van der Laan; +Cc: linux-input, benjamin.tissoires, Ethan Warth

On Tue, 17 Nov 2020, Wladimir J. van der Laan wrote:

> From: Ethan Warth <redyoshi49q@gmail.com>
> 
> Mayflash/Dragonrise seems to have yet another device ID for one of their
> Gamecube controller adapters.  Previous to this commit, the adapter
> registered only one /dev/input/js* device, and all controller inputs (from
> any controller) were mapped to this device.  This patch defines the 1846
> USB device ID and enables the HID_QUIRK_MULTI_INPUT quirk for it, which
> fixes that (with the patch, four /dev/input/js* devices are created, one
> for each of the four controller ports).
> 
> Signed-off-by: Ethan Warth <redyoshi49q@gmail.com>
> Tested-by: Wladimir J. van der Laan <laanwj@gmail.com>

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] HID: add support for 0079:1846 Mayflash/Dragonrise USB Gamecube Adapter
  2019-09-06  6:11 Ethan Warth
@ 2019-10-01 14:17 ` Jiri Kosina
  2019-10-01 14:17   ` Jiri Kosina
  0 siblings, 1 reply; 5+ messages in thread
From: Jiri Kosina @ 2019-10-01 14:17 UTC (permalink / raw)
  To: Ethan Warth; +Cc: linux-input, linux-kernel, benjamin.tissoires

On Fri, 6 Sep 2019, Ethan Warth wrote:

> >From 32bdfb1d652cc38ab13f8616df58dee726201785 Mon Sep 17 00:00:00 2001
> From: Ethan Warth <redyoshi49q@gmail.com>
> Date: Wed, 4 Sep 2019 16:07:45 -0500
> Subject: [PATCH] HID: add support for 0079:1846 Mayflash/Dragonrise USB Gamecube
>  Adapter
> 
> Mayflash/Dragonrise seems to have yet another device ID for one of their
> Gamecube controller adapters.  Previous to this commit, the adapter
> registered only one /dev/input/js* device, and all controller inputs (from
> any controller) were mapped to this device.  This patch defines the 1846
> USB device ID and enables the HID_QUIRK_MULTI_INPUT quirk for it, which
> fixes that (with the patch, four /dev/input/js* devices are created, one
> for each of the four controller ports).
> ---
>  drivers/hid/hid-ids.h    | 1 +
>  drivers/hid/hid-mf.c     | 2 ++
>  drivers/hid/hid-quirks.c | 2 ++
>  3 files changed, 5 insertions(+)
> 
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index 0a00be19f7a0..9cd909985a4c 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -362,6 +362,7 @@
>  #define USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR    0x1803
>  #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE1    0x1843
>  #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE2    0x1844
> +#define USB_DEVICE_ID_DRAGONRISE_GAMECUBE3    0x1846
> 
>  #define USB_VENDOR_ID_DWAV        0x0eef
>  #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER    0x0001
> diff --git a/drivers/hid/hid-mf.c b/drivers/hid/hid-mf.c
> index fc75f30f537c..92d7ecd41a78 100644
> --- a/drivers/hid/hid-mf.c
> +++ b/drivers/hid/hid-mf.c
> @@ -153,6 +153,8 @@ static const struct hid_device_id mf_devices[] = {
>          .driver_data = HID_QUIRK_MULTI_INPUT },
>      { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
> USB_DEVICE_ID_DRAGONRISE_GAMECUBE2),
>          .driver_data = 0 }, /* No quirk required */
> +    { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
> USB_DEVICE_ID_DRAGONRISE_GAMECUBE3),

Thanks a lot for the fix; however your mail client seems to have damaged 
it badly with respect to whitespace and line-wrapping. Could you please 
fix that up and resend?

Thanks,

-- 
Jiri Kosina
SUSE Labs

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] HID: add support for 0079:1846 Mayflash/Dragonrise USB Gamecube Adapter
  2019-10-01 14:17 ` Jiri Kosina
@ 2019-10-01 14:17   ` Jiri Kosina
  0 siblings, 0 replies; 5+ messages in thread
From: Jiri Kosina @ 2019-10-01 14:17 UTC (permalink / raw)
  To: Ethan Warth; +Cc: linux-input, linux-kernel, benjamin.tissoires

On Fri, 6 Sep 2019, Ethan Warth wrote:

> >From 32bdfb1d652cc38ab13f8616df58dee726201785 Mon Sep 17 00:00:00 2001
> From: Ethan Warth <redyoshi49q@gmail.com>
> Date: Wed, 4 Sep 2019 16:07:45 -0500
> Subject: [PATCH] HID: add support for 0079:1846 Mayflash/Dragonrise USB Gamecube
>  Adapter
> 
> Mayflash/Dragonrise seems to have yet another device ID for one of their
> Gamecube controller adapters.  Previous to this commit, the adapter
> registered only one /dev/input/js* device, and all controller inputs (from
> any controller) were mapped to this device.  This patch defines the 1846
> USB device ID and enables the HID_QUIRK_MULTI_INPUT quirk for it, which
> fixes that (with the patch, four /dev/input/js* devices are created, one
> for each of the four controller ports).
> ---
>  drivers/hid/hid-ids.h    | 1 +
>  drivers/hid/hid-mf.c     | 2 ++
>  drivers/hid/hid-quirks.c | 2 ++
>  3 files changed, 5 insertions(+)
> 
> diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
> index 0a00be19f7a0..9cd909985a4c 100644
> --- a/drivers/hid/hid-ids.h
> +++ b/drivers/hid/hid-ids.h
> @@ -362,6 +362,7 @@
>  #define USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR    0x1803
>  #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE1    0x1843
>  #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE2    0x1844
> +#define USB_DEVICE_ID_DRAGONRISE_GAMECUBE3    0x1846
> 
>  #define USB_VENDOR_ID_DWAV        0x0eef
>  #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER    0x0001
> diff --git a/drivers/hid/hid-mf.c b/drivers/hid/hid-mf.c
> index fc75f30f537c..92d7ecd41a78 100644
> --- a/drivers/hid/hid-mf.c
> +++ b/drivers/hid/hid-mf.c
> @@ -153,6 +153,8 @@ static const struct hid_device_id mf_devices[] = {
>          .driver_data = HID_QUIRK_MULTI_INPUT },
>      { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
> USB_DEVICE_ID_DRAGONRISE_GAMECUBE2),
>          .driver_data = 0 }, /* No quirk required */
> +    { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
> USB_DEVICE_ID_DRAGONRISE_GAMECUBE3),

Thanks a lot for the fix; however your mail client seems to have damaged 
it badly with respect to whitespace and line-wrapping. Could you please 
fix that up and resend?

Thanks,

-- 
Jiri Kosina
SUSE Labs


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] HID: add support for 0079:1846 Mayflash/Dragonrise USB Gamecube Adapter
@ 2019-09-06  6:11 Ethan Warth
  2019-10-01 14:17 ` Jiri Kosina
  0 siblings, 1 reply; 5+ messages in thread
From: Ethan Warth @ 2019-09-06  6:11 UTC (permalink / raw)
  To: linux-input, linux-kernel, jikos, benjamin.tissoires

>From 32bdfb1d652cc38ab13f8616df58dee726201785 Mon Sep 17 00:00:00 2001
From: Ethan Warth <redyoshi49q@gmail.com>
Date: Wed, 4 Sep 2019 16:07:45 -0500
Subject: [PATCH] HID: add support for 0079:1846 Mayflash/Dragonrise USB Gamecube
 Adapter

Mayflash/Dragonrise seems to have yet another device ID for one of their
Gamecube controller adapters.  Previous to this commit, the adapter
registered only one /dev/input/js* device, and all controller inputs (from
any controller) were mapped to this device.  This patch defines the 1846
USB device ID and enables the HID_QUIRK_MULTI_INPUT quirk for it, which
fixes that (with the patch, four /dev/input/js* devices are created, one
for each of the four controller ports).
---
 drivers/hid/hid-ids.h    | 1 +
 drivers/hid/hid-mf.c     | 2 ++
 drivers/hid/hid-quirks.c | 2 ++
 3 files changed, 5 insertions(+)

diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 0a00be19f7a0..9cd909985a4c 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -362,6 +362,7 @@
 #define USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR    0x1803
 #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE1    0x1843
 #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE2    0x1844
+#define USB_DEVICE_ID_DRAGONRISE_GAMECUBE3    0x1846

 #define USB_VENDOR_ID_DWAV        0x0eef
 #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER    0x0001
diff --git a/drivers/hid/hid-mf.c b/drivers/hid/hid-mf.c
index fc75f30f537c..92d7ecd41a78 100644
--- a/drivers/hid/hid-mf.c
+++ b/drivers/hid/hid-mf.c
@@ -153,6 +153,8 @@ static const struct hid_device_id mf_devices[] = {
         .driver_data = HID_QUIRK_MULTI_INPUT },
     { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
USB_DEVICE_ID_DRAGONRISE_GAMECUBE2),
         .driver_data = 0 }, /* No quirk required */
+    { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
USB_DEVICE_ID_DRAGONRISE_GAMECUBE3),
+        .driver_data = HID_QUIRK_MULTI_INPUT },
     { }
 };
 MODULE_DEVICE_TABLE(hid, mf_devices);
diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c
index 166f41f3173b..a11f1abb029e 100644
--- a/drivers/hid/hid-quirks.c
+++ b/drivers/hid/hid-quirks.c
@@ -72,6 +72,7 @@ static const struct hid_device_id hid_quirks[] = {
     { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
USB_DEVICE_ID_REDRAGON_SEYMUR2),
HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE },
     { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR), HID_QUIRK_MULTI_INPUT },
     { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
USB_DEVICE_ID_DRAGONRISE_GAMECUBE1), HID_QUIRK_MULTI_INPUT },
+    { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
USB_DEVICE_ID_DRAGONRISE_GAMECUBE3), HID_QUIRK_MULTI_INPUT },
     { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
USB_DEVICE_ID_DRAGONRISE_PS3), HID_QUIRK_MULTI_INPUT },
     { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
USB_DEVICE_ID_DRAGONRISE_WIIU), HID_QUIRK_MULTI_INPUT },
     { HID_USB_DEVICE(USB_VENDOR_ID_DWAV,
USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER), HID_QUIRK_MULTI_INPUT |
HID_QUIRK_NOGET },
@@ -476,6 +477,7 @@ static const struct hid_device_id
hid_have_special_driver[] = {
     { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR) },
     { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
USB_DEVICE_ID_DRAGONRISE_GAMECUBE1) },
     { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
USB_DEVICE_ID_DRAGONRISE_GAMECUBE2) },
+    { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE,
USB_DEVICE_ID_DRAGONRISE_GAMECUBE3) },
 #endif
 #if IS_ENABLED(CONFIG_HID_MICROSOFT)
     { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT,
USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) },
-- 
2.17.1

Some lines added in the patch exceed the recommended line width; this is
so that the added lines can share a consistent format with other lines in
the adjacent code.

Signed-off-by: Ethan Warth <redyoshi49q@gmail.com>



Perfect normality is impossible.  Be unique!
   ―redyoshi49q

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-11-25 13:33 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-17  8:48 [PATCH] HID: add support for 0079:1846 Mayflash/Dragonrise USB Gamecube Adapter Wladimir J. van der Laan
2020-11-25 13:32 ` Jiri Kosina
  -- strict thread matches above, loose matches on Subject: below --
2019-09-06  6:11 Ethan Warth
2019-10-01 14:17 ` Jiri Kosina
2019-10-01 14:17   ` Jiri Kosina

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).