Skip to contentSkip to conversation

HID: switch2: Add preliminary Switch 2 controller driver

PATCH Superseded Vicki Pfau 4 participants 8 messages Jan 9 – Feb 14

Subsystems (2)

v2 of 16 Superseded Latest is v16 →

lore
Share & tools
lore

Vicki Pfau

author
#0 lore raw

v2 cover HID: switch2: Add preliminary Switch 2 controller driver

This is effectively a resubmission of the previous patch with minor fixes for issues that came up during the first review. Bluetooth support is still not included, but this will hopefully provide a solid foundation for bringing up Bluetooth support once BlueZ is capable of bringing up the controller. This will probably require a new plugin, but investigation is still ongoing.

Vicki Pfau (1):
HID: switch2: Add preliminary Switch 2 controller driver

 MAINTAINERS                          |   7 +
 drivers/hid/Kconfig                  |  18 +
 drivers/hid/Makefile                 |   1 +
 drivers/hid/hid-ids.h                |   4 +
 drivers/hid/hid-switch2.c            | 975 +++++++++++++++++++++++++++
 drivers/hid/hid-switch2.h            | 242 +++++++
 drivers/input/joystick/Kconfig       |   8 +
 drivers/input/joystick/Makefile      |   1 +
 drivers/input/joystick/switch2-usb.c | 353 ++++++++++
 9 files changed, 1609 insertions(+)
 create mode 100644 drivers/hid/hid-switch2.c
 create mode 100644 drivers/hid/hid-switch2.h
 create mode 100644 drivers/input/joystick/switch2-usb.c
Signature · 1 line
2.51.2
author
#1 lore raw

PATCH v2 1/1 HID: switch2: Add preliminary Switch 2 controller driver

This adds a new driver for the Switch 2 controllers. The Switch 2 uses an unusual split-interface design such that input and rumble occur on the main HID interface, but all other communication occurs over a "configuration" interface. This is the case on both USB and Bluetooth, so this new driver uses a split-driver design with the HID interface being the "main" driver and the configuration interface is a secondary driver that looks up to the HID interface, sharing resources on a common struct.

Due to using a non-standard pairing interface as well as Bluetooth communications being extremely limited in the kernel, a custom interface between userspace and the kernel will need to be design, along with bringup in BlueZ. That is beyond the scope of this initial patch, which only contains the generic HID and USB configuration interface drivers.

This initial work supports general input for the Joy-Con 2, Pro Controller 2, and GameCube NSO controllers, as well as basic rumble support. IMU support is not yet present.

---
 MAINTAINERS                          |   7 +
 drivers/hid/Kconfig                  |  18 +
 drivers/hid/Makefile                 |   1 +
 drivers/hid/hid-ids.h                |   4 +
 drivers/hid/hid-switch2.c            | 975 +++++++++++++++++++++++++++
 drivers/hid/hid-switch2.h            | 242 +++++++
 drivers/input/joystick/Kconfig       |   8 +
 drivers/input/joystick/Makefile      |   1 +
 drivers/input/joystick/switch2-usb.c | 353 ++++++++++
 9 files changed, 1609 insertions(+)
 create mode 100644 drivers/hid/hid-switch2.c
 create mode 100644 drivers/hid/hid-switch2.h
 create mode 100644 drivers/input/joystick/switch2-usb.c
MAINTAINERS +7 -0
index a0dd762f5648..932e73d80bbb 100644
@@ -18541,6 +18541,13 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/hid/hid-nintendo*
 
+NINTENDO SWITCH 2 CONTROLLER DRIVER
+M:	Vicki Pfau <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/hid/hid-switch2*
+F:	drivers/input/joystick/switch2-usb.c
+
 NIOS2 ARCHITECTURE
 M:	Dinh Nguyen <[email protected]>
 S:	Maintained
drivers/hid/Kconfig +18 -0
index 920a64b66b25..32190cf830c4 100644
@@ -1142,6 +1142,24 @@ config HID_SUNPLUS
 	help
 	Support for Sunplus wireless desktop.
 
+config HID_SWITCH2
+	tristate "Nintendo Switch 2 controller support"
+	depends on HID
+	select USB_HID
+	help
+	Adds support for the Nintendo Switch 2 Controllers.
+
+	To compile this driver as a module, choose M here: the
+	module will be called hid-switch2.
+
+config SWITCH2_FF
+	bool "Nintendo Switch 2 force feedback support"
+	depends on HID_SWITCH2
+	select INPUT_FF_MEMLESS
+	help
+	Say Y here if you want to enable force feedback support for Nintendo
+	Switch 2 game controllers.
+
 config HID_RMI
 	tristate "Synaptics RMI4 device support"
 	select RMI4_CORE
drivers/hid/Makefile +1 -0
index 361a7daedeb8..74a3f82ed82f 100644
@@ -131,6 +131,7 @@ obj-$(CONFIG_HID_SPEEDLINK)	+= hid-speedlink.o
 obj-$(CONFIG_HID_STEAM)		+= hid-steam.o
 obj-$(CONFIG_HID_STEELSERIES)	+= hid-steelseries.o
 obj-$(CONFIG_HID_SUNPLUS)	+= hid-sunplus.o
+obj-$(CONFIG_HID_SWITCH2)	+= hid-switch2.o
 obj-$(CONFIG_HID_GREENASIA)	+= hid-gaff.o
 obj-$(CONFIG_HID_THRUSTMASTER)	+= hid-tmff.o hid-thrustmaster.o
 obj-$(CONFIG_HID_TIVO)		+= hid-tivo.o
drivers/hid/hid-ids.h +4 -0
index 9c2bf584d9f6..595f94543d85 100644
@@ -1061,6 +1061,10 @@
 #define USB_DEVICE_ID_NINTENDO_SNESCON	0x2017
 #define USB_DEVICE_ID_NINTENDO_GENCON	0x201e
 #define USB_DEVICE_ID_NINTENDO_N64CON	0x2019
+#define USB_DEVICE_ID_NINTENDO_NS2_JOYCONR	0x2066
+#define USB_DEVICE_ID_NINTENDO_NS2_JOYCONL	0x2067
+#define USB_DEVICE_ID_NINTENDO_NS2_PROCON	0x2069
+#define USB_DEVICE_ID_NINTENDO_NS2_GCCON	0x2073
 
 #define USB_VENDOR_ID_NOVATEK		0x0603
 #define USB_DEVICE_ID_NOVATEK_PCT	0x0600
drivers/hid/hid-switch2.c new file +975 -0

975 lines not on this page · raw message

drivers/hid/hid-switch2.h new file +242 -0

242 lines not on this page · raw message

drivers/input/joystick/Kconfig +8 -0
index 7755e5b454d2..73b0e15205ae 100644
@@ -422,4 +422,12 @@ config JOYSTICK_SEESAW
 	  To compile this driver as a module, choose M here: the module will be
 	  called adafruit-seesaw.
 
+config JOYSTICK_SWITCH2_USB
+	tristate "Wired Nintendo Switch 2 controller support"
+	depends on HID_SWITCH2
+	select USB
+	help
+	  To compile this driver as a module, choose M here: the
+	  module will be called switch2-usb.
+
 endif
drivers/input/joystick/Makefile +1 -0
index 9976f596a920..46feb7ef60ba 100644
@@ -34,6 +34,7 @@ obj-$(CONFIG_JOYSTICK_SIDEWINDER)	+= sidewinder.o
 obj-$(CONFIG_JOYSTICK_SPACEBALL)	+= spaceball.o
 obj-$(CONFIG_JOYSTICK_SPACEORB)		+= spaceorb.o
 obj-$(CONFIG_JOYSTICK_STINGER)		+= stinger.o
+obj-$(CONFIG_JOYSTICK_SWITCH2_USB)	+= switch2-usb.o
 obj-$(CONFIG_JOYSTICK_TMDC)		+= tmdc.o
 obj-$(CONFIG_JOYSTICK_TURBOGRAFX)	+= turbografx.o
 obj-$(CONFIG_JOYSTICK_TWIDJOY)		+= twidjoy.o
drivers/input/joystick/switch2-usb.c new file +353 -0

353 lines not on this page · raw message

Signature · 1 line
2.51.2
#2 lore raw

drivers/hid/hid-switch2.c line 120

Quoted 5 lines · Vicki Pfau
drivers/hid/hid-switch2.c new file +5 -0
+static const struct switch2_ctlr_button_mapping right_joycon_button_mappings[] = {
+	{ BTN_SOUTH,	0, NS2_BTNR_A,		},
+	{ BTN_EAST,	0, NS2_BTNR_B,		},
+	{ BTN_NORTH,	0, NS2_BTNR_X,		},
+	{ BTN_WEST,	0, NS2_BTNR_Y,		},

Wouldn't it make more sense for South to be B, and East to be A (and so on?)

--
Joshua Peisach

#3 lore raw
In reply to Vicki Pfau

Hey Dmitry! I'm sure you've got a lot on your plate, I just wanted to double check that you had this patch series on your radar since it's nearing 3 weeks (and V1 of this patch has been on the mailing list since early November with me being the only one responding to it).

Is there anything you need from Vicki still, is there a chance you might know when you can take a look at this, etc.?

Also, thank you for any help you can provide!

Quoted 28 lines · Vicki Pfau

This is effectively a resubmission of the previous patch with minor fixes
for issues that came up during the first review. Bluetooth support is still
not included, but this will hopefully provide a solid foundation for bringing up Bluetooth support once BlueZ is capable of bringing up the
controller. This will probably require a new plugin, but investigation is
still ongoing.

Vicki Pfau (1):
  HID: switch2: Add preliminary Switch 2 controller driver

 MAINTAINERS                          |   7 + drivers/hid/Kconfig                  |  18 + drivers/hid/Makefile                 |   1 + drivers/hid/hid-ids.h                |   4 + drivers/hid/hid-switch2.c            | 975
+++++++++++++++++++++++++++
 drivers/hid/hid-switch2.h            | 242 +++++++ drivers/input/joystick/Kconfig       |   8 + drivers/input/joystick/Makefile      |   1 + drivers/input/joystick/switch2-usb.c | 353 ++++++++++

 9 files changed, 1609 insertions(+)

 create mode 100644 drivers/hid/hid-switch2.c create mode 100644 drivers/hid/hid-switch2.h create mode 100644 drivers/input/joystick/switch2-usb.c

#4 lore raw

aaaaand whoops. Sorry! I had gotten asked for help getting attention on this but I realized I just poked the wrong subsystem maintainer - I am going for HID, not Input. You're off the hook Dmitry :P, sorry for the misunderstanding.

Bentiss/Jiri, any chance this patch is on your radar?

Quoted 41 lines · On Fri, 2026-01-30 at 17:09 -0500, [email protected] wrote:

Hey Dmitry! I'm sure you've got a lot on your plate, I just wanted to double check that you had this patch series on your radar since it's nearing 3 weeks (and V1 of this patch has been on the mailing list since early November with me being the only one responding to it).

Is there anything you need from Vicki still, is there a chance you might know when you can take a look at this, etc.?

Also, thank you for any help you can provide!

Quoted 30 lines · Vicki Pfau

This is effectively a resubmission of the previous patch with minor fixes
for issues that came up during the first review. Bluetooth support is
still
not included, but this will hopefully provide a solid foundation for
bringing up Bluetooth support once BlueZ is capable of bringing up the
controller. This will probably require a new plugin, but investigation is
still ongoing.

Vicki Pfau (1):
  HID: switch2: Add preliminary Switch 2 controller driver

 MAINTAINERS                          |   7 + drivers/hid/Kconfig                  |  18 + drivers/hid/Makefile                 |   1 + drivers/hid/hid-ids.h                |   4 + drivers/hid/hid-switch2.c            | 975
+++++++++++++++++++++++++++
 drivers/hid/hid-switch2.h            | 242 +++++++ drivers/input/joystick/Kconfig       |   8 + drivers/input/joystick/Makefile      |   1 + drivers/input/joystick/switch2-usb.c | 353 ++++++++++

 9 files changed, 1609 insertions(+)

 create mode 100644 drivers/hid/hid-switch2.c create mode 100644 drivers/hid/hid-switch2.h create mode 100644 drivers/input/joystick/switch2-usb.c

maintainer
#5 lore raw
Quoted 1 line · On Fri, 30 Jan 2026, [email protected] wrote:

Bentiss/Jiri, any chance this patch is on your radar?

I've reviewed the driver already, and I was sure I sent out an e-mail asking for a minor nit -- better naming of the driver (we usuall name drivers by vendors, not specific devices. But I can't find any traces of such e-mail, so I probably hallucinated it, sorry.

Vicki, is there any reason not to follow the standard naming, and either fold the whole thing into hid-nintendo, or built it separately under e.g. hid-nintendo-switch2.c (which might or not might be then linked into hid-nintendo proper)?

Thanks,

Signature · 2 lines
Jiri Kosina
SUSE Labs
author
#6 lore raw

Hi Jiri,

Quoted 9 lines · Jiri Kosina
Quoted 1 line · On Fri, 30 Jan 2026, [email protected] wrote:

Bentiss/Jiri, any chance this patch is on your radar?

I've reviewed the driver already, and I was sure I sent out an e-mail asking for a minor nit -- better naming of the driver (we usuall name drivers by vendors, not specific devices. But I can't find any traces of such e-mail, so I probably hallucinated it, sorry.

Quoted 4 lines

Vicki, is there any reason not to follow the standard naming, and either fold the whole thing into hid-nintendo, or built it separately under e.g. hid-nintendo-switch2.c (which might or not might be then linked into hid-nintendo proper)?

I was not aware of such a convention. There were plenty of drivers that seem to defy this, like hid-wiimote, so I figured I'd just name it something shorter. I didn't want to fold it directly into hid-nintendo since there's no real opportunity for shared code between the two of them, so it'd just mean (effectively) dead code getting loaded along with the rest of the module if you're only using a Switch 1 controller. That said, hid-playstation doesn't seem to care about this, so I can fold it into hid-nintendo if that's not a concern.

I also have a v3 that I was working on last week that flattens out the larger TODO that I had left over. It still needs testing, but otherwise it's done. I can rename the driver to hid-nintendo-switch2 or fold it into hid-nintendo for that one, whichever you'd prefer.

Quoted 3 lines

Thanks,

Thanks,
Vicki

maintainer
#7 lore raw
Quoted 3 lines · Vicki Pfau

I was not aware of such a convention. There were plenty of drivers that seem to defy this, like hid-wiimote, so I figured I'd just name it something shorter.

Yeah, unfortunately we haven't been really super-consistent with this over the past years, but I try not to get this completely out of hand.

Quoted 6 lines

I didn't want to fold it directly into hid-nintendo since there's no real opportunity for shared code between the two of them, so it'd just mean (effectively) dead code getting loaded along with the rest of the module if you're only using a Switch 1 controller. That said, hid-playstation doesn't seem to care about this, so I can fold it into hid-nintendo if that's not a concern.

As the amount of code (and even more so the resulting binary) is not super-huge, I don't think that's a concern. Most of the drivers for other all sorts of devices we have in the kernel are shared by many different device variations (think ethernet drivers), and it's ok.

Thanks a lot,

Signature · 2 lines
Jiri Kosina
SUSE Labs