Skip to content

Commit

Permalink
HID: nintendo: add rumble support
Browse files Browse the repository at this point in the history
This patch adds support for controller rumble.

The ff_effect weak magnitude is associated with the pro controller's
right motor (or with a right joy-con). The strong magnitude is
associated with the pro's left motor (or a left joy-con).

The rumble data is sent periodically (currently configured for every 50
milliseconds). If the controller receives no rumble data for too long a
time period, it will stop vibrating. The data is also sent every time
joycon_set_rumble is called to avoid latency of up to 50ms.

Because the rumble subcommands are sent in a deferred workqueue (they
can't be sent in the play_effect function due to the hid send sleeping),
the effects are queued. This ensures that no rumble effect is missed due
to them arriving in too quick of succession.

Signed-off-by: Daniel J. Ogorchock <djogorchock@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Daniel J. Ogorchock authored and Jiri Kosina committed Oct 27, 2021
1 parent 697e5c7 commit c4eae84
Show file tree
Hide file tree
Showing 2 changed files with 356 additions and 3 deletions.
10 changes: 10 additions & 0 deletions drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -745,6 +745,16 @@ config HID_NINTENDO
To compile this driver as a module, choose M here: the
module will be called hid-nintendo.

config NINTENDO_FF
bool "Nintendo Switch controller force feedback support"
depends on HID_NINTENDO
select INPUT_FF_MEMLESS
help
Say Y here if you have a Nintendo Switch controller and want to enable
force feedback support for it. This works for both joy-cons and the pro
controller. For the pro controller, both rumble motors can be controlled
individually.

config HID_NTI
tristate "NTI keyboard adapters"
help
Expand Down
Loading

0 comments on commit c4eae84

Please sign in to comment.