diff mbox

Input: add LED_0..LED_15 define

Message ID 20170208004141.30540-1-me@paulo.costa.nom.br (mailing list archive)
State New, archived
Headers show

Commit Message

Paulo Costa Feb. 8, 2017, 12:41 a.m. UTC
Some input devices have many controllable leds that don't fit any standard function (e.g., the Wiimote has 4 controllable LEDs)

Just as we have BTN_0..BTN_9 for generic buttons, LED_0...LED_15 can now be used to control generic leds.

Signed-off-by: Paulo Costa <me@paulo.costa.nom.br>
---
 include/linux/mod_devicetable.h        |  2 +-
 include/uapi/linux/input-event-codes.h | 20 +++++++++++++++++++-
 2 files changed, 20 insertions(+), 2 deletions(-)

Comments

Dmitry Torokhov Feb. 11, 2017, 12:54 a.m. UTC | #1
Hi Paulo,

On Tue, Feb 7, 2017 at 4:41 PM, Paulo Costa <me@paulo.costa.nom.br> wrote:
> Some input devices have many controllable leds that don't fit any standard function (e.g., the Wiimote has 4 controllable LEDs)
>
> Just as we have BTN_0..BTN_9 for generic buttons, LED_0...LED_15 can now be used to control generic leds.

Generic LEDs should use LED subsystem; we are not going to be adding
more LED definitions to input.

Thanks.
Paulo Costa Feb. 13, 2017, 1:03 a.m. UTC | #2
2017-02-10 22:54 GMT-02:00 Dmitry Torokhov <dmitry.torokhov@gmail.com>:
> Hi Paulo,
>
> On Tue, Feb 7, 2017 at 4:41 PM, Paulo Costa <me@paulo.costa.nom.br> wrote:
>> Some input devices have many controllable leds that don't fit any standard function (e.g., the Wiimote has 4 controllable LEDs)
>>
>> Just as we have BTN_0..BTN_9 for generic buttons, LED_0...LED_15 can now be used to control generic leds.
>
> Generic LEDs should use LED subsystem; we are not going to be adding
> more LED definitions to input.
>
> Thanks.
>
> --
> Dmitry

Hello, Dmitry,

IMHO, whenever those leds are part of a bigger input device,
using EV_LED makes more sense.

But it's your call, thanks for looking into it.

Paulo
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dmitry Torokhov Feb. 13, 2017, 1:31 a.m. UTC | #3
On Sun, Feb 12, 2017 at 11:03:03PM -0200, Paulo Costa wrote:
> 2017-02-10 22:54 GMT-02:00 Dmitry Torokhov <dmitry.torokhov@gmail.com>:
> > Hi Paulo,
> >
> > On Tue, Feb 7, 2017 at 4:41 PM, Paulo Costa <me@paulo.costa.nom.br> wrote:
> >> Some input devices have many controllable leds that don't fit any standard function (e.g., the Wiimote has 4 controllable LEDs)
> >>
> >> Just as we have BTN_0..BTN_9 for generic buttons, LED_0...LED_15 can now be used to control generic leds.
> >
> > Generic LEDs should use LED subsystem; we are not going to be adding
> > more LED definitions to input.
> >
> > Thanks.
> >
> > --
> > Dmitry
> 
> Hello, Dmitry,
> 
> IMHO, whenever those leds are part of a bigger input device,
> using EV_LED makes more sense.
> 
> But it's your call, thanks for looking into it.

Yes, we even re-exported the "original" input LEDs as "standard" LEDs.
Other drovers are also using "standard" LEDs - xpad.c, etc.

Thanks.
diff mbox

Patch

diff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h
index ed84c07..d54cec1 100644
--- a/include/linux/mod_devicetable.h
+++ b/include/linux/mod_devicetable.h
@@ -288,7 +288,7 @@  struct pcmcia_device_id {
 #define INPUT_DEVICE_ID_REL_MAX		0x0f
 #define INPUT_DEVICE_ID_ABS_MAX		0x3f
 #define INPUT_DEVICE_ID_MSC_MAX		0x07
-#define INPUT_DEVICE_ID_LED_MAX		0x0f
+#define INPUT_DEVICE_ID_LED_MAX		0x1f
 #define INPUT_DEVICE_ID_SND_MAX		0x07
 #define INPUT_DEVICE_ID_FF_MAX		0x7f
 #define INPUT_DEVICE_ID_SW_MAX		0x0f
diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h
index 3af60ee..4322682 100644
--- a/include/uapi/linux/input-event-codes.h
+++ b/include/uapi/linux/input-event-codes.h
@@ -812,7 +812,25 @@ 
 #define LED_MISC		0x08
 #define LED_MAIL		0x09
 #define LED_CHARGING		0x0a
-#define LED_MAX			0x0f
+
+#define LED_0			0x10
+#define LED_1			0x11
+#define LED_2			0x12
+#define LED_3			0x13
+#define LED_4			0x14
+#define LED_5			0x15
+#define LED_6			0x16
+#define LED_7			0x17
+#define LED_8			0x18
+#define LED_9			0x19
+#define LED_10			0x1a
+#define LED_11			0x1b
+#define LED_12			0x1c
+#define LED_13			0x1d
+#define LED_14			0x1e
+#define LED_15			0x1f
+
+#define LED_MAX			0x1f
 #define LED_CNT			(LED_MAX+1)
 
 /*