Blob Blame History Raw
From 6517fa7c8c8a74a9eae9e6192de316ef8952f2a8 Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Thu, 14 Sep 2017 10:08:10 +0200
Subject: [PATCH 08/10] dmioem: Sort vendor names alphabetically

Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
 dmioem.c | 92 ++++++++++++++++++++++++++++++++--------------------------------
 1 file changed, 46 insertions(+), 46 deletions(-)

diff --git a/dmioem.c b/dmioem.c
index a032344..8a72ac9 100644
--- a/dmioem.c
+++ b/dmioem.c
@@ -33,8 +33,8 @@
 enum DMI_VENDORS
 {
 	VENDOR_UNKNOWN,
-	VENDOR_HP,
 	VENDOR_ACER,
+	VENDOR_HP,
 	VENDOR_HPE,
 };
 
@@ -57,12 +57,54 @@ void dmi_set_vendor(const char *s)
 	while (len && s[len - 1] == ' ')
 		len--;
 
-	if (strncmp(s, "HP", len) == 0 || strncmp(s, "Hewlett-Packard", len) == 0)
+	if (strncmp(s, "Acer", len) == 0)
+		dmi_vendor = VENDOR_ACER;
+	else if (strncmp(s, "HP", len) == 0 || strncmp(s, "Hewlett-Packard", len) == 0)
 		dmi_vendor = VENDOR_HP;
 	else if (strncmp(s, "HPE", len) == 0 || strncmp(s, "Hewlett Packard Enterprise", len) == 0)
 		dmi_vendor = VENDOR_HPE;
-	else if (strncmp(s, "Acer", len) == 0)
-		dmi_vendor = VENDOR_ACER;
+}
+
+/*
+ * 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("\tFunction bitmap for Communication Button: 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("\tFunction bitmap for Application Button: 0x%04hx\n", WORD(data + 0x06));
+			printf("\tFunction bitmap for Media Button: 0x%04hx\n", WORD(data + 0x08));
+			printf("\tFunction bitmap for Display Button: 0x%04hx\n", WORD(data + 0x0A));
+			printf("\tFunction bitmap for Others Button: 0x%04hx\n", WORD(data + 0x0C));
+			printf("\tCommunication Function Key Number: %d\n", data[0x0E]);
+			break;
+
+		default:
+			return 0;
+	}
+	return 1;
 }
 
 /*
@@ -236,48 +278,6 @@ static int dmi_decode_hp(const struct dmi_header *h)
 }
 
 /*
- * 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("\tFunction bitmap for Communication Button: 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("\tFunction bitmap for Application Button: 0x%04hx\n", WORD(data + 0x06));
-			printf("\tFunction bitmap for Media Button: 0x%04hx\n", WORD(data + 0x08));
-			printf("\tFunction bitmap for Display Button: 0x%04hx\n", WORD(data + 0x0A));
-			printf("\tFunction bitmap for Others Button: 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
  */
-- 
2.9.5