* [PATCH] input: add handler for reset and power key input events @ 2019-08-29 5:28 Ahmad Fatoum 2019-08-29 6:41 ` Oleksij Rempel 2019-08-29 11:26 ` duhuanpeng 0 siblings, 2 replies; 7+ messages in thread From: Ahmad Fatoum @ 2019-08-29 5:28 UTC (permalink / raw) To: barebox; +Cc: Oleksij Rempel, Ahmad Fatoum Kernel device trees may indicate linux,code = KEY_POWER or KEY_RESTART, mostly for gpio-keys. Make barebox able to act on them by registering an appropriate input notifier. Suggested-by: Oleksij Rempel <o.rempel@pengutronix.de> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> --- drivers/input/Kconfig | 6 ++++++ drivers/input/Makefile | 1 + drivers/input/specialkeys.c | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 drivers/input/specialkeys.c diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig index 1f89ae3892dc..be061683fb0a 100644 --- a/drivers/input/Kconfig +++ b/drivers/input/Kconfig @@ -64,4 +64,10 @@ config KEYBOARD_USB help This driver implements support for usb keyboard. +config INPUT_SPECIALKEYS + bool "Special keys handler" + select INPUT + help + Say Y here to handle key events like KEY_RESTART and KEY_POWER. + endmenu diff --git a/drivers/input/Makefile b/drivers/input/Makefile index e694a98d1087..36a4204d5308 100644 --- a/drivers/input/Makefile +++ b/drivers/input/Makefile @@ -5,3 +5,4 @@ obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o obj-$(CONFIG_KEYBOARD_TWL6030) += twl6030_pwrbtn.o obj-$(CONFIG_KEYBOARD_IMX_KEYPAD) += imx_keypad.o obj-$(CONFIG_KEYBOARD_QT1070) += qt1070.o +obj-$(CONFIG_INPUT_SPECIALKEYS) += specialkeys.o diff --git a/drivers/input/specialkeys.c b/drivers/input/specialkeys.c new file mode 100644 index 000000000000..51ee43218192 --- /dev/null +++ b/drivers/input/specialkeys.c @@ -0,0 +1,36 @@ +// SPDX-License-Identifier: GPL-2.0 +// Copyright (c) 2019 Ahmad Fatoum, Pengutronix + +#include <common.h> +#include <restart.h> +#include <poweroff.h> +#include <init.h> +#include <input/input.h> +#include <dt-bindings/input/linux-event-codes.h> + +static void input_specialkeys_notify(struct input_notifier *in, + struct input_event *ev) +{ + switch (ev->code) { + case KEY_RESTART: + pr_debug("code: %d. Triggering reset.\n", ev->code); + restart_machine(); + break; + + case KEY_POWER: + pr_debug("code: %d. Triggering poweroff.\n", ev->code); + poweroff_machine(); + break; + } + + pr_debug("ignoring code: %d\n", ev->code); +} + +static struct input_notifier notifier; + +static int input_specialkeys_init(void) +{ + notifier.notify = input_specialkeys_notify; + return input_register_notfier(¬ifier); +} +late_initcall(input_specialkeys_init); -- 2.23.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] input: add handler for reset and power key input events 2019-08-29 5:28 [PATCH] input: add handler for reset and power key input events Ahmad Fatoum @ 2019-08-29 6:41 ` Oleksij Rempel 2019-08-30 9:41 ` Ahmad Fatoum 2019-08-29 11:26 ` duhuanpeng 1 sibling, 1 reply; 7+ messages in thread From: Oleksij Rempel @ 2019-08-29 6:41 UTC (permalink / raw) To: Ahmad Fatoum, barebox Hi On 29.08.19 07:28, Ahmad Fatoum wrote: > Kernel device trees may indicate linux,code = KEY_POWER or KEY_RESTART, > mostly for gpio-keys. Make barebox able to act on them by registering an > appropriate input notifier. > > Suggested-by: Oleksij Rempel <o.rempel@pengutronix.de> > Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> > --- > drivers/input/Kconfig | 6 ++++++ > drivers/input/Makefile | 1 + > drivers/input/specialkeys.c | 36 ++++++++++++++++++++++++++++++++++++ > 3 files changed, 43 insertions(+) > create mode 100644 drivers/input/specialkeys.c > > diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig > index 1f89ae3892dc..be061683fb0a 100644 > --- a/drivers/input/Kconfig > +++ b/drivers/input/Kconfig > @@ -64,4 +64,10 @@ config KEYBOARD_USB > help > This driver implements support for usb keyboard. > > +config INPUT_SPECIALKEYS > + bool "Special keys handler" > + select INPUT > + help > + Say Y here to handle key events like KEY_RESTART and KEY_POWER. > + > endmenu > diff --git a/drivers/input/Makefile b/drivers/input/Makefile > index e694a98d1087..36a4204d5308 100644 > --- a/drivers/input/Makefile > +++ b/drivers/input/Makefile > @@ -5,3 +5,4 @@ obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o > obj-$(CONFIG_KEYBOARD_TWL6030) += twl6030_pwrbtn.o > obj-$(CONFIG_KEYBOARD_IMX_KEYPAD) += imx_keypad.o > obj-$(CONFIG_KEYBOARD_QT1070) += qt1070.o > +obj-$(CONFIG_INPUT_SPECIALKEYS) += specialkeys.o > diff --git a/drivers/input/specialkeys.c b/drivers/input/specialkeys.c > new file mode 100644 > index 000000000000..51ee43218192 > --- /dev/null > +++ b/drivers/input/specialkeys.c > @@ -0,0 +1,36 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (c) 2019 Ahmad Fatoum, Pengutronix > + > +#include <common.h> > +#include <restart.h> > +#include <poweroff.h> > +#include <init.h> > +#include <input/input.h> > +#include <dt-bindings/input/linux-event-codes.h> > + > +static void input_specialkeys_notify(struct input_notifier *in, > + struct input_event *ev) > +{ > + switch (ev->code) { > + case KEY_RESTART: > + pr_debug("code: %d. Triggering reset.\n", ev->code); May be it is better to increase the pr_ level, for example to pr_info? In case we have some buggy KEY (wrong active level, or floating input gpio) we can easily detect it. > + restart_machine(); > + break; > + > + case KEY_POWER: > + pr_debug("code: %d. Triggering poweroff.\n", ev->code); same here. > + poweroff_machine(); > + break; > + } > + > + pr_debug("ignoring code: %d\n", ev->code); > +} > + > +static struct input_notifier notifier; > + > +static int input_specialkeys_init(void) > +{ > + notifier.notify = input_specialkeys_notify; > + return input_register_notfier(¬ifier); > +} > +late_initcall(input_specialkeys_init); > Kind regards, Oleksij Rempel -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] input: add handler for reset and power key input events 2019-08-29 6:41 ` Oleksij Rempel @ 2019-08-30 9:41 ` Ahmad Fatoum 0 siblings, 0 replies; 7+ messages in thread From: Ahmad Fatoum @ 2019-08-30 9:41 UTC (permalink / raw) To: Oleksij Rempel, barebox On 8/29/19 8:41 AM, Oleksij Rempel wrote: > Hi > > On 29.08.19 07:28, Ahmad Fatoum wrote: >> Kernel device trees may indicate linux,code = KEY_POWER or KEY_RESTART, >> mostly for gpio-keys. Make barebox able to act on them by registering an >> appropriate input notifier. >> >> Suggested-by: Oleksij Rempel <o.rempel@pengutronix.de> >> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> >> --- >> drivers/input/Kconfig | 6 ++++++ >> drivers/input/Makefile | 1 + >> drivers/input/specialkeys.c | 36 ++++++++++++++++++++++++++++++++++++ >> 3 files changed, 43 insertions(+) >> create mode 100644 drivers/input/specialkeys.c >> >> diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig >> index 1f89ae3892dc..be061683fb0a 100644 >> --- a/drivers/input/Kconfig >> +++ b/drivers/input/Kconfig >> @@ -64,4 +64,10 @@ config KEYBOARD_USB >> help >> This driver implements support for usb keyboard. >> +config INPUT_SPECIALKEYS >> + bool "Special keys handler" >> + select INPUT >> + help >> + Say Y here to handle key events like KEY_RESTART and KEY_POWER. >> + >> endmenu >> diff --git a/drivers/input/Makefile b/drivers/input/Makefile >> index e694a98d1087..36a4204d5308 100644 >> --- a/drivers/input/Makefile >> +++ b/drivers/input/Makefile >> @@ -5,3 +5,4 @@ obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o >> obj-$(CONFIG_KEYBOARD_TWL6030) += twl6030_pwrbtn.o >> obj-$(CONFIG_KEYBOARD_IMX_KEYPAD) += imx_keypad.o >> obj-$(CONFIG_KEYBOARD_QT1070) += qt1070.o >> +obj-$(CONFIG_INPUT_SPECIALKEYS) += specialkeys.o >> diff --git a/drivers/input/specialkeys.c b/drivers/input/specialkeys.c >> new file mode 100644 >> index 000000000000..51ee43218192 >> --- /dev/null >> +++ b/drivers/input/specialkeys.c >> @@ -0,0 +1,36 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +// Copyright (c) 2019 Ahmad Fatoum, Pengutronix >> + >> +#include <common.h> >> +#include <restart.h> >> +#include <poweroff.h> >> +#include <init.h> >> +#include <input/input.h> >> +#include <dt-bindings/input/linux-event-codes.h> >> + >> +static void input_specialkeys_notify(struct input_notifier *in, >> + struct input_event *ev) >> +{ >> + switch (ev->code) { >> + case KEY_RESTART: >> + pr_debug("code: %d. Triggering reset.\n", ev->code); > > May be it is better to increase the pr_ level, for example to pr_info? In case we have some buggy KEY (wrong active level, or floating input gpio) we can easily detect it. Will do. > >> + restart_machine(); >> + break; >> + >> + case KEY_POWER: >> + pr_debug("code: %d. Triggering poweroff.\n", ev->code); > > same here. > >> + poweroff_machine(); >> + break; >> + } >> + >> + pr_debug("ignoring code: %d\n", ev->code); >> +} >> + >> +static struct input_notifier notifier; >> + >> +static int input_specialkeys_init(void) >> +{ >> + notifier.notify = input_specialkeys_notify; >> + return input_register_notfier(¬ifier); >> +} >> +late_initcall(input_specialkeys_init); >> > > Kind regards, > Oleksij Rempel > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] input: add handler for reset and power key input events 2019-08-29 5:28 [PATCH] input: add handler for reset and power key input events Ahmad Fatoum 2019-08-29 6:41 ` Oleksij Rempel @ 2019-08-29 11:26 ` duhuanpeng 2019-08-30 9:02 ` Ahmad Fatoum 1 sibling, 1 reply; 7+ messages in thread From: duhuanpeng @ 2019-08-29 11:26 UTC (permalink / raw) To: Ahmad Fatoum; +Cc: barebox, Oleksij Rempel Hello, I merged this patch to my barebox. and test on my own board. 1. Abort barebox booting and enter the console. the board reboots immediately when I press the button without release. here is my .dts about this button: net { label = "board:LED1:system"; gpios = <&gpio 1 GPIO_ACTIVE_LOW>; default-state = "off"; barebox,default-trigger = "net"; }; 2. Panic. type 'go 888' make barebox panic. now I really need a 'reset' key. I press and releaes the key, and try to hold this key several seconds. no reaction. Is the 'reset' key designed for reset the board when something goes wrong? Regards, duhuanpeng On Thu, Aug 29, 2019 at 07:28:08AM +0200, Ahmad Fatoum wrote: > Kernel device trees may indicate linux,code = KEY_POWER or KEY_RESTART, > mostly for gpio-keys. Make barebox able to act on them by registering an > appropriate input notifier. > > Suggested-by: Oleksij Rempel <o.rempel@pengutronix.de> > Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> > --- > drivers/input/Kconfig | 6 ++++++ > drivers/input/Makefile | 1 + > drivers/input/specialkeys.c | 36 ++++++++++++++++++++++++++++++++++++ > 3 files changed, 43 insertions(+) > create mode 100644 drivers/input/specialkeys.c > > diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig > index 1f89ae3892dc..be061683fb0a 100644 > --- a/drivers/input/Kconfig > +++ b/drivers/input/Kconfig > @@ -64,4 +64,10 @@ config KEYBOARD_USB > help > This driver implements support for usb keyboard. > > +config INPUT_SPECIALKEYS > + bool "Special keys handler" > + select INPUT > + help > + Say Y here to handle key events like KEY_RESTART and KEY_POWER. > + > endmenu > diff --git a/drivers/input/Makefile b/drivers/input/Makefile > index e694a98d1087..36a4204d5308 100644 > --- a/drivers/input/Makefile > +++ b/drivers/input/Makefile > @@ -5,3 +5,4 @@ obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o > obj-$(CONFIG_KEYBOARD_TWL6030) += twl6030_pwrbtn.o > obj-$(CONFIG_KEYBOARD_IMX_KEYPAD) += imx_keypad.o > obj-$(CONFIG_KEYBOARD_QT1070) += qt1070.o > +obj-$(CONFIG_INPUT_SPECIALKEYS) += specialkeys.o > diff --git a/drivers/input/specialkeys.c b/drivers/input/specialkeys.c > new file mode 100644 > index 000000000000..51ee43218192 > --- /dev/null > +++ b/drivers/input/specialkeys.c > @@ -0,0 +1,36 @@ > +// SPDX-License-Identifier: GPL-2.0 > +// Copyright (c) 2019 Ahmad Fatoum, Pengutronix > + > +#include <common.h> > +#include <restart.h> > +#include <poweroff.h> > +#include <init.h> > +#include <input/input.h> > +#include <dt-bindings/input/linux-event-codes.h> > + > +static void input_specialkeys_notify(struct input_notifier *in, > + struct input_event *ev) > +{ > + switch (ev->code) { > + case KEY_RESTART: > + pr_debug("code: %d. Triggering reset.\n", ev->code); > + restart_machine(); > + break; > + > + case KEY_POWER: > + pr_debug("code: %d. Triggering poweroff.\n", ev->code); > + poweroff_machine(); > + break; > + } > + > + pr_debug("ignoring code: %d\n", ev->code); > +} > + > +static struct input_notifier notifier; > + > +static int input_specialkeys_init(void) > +{ > + notifier.notify = input_specialkeys_notify; > + return input_register_notfier(¬ifier); > +} > +late_initcall(input_specialkeys_init); > -- > 2.23.0 > > > _______________________________________________ > barebox mailing list > barebox@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/barebox > _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] input: add handler for reset and power key input events 2019-08-29 11:26 ` duhuanpeng @ 2019-08-30 9:02 ` Ahmad Fatoum 2019-08-30 9:33 ` Oleksij Rempel 0 siblings, 1 reply; 7+ messages in thread From: Ahmad Fatoum @ 2019-08-30 9:02 UTC (permalink / raw) To: barebox Hello, On 8/29/19 1:26 PM, duhuanpeng wrote: > Hello, I merged this patch to my barebox. and test on my own board. > > 1. Abort barebox booting and enter the console. > the board reboots immediately when I press the button without release. > here is my .dts about this button: > > net { > label = "board:LED1:system"; > gpios = <&gpio 1 GPIO_ACTIVE_LOW>; > default-state = "off"; > barebox,default-trigger = "net"; > }; Copy-paste mistake? > > 2. Panic. > type 'go 888' make barebox panic. now I really need a 'reset' key. > I press and releaes the key, and try to hold this key several seconds. > no reaction. > > Is the 'reset' key designed for reset the board when something goes wrong? That's the watchdog's job. If your hardware features a hardware watchdog, you can have it started on bootm or configure barebox' poller to feed it continuously. If barebox panics or anything else happens before Linux starts feeding the watchdog, your system will then automatically reset. You could have barebox panic loop on a gpio, but it would only help if barebox actually calls panic. If you run into an infinite loop, or the exception vectors are overwritten, there's nothing barebox can do (short of evolving to barebOS and implementing preemption and privilege separation). Cheers Ahmad > > Regards, > duhuanpeng > > > On Thu, Aug 29, 2019 at 07:28:08AM +0200, Ahmad Fatoum wrote: >> Kernel device trees may indicate linux,code = KEY_POWER or KEY_RESTART, >> mostly for gpio-keys. Make barebox able to act on them by registering an >> appropriate input notifier. >> >> Suggested-by: Oleksij Rempel <o.rempel@pengutronix.de> >> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> >> --- >> drivers/input/Kconfig | 6 ++++++ >> drivers/input/Makefile | 1 + >> drivers/input/specialkeys.c | 36 ++++++++++++++++++++++++++++++++++++ >> 3 files changed, 43 insertions(+) >> create mode 100644 drivers/input/specialkeys.c >> >> diff --git a/drivers/input/Kconfig b/drivers/input/Kconfig >> index 1f89ae3892dc..be061683fb0a 100644 >> --- a/drivers/input/Kconfig >> +++ b/drivers/input/Kconfig >> @@ -64,4 +64,10 @@ config KEYBOARD_USB >> help >> This driver implements support for usb keyboard. >> >> +config INPUT_SPECIALKEYS >> + bool "Special keys handler" >> + select INPUT >> + help >> + Say Y here to handle key events like KEY_RESTART and KEY_POWER. >> + >> endmenu >> diff --git a/drivers/input/Makefile b/drivers/input/Makefile >> index e694a98d1087..36a4204d5308 100644 >> --- a/drivers/input/Makefile >> +++ b/drivers/input/Makefile >> @@ -5,3 +5,4 @@ obj-$(CONFIG_KEYBOARD_GPIO) += gpio_keys.o >> obj-$(CONFIG_KEYBOARD_TWL6030) += twl6030_pwrbtn.o >> obj-$(CONFIG_KEYBOARD_IMX_KEYPAD) += imx_keypad.o >> obj-$(CONFIG_KEYBOARD_QT1070) += qt1070.o >> +obj-$(CONFIG_INPUT_SPECIALKEYS) += specialkeys.o >> diff --git a/drivers/input/specialkeys.c b/drivers/input/specialkeys.c >> new file mode 100644 >> index 000000000000..51ee43218192 >> --- /dev/null >> +++ b/drivers/input/specialkeys.c >> @@ -0,0 +1,36 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +// Copyright (c) 2019 Ahmad Fatoum, Pengutronix >> + >> +#include <common.h> >> +#include <restart.h> >> +#include <poweroff.h> >> +#include <init.h> >> +#include <input/input.h> >> +#include <dt-bindings/input/linux-event-codes.h> >> + >> +static void input_specialkeys_notify(struct input_notifier *in, >> + struct input_event *ev) >> +{ >> + switch (ev->code) { >> + case KEY_RESTART: >> + pr_debug("code: %d. Triggering reset.\n", ev->code); >> + restart_machine(); >> + break; >> + >> + case KEY_POWER: >> + pr_debug("code: %d. Triggering poweroff.\n", ev->code); >> + poweroff_machine(); >> + break; >> + } >> + >> + pr_debug("ignoring code: %d\n", ev->code); >> +} >> + >> +static struct input_notifier notifier; >> + >> +static int input_specialkeys_init(void) >> +{ >> + notifier.notify = input_specialkeys_notify; >> + return input_register_notfier(¬ifier); >> +} >> +late_initcall(input_specialkeys_init); >> -- >> 2.23.0 >> >> >> _______________________________________________ >> barebox mailing list >> barebox@lists.infradead.org >> http://lists.infradead.org/mailman/listinfo/barebox >> > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] input: add handler for reset and power key input events 2019-08-30 9:02 ` Ahmad Fatoum @ 2019-08-30 9:33 ` Oleksij Rempel 2019-09-02 7:24 ` Sascha Hauer 0 siblings, 1 reply; 7+ messages in thread From: Oleksij Rempel @ 2019-08-30 9:33 UTC (permalink / raw) To: Ahmad Fatoum, barebox Am 30.08.19 um 11:02 schrieb Ahmad Fatoum: > Hello, > > On 8/29/19 1:26 PM, duhuanpeng wrote: >> Hello, I merged this patch to my barebox. and test on my own board. >> >> 1. Abort barebox booting and enter the console. >> the board reboots immediately when I press the button without release. >> here is my .dts about this button: >> >> net { >> label = "board:LED1:system"; >> gpios = <&gpio 1 GPIO_ACTIVE_LOW>; >> default-state = "off"; >> barebox,default-trigger = "net"; >> }; > > Copy-paste mistake? > >> >> 2. Panic. >> type 'go 888' make barebox panic. now I really need a 'reset' key. >> I press and releaes the key, and try to hold this key several seconds. >> no reaction. >> >> Is the 'reset' key designed for reset the board when something goes wrong? > > That's the watchdog's job. If your hardware features a hardware watchdog, you can > have it started on bootm or configure barebox' poller to feed it continuously. > If barebox panics or anything else happens before Linux starts feeding the watchdog, > your system will then automatically reset. > > You could have barebox panic loop on a gpio, but it would only help if barebox > actually calls panic. If you run into an infinite loop, or the exception vectors > are overwritten, there's nothing barebox can do (short of evolving to barebOS and > implementing preemption and privilege separation). May be it would make sense to have an option simila to the kernel, to reboot on panic. -- Regards, Oleksij _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] input: add handler for reset and power key input events 2019-08-30 9:33 ` Oleksij Rempel @ 2019-09-02 7:24 ` Sascha Hauer 0 siblings, 0 replies; 7+ messages in thread From: Sascha Hauer @ 2019-09-02 7:24 UTC (permalink / raw) To: Oleksij Rempel; +Cc: barebox, Ahmad Fatoum On Fri, Aug 30, 2019 at 11:33:22AM +0200, Oleksij Rempel wrote: > Am 30.08.19 um 11:02 schrieb Ahmad Fatoum: > > Hello, > > > > On 8/29/19 1:26 PM, duhuanpeng wrote: > > > Hello, I merged this patch to my barebox. and test on my own board. > > > > > > 1. Abort barebox booting and enter the console. > > > the board reboots immediately when I press the button without release. > > > here is my .dts about this button: > > > > > > net { > > > label = "board:LED1:system"; > > > gpios = <&gpio 1 GPIO_ACTIVE_LOW>; > > > default-state = "off"; > > > barebox,default-trigger = "net"; > > > }; > > > > Copy-paste mistake? > > > > > > > > 2. Panic. > > > type 'go 888' make barebox panic. now I really need a 'reset' key. > > > I press and releaes the key, and try to hold this key several seconds. > > > no reaction. > > > > > > Is the 'reset' key designed for reset the board when something goes wrong? > > > > That's the watchdog's job. If your hardware features a hardware watchdog, you can > > have it started on bootm or configure barebox' poller to feed it continuously. > > If barebox panics or anything else happens before Linux starts feeding the watchdog, > > your system will then automatically reset. > > > > You could have barebox panic loop on a gpio, but it would only help if barebox > > actually calls panic. If you run into an infinite loop, or the exception vectors > > are overwritten, there's nothing barebox can do (short of evolving to barebOS and > > implementing preemption and privilege separation). > > May be it would make sense to have an option simila to the kernel, to reboot on panic. We already have that option. It's hidden behind CONFIG_PANIC_HANG. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2019-09-02 7:24 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2019-08-29 5:28 [PATCH] input: add handler for reset and power key input events Ahmad Fatoum 2019-08-29 6:41 ` Oleksij Rempel 2019-08-30 9:41 ` Ahmad Fatoum 2019-08-29 11:26 ` duhuanpeng 2019-08-30 9:02 ` Ahmad Fatoum 2019-08-30 9:33 ` Oleksij Rempel 2019-09-02 7:24 ` Sascha Hauer
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox