Skip to content

Commit 13e1ff9

Browse files
DanielOgorchockwebgeek1234
authored andcommitted
FROMLIST: HID: nintendo: add nintendo switch controller driver
The hid-nintendo driver supports the Nintendo Switch Pro Controllers and the Joy-Cons. The Pro Controllers can be used over USB or Bluetooth. The Joy-Cons each create their own, independent input devices, so it is up to userspace to combine them if desired. Signed-off-by: Daniel J. Ogorchock <[email protected]> Test: tested via custom test app Test: atest NintendoSwitchProTest Bug: 135136477 Link: https://patchwork.kernel.org/patch/11312547/ Link: https://lore.kernel.org/linux-input/[email protected]/ Change-Id: I179da1092faedc2ad25336224cf5ec8ff00e0d3f Signed-off-by: Siarhei Vishniakou <[email protected]>
1 parent f01abb7 commit 13e1ff9

File tree

6 files changed

+851
-0
lines changed

6 files changed

+851
-0
lines changed

MAINTAINERS

+6
Original file line numberDiff line numberDiff line change
@@ -8614,6 +8614,12 @@ S: Maintained
86148614
F: Documentation/scsi/NinjaSCSI.txt
86158615
F: drivers/scsi/nsp32*
86168616

8617+
NINTENDO HID DRIVER
8618+
M: Daniel J. Ogorchock <[email protected]>
8619+
8620+
S: Maintained
8621+
F: drivers/hid/hid-nintendo*
8622+
86178623
NIOS2 ARCHITECTURE
86188624
M: Ley Foon Tan <[email protected]>
86198625
L: [email protected] (moderated for non-subscribers)

drivers/hid/Kconfig

+11
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,17 @@ config HID_MULTITOUCH
573573
To compile this driver as a module, choose M here: the
574574
module will be called hid-multitouch.
575575

576+
config HID_NINTENDO
577+
tristate "Nintendo Joy-Con and Pro Controller support"
578+
depends on HID
579+
help
580+
Adds support for the Nintendo Switch Joy-Cons and Pro Controller.
581+
All controllers support bluetooth, and the Pro Controller also supports
582+
its USB mode.
583+
584+
To compile this driver as a module, choose M here: the
585+
module will be called hid-nintendo.
586+
576587
config HID_NTRIG
577588
tristate "N-Trig touch screen"
578589
depends on USB_HID

drivers/hid/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o
6161
obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
6262
obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o
6363
obj-$(CONFIG_HID_MULTITOUCH) += hid-multitouch.o
64+
obj-$(CONFIG_HID_NINTENDO) += hid-nintendo.o
6465
obj-$(CONFIG_HID_NTRIG) += hid-ntrig.o
6566
obj-$(CONFIG_HID_ORTEK) += hid-ortek.o
6667
obj-$(CONFIG_HID_PRODIKEYS) += hid-prodikeys.o

drivers/hid/hid-core.c

+10
Original file line numberDiff line numberDiff line change
@@ -2006,6 +2006,16 @@ static const struct hid_device_id hid_have_special_driver[] = {
20062006
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER) },
20072007
{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
20082008
{ HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) },
2009+
#if IS_ENABLED(CONFIG_HID_NINTENDO)
2010+
{ HID_USB_DEVICE(USB_VENDOR_ID_NINTENDO,
2011+
USB_DEVICE_ID_NINTENDO_PROCON) },
2012+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO,
2013+
USB_DEVICE_ID_NINTENDO_PROCON) },
2014+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO,
2015+
USB_DEVICE_ID_NINTENDO_JOYCONL) },
2016+
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO,
2017+
USB_DEVICE_ID_NINTENDO_JOYCONR) },
2018+
#endif
20092019
{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
20102020
{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_1) },
20112021
{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN_2) },

drivers/hid/hid-ids.h

+3
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,9 @@
784784
#define USB_VENDOR_ID_NINTENDO 0x057e
785785
#define USB_DEVICE_ID_NINTENDO_WIIMOTE 0x0306
786786
#define USB_DEVICE_ID_NINTENDO_WIIMOTE2 0x0330
787+
#define USB_DEVICE_ID_NINTENDO_JOYCONL 0x2006
788+
#define USB_DEVICE_ID_NINTENDO_JOYCONR 0x2007
789+
#define USB_DEVICE_ID_NINTENDO_PROCON 0x2009
787790

788791
#define USB_VENDOR_ID_NOVATEK 0x0603
789792
#define USB_DEVICE_ID_NOVATEK_PCT 0x0600

0 commit comments

Comments
 (0)