Skip to contentSkip to conversation

input: Add keyreset driver.

PATCH In review Bálint Czobor 2 participants 2 messages Oct 27, 2015

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

PATCH 1/3 input: Add keyreset driver.

From: Arve Hjønnevåg <[email protected]>

Add a platform device in the board file to specify a reset key-combo. The first time the key-combo is detected a work function that syncs the filesystems is scheduled. If all the keys are released and then pressed again, it calls panic. Reboot on panic should be set for this to work.

---
 drivers/input/Kconfig    |    9 ++
 drivers/input/Makefile   |    1 +
 drivers/input/keyreset.c |  239 ++++++++++++++++++++++++++++++++++++++++++++++
 include/linux/keyreset.h |   28 ++++++
 4 files changed, 277 insertions(+)
 create mode 100644 drivers/input/keyreset.c
 create mode 100644 include/linux/keyreset.h
drivers/input/Kconfig +0 -0
index a35532e..47a5143 100644
@@ -187,6 +187,15 @@ config INPUT_APMPOWER

To compile this driver as a module, choose M here: the module will be called apm-power.

+config INPUT_KEYRESET
+ tristate "Reset key"
+ depends on INPUT
+ ---help---
+ Say Y here if you want to reboot when some keys are pressed;
+
+ To compile this driver as a module, choose M here: the
+ module will be called keyreset.
+
comment "Input Device Drivers"

source "drivers/input/keyboard/Kconfig"

drivers/input/Makefile +1 -0
index 0c9302c..f3749d5 100644
@@ -26,3 +26,4 @@ obj-$(CONFIG_INPUT_TOUCHSCREEN)	+= touchscreen/
 obj-$(CONFIG_INPUT_MISC)	+= misc/
 
 obj-$(CONFIG_INPUT_APMPOWER)	+= apm-power.o
+obj-$(CONFIG_INPUT_KEYRESET)	+= keyreset.o
drivers/input/keyreset.c new file +239 -0

239 lines not on this page · raw message

include/linux/keyreset.h new file +28 -0
new file mode 100644
index 0000000..a2ac49e
@@ -0,0 +1,28 @@
+/*
+ * include/linux/keyreset.h - platform data structure for resetkeys driver
+ *
+ * Copyright (C) 2008 Google, Inc.
+ *
+ * This software is licensed under the terms of the GNU General Public
+ * License version 2, as published by the Free Software Foundation, and
+ * may be copied, distributed, and modified under those terms.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ */
+
+#ifndef _LINUX_KEYRESET_H
+#define _LINUX_KEYRESET_H
+
+#define KEYRESET_NAME "keyreset"
+
+struct keyreset_platform_data {
+	int (*reset_fn)(void);
+	int *keys_up;
+	int keys_down[]; /* 0 terminated */
+};
+
+#endif /* _LINUX_KEYRESET_H */

--
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

maintainer
#1 lore raw

Hi Bálint,

Quoted 7 lines · Bálint Czobor

From: Arve Hjønnevåg <[email protected]>

Add a platform device in the board file to specify a reset key-combo. The first time the key-combo is detected a work function that syncs the filesystems is scheduled. If all the keys are released and then pressed again, it calls panic. Reboot on panic should be set for this to work.

Mathieu Poirier integrated keyreset functionality into sysrq, see 3d289517dfd48f6487efda81543c3dda8b0e66f2 and 154b7a489a5b1d808323b933b04864958c2f1056

Thanks.

Signature · 5 lines
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html