lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20170126153013.12753-9-jprvita@endlessm.com>
Date:   Thu, 26 Jan 2017 10:30:13 -0500
From:   "João Paulo Rechi Vita" <jprvita@...il.com>
To:     Corentin Chary <corentin.chary@...il.com>,
        Darren Hart <dvhart@...radead.org>
Cc:     platform-driver-x86@...r.kernel.org,
        acpi4asus-user@...ts.sourceforge.net, linux-kernel@...r.kernel.org,
        linux@...lessm.com,
        João Paulo Rechi Vita <jprvita@...lessm.com>
Subject: [PATCH 8/8] asus-wmi: Don't register rfkill if ASHS and user bit are present

Some Asus laptops that have an airplane-mode indicator LED, also have
the WMI WLAN user bit set, and the following bits in their DSDT:

    Scope (_SB)
    {
      (...)
      Device (ATKD)
      {
        (...)
        Method (WMNB, 3, Serialized)
        {
          (...)
          If (LEqual (IIA0, 0x00010002))
          {
            OWGD (IIA1)
            Return (One)
          }
        }
      }
    }

So when asus-wmi uses ASUS_WMI_DEVID_WLAN_LED (0x00010002) to store the
wlan state, it drives the airplane-mode indicator LED (through the call
to OWGD) in an inverted fashion: the LED is ON when airplane mode is OFF
(since wlan is ON), and vice-versa.

This skips registering RFKill switches at all for these laptops, to
allow the asus-wireless driver to drive the airplane mode LED correctly
through the ASHS ACPI device. Relying on the presence of ASHS and
ASUS_WMI_DSTS_USER_BIT avoids adding DMI-based quirks for at least 21
different laptops.

Signed-off-by: João Paulo Rechi Vita <jprvita@...lessm.com>
---
 drivers/platform/x86/asus-wmi.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c
index da3b12c131ce..645204865a3f 100644
--- a/drivers/platform/x86/asus-wmi.c
+++ b/drivers/platform/x86/asus-wmi.c
@@ -49,6 +49,7 @@
 #include <linux/dmi.h>
 #include <acpi/video.h>
 
+#include "asus-wireless.h"
 #include "asus-wmi.h"
 
 MODULE_AUTHOR("Corentin Chary <corentin.chary@...il.com>, "
@@ -2051,6 +2052,16 @@ static int asus_wmi_fan_init(struct asus_wmi *asus)
 	return 0;
 }
 
+static bool ashs_present(void)
+{
+	int i;
+
+	for (i = 0; strcmp(asus_wireless_ids[i].id, ""); i++)
+		if (acpi_dev_found(asus_wireless_ids[i].id))
+			return true;
+	return false;
+}
+
 /*
  * WMI Driver
  */
@@ -2095,9 +2106,15 @@ static int asus_wmi_add(struct platform_device *pdev)
 	if (err)
 		goto fail_leds;
 
-	err = asus_wmi_rfkill_init(asus);
-	if (err)
-		goto fail_rfkill;
+	asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_WLAN, &result);
+	if (result & (ASUS_WMI_DSTS_PRESENCE_BIT | ASUS_WMI_DSTS_USER_BIT))
+		asus->driver->wlan_ctrl_by_user = 1;
+
+	if (!(asus->driver->wlan_ctrl_by_user && ashs_present())) {
+		err = asus_wmi_rfkill_init(asus);
+		if (err)
+			goto fail_rfkill;
+	}
 
 	/* Some Asus desktop boards export an acpi-video backlight interface,
 	   stop this from showing up */
@@ -2132,10 +2149,6 @@ static int asus_wmi_add(struct platform_device *pdev)
 	if (err)
 		goto fail_debugfs;
 
-	asus_wmi_get_devstate(asus, ASUS_WMI_DEVID_WLAN, &result);
-	if (result & (ASUS_WMI_DSTS_PRESENCE_BIT | ASUS_WMI_DSTS_USER_BIT))
-		asus->driver->wlan_ctrl_by_user = 1;
-
 	return 0;
 
 fail_debugfs:
-- 
2.11.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ