Blame SOURCES/0008-dmioem-Sort-vendor-names-alphabetically.patch

60918b
From 6517fa7c8c8a74a9eae9e6192de316ef8952f2a8 Mon Sep 17 00:00:00 2001
60918b
From: Jean Delvare <jdelvare@suse.de>
60918b
Date: Thu, 14 Sep 2017 10:08:10 +0200
60918b
Subject: [PATCH 08/10] dmioem: Sort vendor names alphabetically
60918b
60918b
Signed-off-by: Jean Delvare <jdelvare@suse.de>
60918b
---
60918b
 dmioem.c | 92 ++++++++++++++++++++++++++++++++--------------------------------
60918b
 1 file changed, 46 insertions(+), 46 deletions(-)
60918b
60918b
diff --git a/dmioem.c b/dmioem.c
60918b
index a032344..8a72ac9 100644
60918b
--- a/dmioem.c
60918b
+++ b/dmioem.c
60918b
@@ -33,8 +33,8 @@
60918b
 enum DMI_VENDORS
60918b
 {
60918b
 	VENDOR_UNKNOWN,
60918b
-	VENDOR_HP,
60918b
 	VENDOR_ACER,
60918b
+	VENDOR_HP,
60918b
 	VENDOR_HPE,
60918b
 };
60918b
 
60918b
@@ -57,12 +57,54 @@ void dmi_set_vendor(const char *s)
60918b
 	while (len && s[len - 1] == ' ')
60918b
 		len--;
60918b
 
60918b
-	if (strncmp(s, "HP", len) == 0 || strncmp(s, "Hewlett-Packard", len) == 0)
60918b
+	if (strncmp(s, "Acer", len) == 0)
60918b
+		dmi_vendor = VENDOR_ACER;
60918b
+	else if (strncmp(s, "HP", len) == 0 || strncmp(s, "Hewlett-Packard", len) == 0)
60918b
 		dmi_vendor = VENDOR_HP;
60918b
 	else if (strncmp(s, "HPE", len) == 0 || strncmp(s, "Hewlett Packard Enterprise", len) == 0)
60918b
 		dmi_vendor = VENDOR_HPE;
60918b
-	else if (strncmp(s, "Acer", len) == 0)
60918b
-		dmi_vendor = VENDOR_ACER;
60918b
+}
60918b
+
60918b
+/*
60918b
+ * Acer-specific data structures are decoded here.
60918b
+ */
60918b
+
60918b
+static int dmi_decode_acer(const struct dmi_header *h)
60918b
+{
60918b
+	u8 *data = h->data;
60918b
+	u16 cap;
60918b
+
60918b
+	switch (h->type)
60918b
+	{
60918b
+		case 170:
60918b
+			/*
60918b
+			 * Vendor Specific: Acer Hotkey Function
60918b
+			 *
60918b
+			 * Source: acer-wmi kernel driver
60918b
+			 *
60918b
+			 * Probably applies to some laptop models of other
60918b
+			 * brands, including Fujitsu-Siemens, Medion, Lenovo,
60918b
+			 * and eMachines.
60918b
+			 */
60918b
+			printf("Acer Hotkey Function\n");
60918b
+			if (h->length < 0x0F) break;
60918b
+			cap = WORD(data + 0x04);
60918b
+			printf("\tFunction bitmap for Communication Button: 0x%04hx\n", cap);
60918b
+			printf("\t\tWiFi: %s\n", cap & 0x0001 ? "Yes" : "No");
60918b
+			printf("\t\t3G: %s\n", cap & 0x0040 ? "Yes" : "No");
60918b
+			printf("\t\tWiMAX: %s\n", cap & 0x0080 ? "Yes" : "No");
60918b
+			printf("\t\tBluetooth: %s\n", cap & 0x0800 ? "Yes" : "No");
60918b
+			printf("\tFunction bitmap for Application Button: 0x%04hx\n", WORD(data + 0x06));
60918b
+			printf("\tFunction bitmap for Media Button: 0x%04hx\n", WORD(data + 0x08));
60918b
+			printf("\tFunction bitmap for Display Button: 0x%04hx\n", WORD(data + 0x0A));
60918b
+			printf("\tFunction bitmap for Others Button: 0x%04hx\n", WORD(data + 0x0C));
60918b
+			printf("\tCommunication Function Key Number: %d\n", data[0x0E]);
60918b
+			break;
60918b
+
60918b
+		default:
60918b
+			return 0;
60918b
+	}
60918b
+	return 1;
60918b
 }
60918b
 
60918b
 /*
60918b
@@ -236,48 +278,6 @@ static int dmi_decode_hp(const struct dmi_header *h)
60918b
 }
60918b
 
60918b
 /*
60918b
- * Acer-specific data structures are decoded here.
60918b
- */
60918b
-
60918b
-static int dmi_decode_acer(const struct dmi_header *h)
60918b
-{
60918b
-	u8 *data = h->data;
60918b
-	u16 cap;
60918b
-
60918b
-	switch (h->type)
60918b
-	{
60918b
-		case 170:
60918b
-			/*
60918b
-			 * Vendor Specific: Acer Hotkey Function
60918b
-			 *
60918b
-			 * Source: acer-wmi kernel driver
60918b
-			 *
60918b
-			 * Probably applies to some laptop models of other
60918b
-			 * brands, including Fujitsu-Siemens, Medion, Lenovo,
60918b
-			 * and eMachines.
60918b
-			 */
60918b
-			printf("Acer Hotkey Function\n");
60918b
-			if (h->length < 0x0F) break;
60918b
-			cap = WORD(data + 0x04);
60918b
-			printf("\tFunction bitmap for Communication Button: 0x%04hx\n", cap);
60918b
-			printf("\t\tWiFi: %s\n", cap & 0x0001 ? "Yes" : "No");
60918b
-			printf("\t\t3G: %s\n", cap & 0x0040 ? "Yes" : "No");
60918b
-			printf("\t\tWiMAX: %s\n", cap & 0x0080 ? "Yes" : "No");
60918b
-			printf("\t\tBluetooth: %s\n", cap & 0x0800 ? "Yes" : "No");
60918b
-			printf("\tFunction bitmap for Application Button: 0x%04hx\n", WORD(data + 0x06));
60918b
-			printf("\tFunction bitmap for Media Button: 0x%04hx\n", WORD(data + 0x08));
60918b
-			printf("\tFunction bitmap for Display Button: 0x%04hx\n", WORD(data + 0x0A));
60918b
-			printf("\tFunction bitmap for Others Button: 0x%04hx\n", WORD(data + 0x0C));
60918b
-			printf("\tCommunication Function Key Number: %d\n", data[0x0E]);
60918b
-			break;
60918b
-
60918b
-		default:
60918b
-			return 0;
60918b
-	}
60918b
-	return 1;
60918b
-}
60918b
-
60918b
-/*
60918b
  * Dispatch vendor-specific entries decoding
60918b
  * Return 1 if decoding was successful, 0 otherwise
60918b
  */
60918b
-- 
60918b
2.9.5
60918b