summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiovanni Bechis <giovanni@cvs.openbsd.org>2016-06-16 10:39:37 +0000
committerGiovanni Bechis <giovanni@cvs.openbsd.org>2016-06-16 10:39:37 +0000
commit1934a65b6319ccf2c18490f5f974c6aae62d41a7 (patch)
tree2ed66ef5eb2ec37ffd36b285cf81749ccf3f7673
parent070e1fdca8a173aaa6edd18f8d702fbfa59a39b9 (diff)
enable suspend/hibernate fn keys
ok mlarkin@
-rw-r--r--sys/dev/acpi/acpitoshiba.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/sys/dev/acpi/acpitoshiba.c b/sys/dev/acpi/acpitoshiba.c
index 155aa88e3e6..4f325afb802 100644
--- a/sys/dev/acpi/acpitoshiba.c
+++ b/sys/dev/acpi/acpitoshiba.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acpitoshiba.c,v 1.5 2016/06/08 13:34:30 giovanni Exp $ */
+/* $OpenBSD: acpitoshiba.c,v 1.6 2016/06/16 10:39:36 giovanni Exp $ */
/*-
* Copyright (c) 2003 Hiroyuki Aizu <aizu@navi.org>
* All rights reserved.
@@ -78,6 +78,8 @@
#define HCI_SUCCESS 0
/* Toshiba fn_keys events */
+#define FN_KEY_SUSPEND 0x01BD
+#define FN_KEY_HIBERNATE 0x01BE
#define FN_KEY_VIDEO_OUTPUT 0x01BF
#define FN_KEY_BRIGHTNESS_DOWN 0x01C0
#define FN_KEY_BRIGHTNESS_UP 0x01C1
@@ -394,6 +396,24 @@ toshiba_hotkey(struct aml_node *node, int notify, void *arg)
/* Decrease brightness */
ret = toshiba_fn_key_brightness_down(sc);
break;
+ case FN_KEY_SUSPEND:
+#ifndef SMALL_KERNEL
+ if (acpi_record_event(sc->sc_acpi, APM_USER_SUSPEND_REQ)) {
+ acpi_addtask(sc->sc_acpi, acpi_sleep_task,
+ sc->sc_acpi, ACPI_STATE_S3);
+ ret = HCI_SUCCESS;
+ }
+#endif
+ break;
+ case FN_KEY_HIBERNATE:
+#if defined(HIBERNATE) && !defined(SMALL_KERNEL)
+ if (acpi_record_event(sc->sc_acpi, APM_USER_HIBERNATE_REQ)) {
+ acpi_addtask(sc->sc_acpi, acpi_sleep_task,
+ sc->sc_acpi, ACPI_STATE_S4);
+ ret = HCI_SUCCESS;
+ }
+#endif
+ break;
case FN_KEY_VIDEO_OUTPUT:
/* Cycle through video outputs. */
ret = toshiba_fn_key_video_output(sc);