From 7960816020bbd94b1c2f0ff75f73b25927717875 Mon Sep 17 00:00:00 2001
From: Dylan Van Assche <me@dylanvanassche.be>
Date: Fri, 11 Jun 2021 20:18:44 +0200
Subject: [PATCH] hostname: Use phone class for handhelds

Advertise devices with chassis type 'handheld'
as phone instead of computer.
---
 plugins/hostname.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/plugins/hostname.c b/plugins/hostname.c
index 1a9513adb..85c342d36 100644
--- a/plugins/hostname.c
+++ b/plugins/hostname.c
@@ -31,6 +31,7 @@
 
 #define MAJOR_CLASS_MISCELLANEOUS	0x00
 #define MAJOR_CLASS_COMPUTER		0x01
+#define MAJOR_CLASS_PHONE		0x02
 
 #define MINOR_CLASS_UNCATEGORIZED	0x00
 #define MINOR_CLASS_DESKTOP		0x01
@@ -40,6 +41,7 @@
 #define MINOR_CLASS_PALM_SIZED		0x05
 #define MINOR_CLASS_WEARABLE		0x06
 #define MINOR_CLASS_TABLET		0x07
+#define MINOR_CLASS_SMARTPHONE		0x03
 
 static uint8_t major_class = MAJOR_CLASS_MISCELLANEOUS;
 static uint8_t minor_class = MINOR_CLASS_UNCATEGORIZED;
@@ -106,11 +108,11 @@ static const struct {
 	uint8_t major_class;
 	uint8_t minor_class;
 } chassis_table[] = {
-	{ "desktop",  MAJOR_CLASS_COMPUTER, MINOR_CLASS_DESKTOP  },
-	{ "server",   MAJOR_CLASS_COMPUTER, MINOR_CLASS_SERVER   },
-	{ "laptop",   MAJOR_CLASS_COMPUTER, MINOR_CLASS_LAPTOP   },
-	{ "handset",  MAJOR_CLASS_COMPUTER, MINOR_CLASS_HANDHELD },
-	{ "tablet",   MAJOR_CLASS_COMPUTER, MINOR_CLASS_TABLET   },
+	{ "desktop",  MAJOR_CLASS_COMPUTER, MINOR_CLASS_DESKTOP    },
+	{ "server",   MAJOR_CLASS_COMPUTER, MINOR_CLASS_SERVER     },
+	{ "laptop",   MAJOR_CLASS_COMPUTER, MINOR_CLASS_LAPTOP     },
+	{ "handset",  MAJOR_CLASS_PHONE,    MINOR_CLASS_SMARTPHONE },
+	{ "tablet",   MAJOR_CLASS_COMPUTER, MINOR_CLASS_TABLET     },
 	{ }
 };
 
-- 
2.31.1

