From f6ff690e647c696e69f801719ef3fca087c1b370 Mon Sep 17 00:00:00 2001 From: Emily Strickland Date: Sun, 17 Jul 2022 02:21:55 +0000 Subject: [PATCH] Define LED_FUNCTION_PLAYER* if not defined (#1) This change adds some preprocessor defines that were added to the Linux kernel in 5.16. We simply define them if they're not already defined. Even if this somehow slightly changes compatibility somehow, it's harmless. It just affects a device name. Maybe someone's udev rule would break. But the chances are extremely remote for reasons I don't want to belabor here. Fixes #1. --- hid-nx.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hid-nx.c b/hid-nx.c index 418d81d..b1beda0 100644 --- a/hid-nx.c +++ b/hid-nx.c @@ -542,6 +542,15 @@ struct nx_con_input_report { static const unsigned short NX_CON_RUMBLE_ZERO_AMP_PKT_CNT = 5; +/* for compat with kernels before 5.16 */ +#ifndef LED_FUNCTION_PLAYER1 +#define LED_FUNCTION_PLAYER1 "player-1" +#define LED_FUNCTION_PLAYER2 "player-2" +#define LED_FUNCTION_PLAYER3 "player-3" +#define LED_FUNCTION_PLAYER4 "player-4" +#define LED_FUNCTION_PLAYER5 "player-5" +#endif + static const char * nx_con_player_led_names[] = { LED_FUNCTION_PLAYER1, LED_FUNCTION_PLAYER2,