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>] [day] [month] [year] [list]
Message-ID: <51A491A3.5080702@canonical.com>
Date:	Tue, 28 May 2013 19:14:43 +0800
From:	Bruce <bruce.ma@...onical.com>
To:	platform-driver-x86@...r.kernel.org
CC:	ibm-acpi-devel@...ts.sourceforge.net,
	Henrique de Moraes Holschuh <ibm-acpi@....eng.br>,
	linux-kernel@...r.kernel.org
Subject: [PATCH] subsystem:  thinkpad-acpi.c

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

from: Bruce Ma

For some specific model of laptop, don't execute any led functions.

Signed-off-by: Bruce Ma <bruce.ma@...onical.com>
- ---

- --- old/thinkpad_acpi.c    2013-01-29 16:54:34.000000000 +0800
+++ src/thinkpad_acpi.c    2013-01-29 16:52:46.000000000 +0800
@@ -1787,6 +1787,90 @@ static const struct tpacpi_quirk tpacpi_
 #undef TPV_Q_X
 #undef TPV_Q
 +/*
+check tpacpi_check_model()
+
+ * Model Name   , Number Model Name
+ * Lenovo LM490s, 814YG01
+
+ "dmesg | grep thinkpad_acpi" shows:
+ thinkpad_acpi: Lenovo Lenovo LM490s,      model 814YG01
+
+ How to add new model to blacklist:
+ Add these lines like below into lenovo_blacklist[].
+   {
+    .model_s = "Lenovo K490s",
+    .nummodel_s = "814YJ01",
+   },
+ */
+
+unsigned int no_led = 0 ;
+
+struct blacklist {
+  struct list_head blist;
+  char *model_s;
+  char *nummodel_s;
+};
+
+struct blacklist led_blacklist = {
+  .model_s = NULL,
+  .nummodel_s = NULL,
+};
+
+struct blacklist lenovo_blacklist[] = {
+  {
+    .model_s = "Lenovo LM490s",
+    .nummodel_s = "814YG01",
+  },
+  {
+    .model_s = "ThinkPad Edge E430",
+    .nummodel_s = "3254TNU",
+  },
+  {
+    .model_s = "LENOVO",
+    .nummodel_s = "914TK01",
+  },
+  {
+    .model_s = "ThinkPad Twist",
+    .nummodel_s = "334724C",
+  },
+  {
+    .model_s = "Lenovo M490s",
+    .nummodel_s = "914YG01",
+  },
+  {
+    .model_s = "Lenovo K490s",
+    .nummodel_s = "814YJ01",
+  },
+};
+
+static int __init tpacpi_check_model(void)
+{
+  unsigned int i ;
+  struct blacklist *list_p;
+
+  /* If thinkpad_id.nummodel_str is "unkown". */
+  if (!thinkpad_id.nummodel_str) {
+    return 1;
+  }
+
+  INIT_LIST_HEAD(&led_blacklist.blist);
+
+  for(i = 0; i < ARRAY_SIZE(lenovo_blacklist) ; i++) {
+    INIT_LIST_HEAD(&lenovo_blacklist[i].blist);
+    list_add(&lenovo_blacklist[i].blist, &led_blacklist.blist);
+  }
+
+  list_for_each_entry(list_p,&led_blacklist.blist,blist) {
+    if (!strcmp(list_p->model_s,thinkpad_id.model_str)
+                  &&
!strcmp(list_p->nummodel_s,thinkpad_id.nummodel_str)) {
+      no_led = 1;
+      pr_info("Disable led support for this model.\n");
+    }
+  }
+  return 0;
+}
+
 static void __init tpacpi_check_outdated_fw(void)
 {
     unsigned long fwvers;
@@ -5235,6 +5319,10 @@ static enum led_brightness led_sysfs_get
  static void led_exit(void)
 {
+        if (no_led == 1 ) {
+                 return 0;
+  }
+
     unsigned int i;
      for (i = 0; i < TPACPI_LED_NUMLEDS; i++) {
@@ -5349,6 +5437,10 @@ static enum led_access_mode __init led_i
  static int __init led_init(struct ibm_init_struct *iibm)
 {
+        if (no_led == 1 ) {
+           return 0;
+        }
+
     unsigned int i;
     int rc;
     unsigned long useful_leds;
@@ -5397,6 +5489,10 @@ static int __init led_init(struct ibm_in
  static int led_read(struct seq_file *m)
 {
+        if (no_led == 1 ) {
+                return 0;
+        }
+
     if (!led_supported) {
         seq_printf(m, "status:\t\tnot supported\n");
         return 0;
@@ -5423,6 +5519,10 @@ static int led_read(struct seq_file *m)
  static int led_write(char *buf)
 {
+        if (no_led == 1 ) {
+                return 0;
+        }
+
     char *cmd;
     int led, rc;
     enum led_status_t s;
@@ -9031,6 +9131,9 @@ static int __init thinkpad_acpi_module_i
     /* Driver initialization */
      thinkpad_acpi_init_banner();
+
+    tpacpi_check_model();
+
     tpacpi_check_outdated_fw();
      TPACPI_ACPIHANDLE_INIT(ecrd);



- ---
Bruce Ma
May 28,2013


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBAgAGBQJRpJGjAAoJEFnPatyLvGg1rnMIAKqffR2XgBQfIaUv+Zqa3OE4
38KGwctvA/qxiFHtxQ7sMJFiiQ01/WskfCVJeWgkh7bDtJt14/Nd5bpCEnjHDBSZ
byqcziONeGt5o1yAXRAP2artuPwpIrdoRK3WYY9ODK+wJBFMb2wEc4EUuyfT5RAM
ASNzal+UjZyqL/UT9vfwtiN4OxuIlJ2BHeTP8jRElYZux2nEUvjtP0Wqwq7Otybc
ud6/p+Ldn1OOEJt+2sBBzdDo75mjOrewJxIsdZyHZoNnXPPZLnftvCM/k/mkEVw4
+ElZEDDVJWKGHqzqiHPKnaJRCqrnEw3t1u1C5hEK7hGn/PVtdYflV78CoimGG5Q=
=nLc0
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ