Skip to contentSkip to conversation

+ input-route-kbd-leds-through-the-generic-leds-layer.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Oct 8, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

Subject: + input-route-kbd-leds-through-the-generic-leds-layer.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Tue, 08 Oct 2013 16:06:25 -0700

The patch titled
Subject: input: route kbd LEDs through the generic LEDs layer
has been added to the -mm tree. Its filename is
input-route-kbd-leds-through-the-generic-leds-layer.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/input-route-kbd-leds-through-the-generic-leds-layer.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/input-route-kbd-leds-through-the-generic-leds-layer.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Samuel Thibault <[email protected]>
Subject: input: route kbd LEDs through the generic LEDs layer

This permits to reassign keyboard LEDs to something else than keyboard "leds" state, by adding keyboard led and modifier triggers connected to a series of VT input LEDs, themselves connected to VT input triggers, which per-input device LEDs use by default. Userland can thus easily change the LED behavior of (a priori) all input devices, or of particular input devices.

This also permits to fix #7063 from userland by using a modifier to implement proper CapsLock behavior and have the keyboard caps lock led show that modifier state.

[[email protected]: Rebased to 3.2-rc1 or so, cleaned up some includes, and fixed some constants]
Cc Pavel Machek <[email protected]>
Cc Dmitry Torokhov <[email protected]>
Cc Bryan Wu <[email protected]>
Cc Arnaud Patard <[email protected]>
Cc Sascha Hauer <[email protected]>
Cc Matt Sealey <[email protected]>
Cc Rob Clark <[email protected]>
Cc Niels de Vos <[email protected]>
Cc Steev Klimaszewski <[email protected]>

---

 Documentation/leds/leds-class.txt |    3 
 drivers/input/Kconfig             |    9 +
 drivers/input/Makefile            |    1 
 drivers/input/input.c             |    6 
 drivers/input/leds.c              |  247 ++++++++++++++++++++++++++++
 drivers/leds/Kconfig              |    3 
 drivers/tty/Kconfig               |    4 
 drivers/tty/vt/keyboard.c         |  110 +++++++++---
 include/linux/input.h             |   20 ++
 9 files changed, 370 insertions(+), 33 deletions(-)
Documentation/leds/leds-class.txt renamed from Documentation/leds/leds-class.txt~input-route-kbd-leds-through-the-generic-leds-layer +0 -3
diff -puN Documentation/leds/leds-class.txt~input-route-kbd-leds-through-the-generic-leds-layer Documentation/leds/leds-class.txt
@@ -2,9 +2,6 @@
 LED handling under Linux
 ========================
 
-If you're reading this and thinking about keyboard leds, these are
-handled by the input subsystem and the led class is *not* needed.
-
 In its simplest form, the LED class just allows control of LEDs from
 userspace. LEDs appear in /sys/class/leds/. The maximum brightness of the
 LED is defined in max_brightness file. The brightness file will set the brightness
drivers/input/Kconfig renamed from drivers/input/Kconfig~input-route-kbd-leds-through-the-generic-leds-layer +9 -0
diff -puN drivers/input/Kconfig~input-route-kbd-leds-through-the-generic-leds-layer drivers/input/Kconfig
@@ -178,6 +178,15 @@ comment "Input Device Drivers"
 
 source "drivers/input/keyboard/Kconfig"
 
+config INPUT_LEDS
+	tristate "LED Support"
+	depends on LEDS_CLASS
+	select LEDS_TRIGGERS
+	default y
+	help
+	  This option enables support for LEDs on keyboards managed
+	  by the input layer.
+
 source "drivers/input/mouse/Kconfig"
 
 source "drivers/input/joystick/Kconfig"
drivers/input/Makefile renamed from drivers/input/Makefile~input-route-kbd-leds-through-the-generic-leds-layer +1 -0
diff -puN drivers/input/Makefile~input-route-kbd-leds-through-the-generic-leds-layer drivers/input/Makefile
@@ -16,6 +16,7 @@ obj-$(CONFIG_INPUT_MOUSEDEV)	+= mousedev
 obj-$(CONFIG_INPUT_JOYDEV)	+= joydev.o
 obj-$(CONFIG_INPUT_EVDEV)	+= evdev.o
 obj-$(CONFIG_INPUT_EVBUG)	+= evbug.o
+obj-$(CONFIG_INPUT_LEDS)	+= leds.o
 
 obj-$(CONFIG_INPUT_KEYBOARD)	+= keyboard/
 obj-$(CONFIG_INPUT_MOUSE)	+= mouse/
drivers/input/input.c renamed from drivers/input/input.c~input-route-kbd-leds-through-the-generic-leds-layer +6 -0
diff -puN drivers/input/input.c~input-route-kbd-leds-through-the-generic-leds-layer drivers/input/input.c
@@ -708,6 +708,9 @@ static void input_disconnect_device(stru
 		handle->open = 0;
 
 	spin_unlock_irq(&dev->event_lock);
+
+	if (is_event_supported(EV_LED, dev->evbit, EV_MAX))
+		input_led_disconnect(dev);
 }
 
 /**
@@ -2092,6 +2095,9 @@ int input_register_device(struct input_d
 
 	list_add_tail(&dev->node, &input_dev_list);
 
+	if (is_event_supported(EV_LED, dev->evbit, EV_MAX))
+		input_led_connect(dev);
+
 	list_for_each_entry(handler, &input_handler_list, node)
 		input_attach_handler(dev, handler);
 
drivers/input/leds.c new file +247 -0

247 lines not on this page · raw message

drivers/leds/Kconfig renamed from drivers/leds/Kconfig~input-route-kbd-leds-through-the-generic-leds-layer +0 -3
diff -puN drivers/leds/Kconfig~input-route-kbd-leds-through-the-generic-leds-layer drivers/leds/Kconfig
@@ -11,9 +11,6 @@ menuconfig NEW_LEDS
 	  Say Y to enable Linux LED support.  This allows control of supported
 	  LEDs from both userspace and optionally, by kernel events (triggers).
 
-	  This is not related to standard keyboard LEDs which are controlled
-	  via the input system.
-
 if NEW_LEDS
 
 config LEDS_CLASS
drivers/tty/Kconfig renamed from drivers/tty/Kconfig~input-route-kbd-leds-through-the-generic-leds-layer +4 -0
diff -puN drivers/tty/Kconfig~input-route-kbd-leds-through-the-generic-leds-layer drivers/tty/Kconfig
@@ -13,6 +13,10 @@ config VT
 	bool "Virtual terminal" if EXPERT
 	depends on !S390 && !UML
 	select INPUT
+	select NEW_LEDS
+	select LEDS_CLASS
+	select LEDS_TRIGGERS
+	select INPUT_LEDS
 	default y
 	---help---
 	  If you say Y here, you will get support for terminal devices with
drivers/tty/vt/keyboard.c renamed from drivers/tty/vt/keyboard.c~input-route-kbd-leds-through-the-generic-leds-layer +83 -27

168 lines not on this page · raw message

include/linux/input.h renamed from include/linux/input.h~input-route-kbd-leds-through-the-generic-leds-layer +20 -0
diff -puN include/linux/input.h~input-route-kbd-leds-through-the-generic-leds-layer include/linux/input.h
@@ -164,6 +164,8 @@ struct input_dev {
 	unsigned long snd[BITS_TO_LONGS(SND_CNT)];
 	unsigned long sw[BITS_TO_LONGS(SW_CNT)];
 
+	struct led_classdev *leds;
+
 	int (*open)(struct input_dev *dev);
 	void (*close)(struct input_dev *dev);
 	int (*flush)(struct input_dev *dev, struct file *file);
@@ -531,4 +533,22 @@ int input_ff_erase(struct input_dev *dev
 int input_ff_create_memless(struct input_dev *dev, void *data,
 		int (*play_effect)(struct input_dev *, void *, struct ff_effect *));
 
+#ifdef CONFIG_INPUT_LEDS
+
+int input_led_connect(struct input_dev *dev);
+void input_led_disconnect(struct input_dev *dev);
+
+#else
+
+int input_led_connect(struct input_dev *dev)
+{
+	return 0;
+}
+
+void input_led_disconnect(struct input_dev *dev)
+{
+}
+
+#endif
+
 #endif

_

Patches currently in -mm which might be from [email protected] are

input-route-kbd-leds-through-the-generic-leds-layer.patch linux-next.patch