Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/acpi/wmi Finally fix problem discussed in this old t...



details:   https://anonhg.NetBSD.org/src/rev/b56dfd98d7a1
branches:  trunk
changeset: 465816:b56dfd98d7a1
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Wed Dec 04 19:51:32 2019 +0000

description:
Finally fix problem discussed in this old thread:
http://mail-index.netbsd.org/tech-kern/2017/12/03/msg022661.html

Dell's radio hotkey sends a PMFE_RADIO_TOGGLE event, but nothing actually
listen to it.
Turn it into a PSWITCH_HK_WIRELESS_BUTTON hotkey, similar to
what thinkpad_acpi.c does.
Add type/subtypes seen on a Dell lattitude 5480 laptop.
XXX we need a PMFE_AUDIO_MICRO_TOGGLE, and something to handle it.

diffstat:

 sys/dev/acpi/wmi/wmi_dell.c |  29 +++++++++++++++++++++++------
 1 files changed, 23 insertions(+), 6 deletions(-)

diffs (80 lines):

diff -r fd6870f95147 -r b56dfd98d7a1 sys/dev/acpi/wmi/wmi_dell.c
--- a/sys/dev/acpi/wmi/wmi_dell.c       Wed Dec 04 16:55:30 2019 +0000
+++ b/sys/dev/acpi/wmi/wmi_dell.c       Wed Dec 04 19:51:32 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wmi_dell.c,v 1.11 2017/12/03 23:43:00 christos Exp $ */
+/*     $NetBSD: wmi_dell.c,v 1.12 2019/12/04 19:51:32 bouyer Exp $ */
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wmi_dell.c,v 1.11 2017/12/03 23:43:00 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wmi_dell.c,v 1.12 2019/12/04 19:51:32 bouyer Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -53,7 +53,8 @@
 ACPI_MODULE_NAME                       ("wmi_dell")
 
 #define WMI_DELL_PSW_DISPLAY_CYCLE     0
-#define WMI_DELL_PSW_COUNT             1
+#define WMI_DELL_PSW_RADIO_TOGGLE      1
+#define WMI_DELL_PSW_COUNT             2
 
 #define WMI_DELL_GUID_EVENT            "9DBB5994-A997-11DA-B012-B622A1EF5492"
 #define WMI_DELL_GUID_DESC             "8D9DDCBC-A997-11DA-B012-B622A1EF5492"
@@ -82,7 +83,7 @@
        {WMI_DELLA_PMF, 0x0000, 0xe006, PMFE_DISPLAY_BRIGHTNESS_UP},
        {WMI_DELLA_PSW, 0x0000, 0xe00b, WMI_DELL_PSW_DISPLAY_CYCLE},
 
-       {WMI_DELLA_PMF, 0x0000, 0xe008, PMFE_RADIO_TOGGLE},
+       {WMI_DELLA_PSW, 0x0000, 0xe008, WMI_DELL_PSW_RADIO_TOGGLE},
        {WMI_DELLA_IGN, 0x0000, 0xe00c, 0}, /* keyboard illumination */
 
        /* volume control */
@@ -96,14 +97,16 @@
        /* type 0x10 */
        {WMI_DELLA_PMF, 0x0010, 0x0057, PMFE_DISPLAY_BRIGHTNESS_DOWN},
        {WMI_DELLA_PMF, 0x0010, 0x0058, PMFE_DISPLAY_BRIGHTNESS_UP},
+       {WMI_DELLA_IGN, 0x0010, 0x0150, 0}, /* XXX microphone toggle */
        {WMI_DELLA_IGN, 0x0010, 0x0151, 0}, /* Fn-lock */
        {WMI_DELLA_IGN, 0x0010, 0x0152, 0}, /* keyboard illumination */
-       {WMI_DELLA_PMF, 0x0010, 0x0153, PMFE_RADIO_TOGGLE},
+       {WMI_DELLA_PSW, 0x0010, 0x0153, WMI_DELL_PSW_RADIO_TOGGLE},
        {WMI_DELLA_IGN, 0x0010, 0x0155, 0}, /* Stealth mode toggle */
+       {WMI_DELLA_PSW, 0x0010, 0xE008, WMI_DELL_PSW_RADIO_TOGGLE},
        {WMI_DELLA_IGN, 0x0010, 0xE035, 0}, /* Fn-lock */
 
        /* type 0x11 */
-       {WMI_DELLA_IGN, 0x0011, 0x02eb5, 0}, /* keyboard illumination */
+       {WMI_DELLA_IGN, 0x0011, 0x02eb, 0}, /* keyboard illumination */
 };
 
 static int     wmi_dell_match(device_t, cfdata_t, void *);
@@ -182,9 +185,23 @@
 
        e = sysmon_pswitch_register(&sc->sc_smpsw[WMI_DELL_PSW_DISPLAY_CYCLE]);
 
+       if (e != 0) {
+               sc->sc_smpsw_valid = false;
+               goto end;
+       }
+
+       sc->sc_smpsw[WMI_DELL_PSW_RADIO_TOGGLE].smpsw_name =
+           PSWITCH_HK_WIRELESS_BUTTON;
+
+       sc->sc_smpsw[WMI_DELL_PSW_RADIO_TOGGLE].smpsw_type =
+           PSWITCH_TYPE_HOTKEY;
+
+       e = sysmon_pswitch_register(&sc->sc_smpsw[WMI_DELL_PSW_RADIO_TOGGLE]);
+
        if (e != 0)
                sc->sc_smpsw_valid = false;
 
+end:
        (void)pmf_device_register(self, wmi_dell_suspend, wmi_dell_resume);
 }
 



Home | Main Index | Thread Index | Old Index