diff options
author | Martino Fontana <tinozzo123@gmail.com> | 2023-09-24 16:13:34 +0200 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2023-10-04 21:07:04 +0200 |
commit | 928276075f169d36f34e751ea5c81dd24d3a6823 (patch) | |
tree | d2a0672b3b9d72ef4f5344f9f4a1f42372979769 /crypto | |
parent | 29aa98d0fe013e2ab62aae4266231b7fb05d47a2 (diff) |
HID: nintendo: cleanup LED code
- Support player LED patterns up to 8 players.
(Note that the behavior still consinsts in increasing the player number
every time a controller is connected, never decreasing it. It should be
as is described in https://bugzilla.kernel.org/show_bug.cgi?id=216225.
However, any implementation here would stop making sense as soon as a
non-Nintendo controller is connected, which is why I'm not bothering.)
- Split part of `joycon_home_led_brightness_set` (which is called by hid)
into `joycon_set_home_led` (which is what actually sets the LEDs), for
consistency with player LEDs.
- `joycon_player_led_brightness_set` won't try it to "determine which
player led this is" anymore: it's already looking at every LED
brightness value.
- Instead of first registering the `led_classdev`, then attempting to set
the LED and unregistering the `led_classdev` if it fails, first attempt
to set the LED, then register the `led_classdev` only if it succeeds
(the class is still filled up in either case).
- If setting the player LEDs fails, still attempt setting the home LED.
(I don't know there's a third party controller where this may actually
happen, but who knows...)
- Use `JC_NUM_LEDS` where appropriate instead of 4.
- Print return codes in more places.
- Use spinlock instead of mutex for `input_num`. Copy its value to a local
variable, so that it can be unlocked immediately.
- `input_num` starts counting from 0
- Less holding of mutexes in general.
Signed-off-by: Martino Fontana <tinozzo123@gmail.com>
Reviewed-by: Daniel J. Ogorchock <djogorchock@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'crypto')
0 files changed, 0 insertions, 0 deletions