Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/sys Add some more Thinkpad hotkeys.



details:   https://anonhg.NetBSD.org/src/rev/d7a90d48363d
branches:  trunk
changeset: 983565:d7a90d48363d
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Sat May 29 16:49:57 2021 +0000

description:
Add some more Thinkpad hotkeys.

diffstat:

 sys/dev/acpi/thinkpad_acpi.c |  48 +++++++++++++++++++++++++++++++++++++++++--
 sys/sys/power.h              |   6 ++++-
 2 files changed, 50 insertions(+), 4 deletions(-)

diffs (124 lines):

diff -r 95f86b529fac -r d7a90d48363d sys/dev/acpi/thinkpad_acpi.c
--- a/sys/dev/acpi/thinkpad_acpi.c      Sat May 29 16:49:49 2021 +0000
+++ b/sys/dev/acpi/thinkpad_acpi.c      Sat May 29 16:49:57 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.51 2021/05/29 16:49:49 riastradh Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.52 2021/05/29 16:49:57 riastradh Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.51 2021/05/29 16:49:49 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.52 2021/05/29 16:49:57 riastradh Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -76,7 +76,11 @@
 #define        TP_PSW_VOLUME_UP        17
 #define        TP_PSW_VOLUME_DOWN      18
 #define        TP_PSW_VOLUME_MUTE      19
-#define        TP_PSW_LAST             20
+#define        TP_PSW_STAR_BUTTON      20
+#define        TP_PSW_SCISSORS_BUTTON  21
+#define        TP_PSW_BLUETOOTH_BUTTON 22
+#define        TP_PSW_KEYBOARD_BUTTON  23
+#define        TP_PSW_LAST             24
 
        struct sysmon_pswitch   sc_smpsw[TP_PSW_LAST];
        bool                    sc_smpsw_valid;
@@ -108,6 +112,10 @@
 #define        THINKPAD_NOTIFY_VolumeDown      0x016   /* XXX: Not seen on T61 */
 #define        THINKPAD_NOTIFY_VolumeMute      0x017   /* XXX: Not seen on T61 */
 #define        THINKPAD_NOTIFY_ThinkVantage    0x018
+#define        THINKPAD_NOTIFY_Star            0x311
+#define        THINKPAD_NOTIFY_Scissors        0x312
+#define        THINKPAD_NOTIFY_Bluetooth       0x314
+#define        THINKPAD_NOTIFY_Keyboard        0x315
 
 #define        THINKPAD_CMOS_BRIGHTNESS_UP     0x04
 #define        THINKPAD_CMOS_BRIGHTNESS_DOWN   0x05
@@ -295,6 +303,10 @@
        psw[TP_PSW_VOLUME_UP].smpsw_name       = PSWITCH_HK_VOLUME_UP;
        psw[TP_PSW_VOLUME_DOWN].smpsw_name     = PSWITCH_HK_VOLUME_DOWN;
        psw[TP_PSW_VOLUME_MUTE].smpsw_name     = PSWITCH_HK_VOLUME_MUTE;
+       psw[TP_PSW_STAR_BUTTON].smpsw_name     = PSWITCH_HK_STAR_BUTTON;
+       psw[TP_PSW_SCISSORS_BUTTON].smpsw_name = PSWITCH_HK_SCISSORS_BUTTON;
+       psw[TP_PSW_BLUETOOTH_BUTTON].smpsw_name = PSWITCH_HK_BLUETOOTH_BUTTON;
+       psw[TP_PSW_KEYBOARD_BUTTON].smpsw_name = PSWITCH_HK_KEYBOARD_BUTTON;
 #endif /* THINKPAD_NORMAL_HOTKEYS */
 
        for (i = 0; i < TP_PSW_LAST; i++) {
@@ -426,6 +438,15 @@
                            PSWITCH_EVENT_PRESSED);
 #endif
                        break;
+               case THINKPAD_NOTIFY_Bluetooth:
+                       thinkpad_bluetooth_toggle(sc);
+#ifndef THINKPAD_NORMAL_HOTKEYS
+                       if (sc->sc_smpsw_valid == false)
+                               break;
+                       sysmon_pswitch_event(&sc->sc_smpsw[TP_PSW_BLUETOOTH_BUTTON],
+                           PSWITCH_EVENT_PRESSED);
+#endif
+                       break;
                case THINKPAD_NOTIFY_wWANSwitch:
                        thinkpad_wwan_toggle(sc);
 #ifndef THINKPAD_NORMAL_HOTKEYS
@@ -543,6 +564,24 @@
                        sysmon_pswitch_event(&sc->sc_smpsw[TP_PSW_VOLUME_MUTE],
                            PSWITCH_EVENT_PRESSED);
                        break;
+               case THINKPAD_NOTIFY_Star:
+                       if (sc->sc_smpsw_valid == false)
+                               break;
+                       sysmon_pswitch_event(&sc->sc_smpsw[TP_PSW_STAR_BUTTON],
+                           PSWITCH_EVENT_PRESSED);
+                       break;
+               case THINKPAD_NOTIFY_Scissors:
+                       if (sc->sc_smpsw_valid == false)
+                               break;
+                       sysmon_pswitch_event(&sc->sc_smpsw[TP_PSW_SCISSORS_BUTTON],
+                           PSWITCH_EVENT_PRESSED);
+                       break;
+               case THINKPAD_NOTIFY_Keyboard:
+                       if (sc->sc_smpsw_valid == false)
+                               break;
+                       sysmon_pswitch_event(&sc->sc_smpsw[TP_PSW_KEYBOARD_BUTTON],
+                           PSWITCH_EVENT_PRESSED);
+                       break;
 #else
                case THINKPAD_NOTIFY_FnF1:
                case THINKPAD_NOTIFY_PointerSwitch:
@@ -552,6 +591,9 @@
                case THINKPAD_NOTIFY_VolumeUp:
                case THINKPAD_NOTIFY_VolumeDown:
                case THINKPAD_NOTIFY_VolumeMute:
+               case THINKPAD_NOTIFY_Star:
+               case THINKPAD_NOTIFY_Scissors:
+               case THINKPAD_NOTIFY_Keyboard:
                        /* XXXJDM we should deliver hotkeys as keycodes */
                        break;
 #endif /* THINKPAD_NORMAL_HOTKEYS */
diff -r 95f86b529fac -r d7a90d48363d sys/sys/power.h
--- a/sys/sys/power.h   Sat May 29 16:49:49 2021 +0000
+++ b/sys/sys/power.h   Sat May 29 16:49:57 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: power.h,v 1.21 2018/08/01 20:09:34 kre Exp $   */
+/*     $NetBSD: power.h,v 1.22 2021/05/29 16:49:57 riastradh Exp $     */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -114,6 +114,10 @@
 #define                PSWITCH_HK_VOLUME_UP            "volume-up"
 #define                PSWITCH_HK_VOLUME_DOWN          "volume-down"
 #define                PSWITCH_HK_VOLUME_MUTE          "volume-mute"
+#define                PSWITCH_HK_STAR_BUTTON          "star-button"
+#define                PSWITCH_HK_SCISSORS_BUTTON      "scissors-button"
+#define                PSWITCH_HK_BLUETOOTH_BUTTON     "bluetooth-button"
+#define                PSWITCH_HK_KEYBOARD_BUTTON      "keyboard-button"
 #endif /* THINKPAD_NORMAL_HOTKEYS */
 #define        PSWITCH_TYPE_RADIO      6       /* radio switch */
 



Home | Main Index | Thread Index | Old Index