dmidecode-devel
[Top][All Lists]
Advanced

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

[dmidecode] [PATCH] dmidecode: Decode Acer-specific type 170


From: Jean Delvare
Subject: [dmidecode] [PATCH] dmidecode: Decode Acer-specific type 170
Date: Thu, 30 Apr 2015 11:28:20 +0200

Some information about OEM DMI type 170 for Acer machines is available
from the acer-wmi kernel driver. Include the available information in
the output of dmidecode.
---
Sample output:

Handle 0x0012, DMI type 170, 50 bytes
Acer Hotkey Function
        Communication Button Function Bitmap: 0x0801
                WiFi: Yes
                3G: No
                WiMAX: No
                Bluetooth: Yes
        Application Button Function Bitmap: 0x0000
        Media Button Function Bitmap: 0x0007
        Display Button Function Bitmap: 0x000f
        Other Button Functions Bitmap: 0x0002
        Communication Function Key Number: 1

Joey, please let me know if you think the wording or output can be
improved in any way.

 dmioem.c |   53 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 52 insertions(+), 1 deletion(-)

--- dmidecode.orig/dmioem.c     2015-04-30 10:41:36.374066050 +0200
+++ dmidecode/dmioem.c  2015-04-30 10:46:21.169059058 +0200
@@ -30,7 +30,12 @@
  * Globals for vendor-specific decodes
  */
 
-enum DMI_VENDORS { VENDOR_UNKNOWN, VENDOR_HP };
+enum DMI_VENDORS
+{
+       VENDOR_UNKNOWN,
+       VENDOR_HP,
+       VENDOR_ACER,
+};
 
 static enum DMI_VENDORS dmi_vendor = VENDOR_UNKNOWN;
 
@@ -53,6 +58,8 @@ void dmi_set_vendor(const char *s)
 
        if (strncmp(s, "HP", len) == 0 || strncmp(s, "Hewlett-Packard", len) == 
0)
                dmi_vendor = VENDOR_HP;
+       else if (strncmp(s, "Acer", len) == 0)
+               dmi_vendor = VENDOR_ACER;
 }
 
 /*
@@ -124,6 +131,48 @@ static int dmi_decode_hp(const struct dm
 }
 
 /*
+ * Acer-specific data structures are decoded here.
+ */
+
+static int dmi_decode_acer(const struct dmi_header *h)
+{
+       u8 *data = h->data;
+       u16 cap;
+
+       switch (h->type)
+       {
+               case 170:
+                       /*
+                        * Vendor Specific: Acer Hotkey Function
+                        *
+                        * Source: acer-wmi kernel driver
+                        *
+                        * Probably applies to some laptop models of other
+                        * brands, including Fujitsu-Siemens, Medion, Lenovo,
+                        * and eMachines.
+                        */
+                       printf("Acer Hotkey Function\n");
+                       if (h->length < 0x0F) break;
+                       cap = WORD(data + 0x04);
+                       printf("\tCommunication Button Function Bitmap: 
0x%04hx\n", cap);
+                       printf("\t\tWiFi: %s\n", cap & 0x0001 ? "Yes" : "No");
+                       printf("\t\t3G: %s\n", cap & 0x0040 ? "Yes" : "No");
+                       printf("\t\tWiMAX: %s\n", cap & 0x0080 ? "Yes" : "No");
+                       printf("\t\tBluetooth: %s\n", cap & 0x0800 ? "Yes" : 
"No");
+                       printf("\tApplication Button Function Bitmap: 
0x%04hx\n", WORD(data + 0x06));
+                       printf("\tMedia Button Function Bitmap: 0x%04hx\n", 
WORD(data + 0x08));
+                       printf("\tDisplay Button Function Bitmap: 0x%04hx\n", 
WORD(data + 0x0A));
+                       printf("\tOther Button Functions Bitmap: 0x%04hx\n", 
WORD(data + 0x0C));
+                       printf("\tCommunication Function Key Number: %d\n", 
data[0x0E]);
+                       break;
+
+               default:
+                       return 0;
+       }
+       return 1;
+}
+
+/*
  * Dispatch vendor-specific entries decoding
  * Return 1 if decoding was successful, 0 otherwise
  */
@@ -133,6 +182,8 @@ int dmi_decode_oem(const struct dmi_head
        {
                case VENDOR_HP:
                        return dmi_decode_hp(h);
+               case VENDOR_ACER:
+                       return dmi_decode_acer(h);
                default:
                        return 0;
        }


-- 
Jean Delvare
SUSE L3 Support



reply via email to

[Prev in Thread] Current Thread [Next in Thread]