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

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