Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Jan 2018 17:31:31 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r328219 - head/sys/dev/usb/template
Message-ID:  <201801211731.w0LHVVQS048416@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Sun Jan 21 17:31:31 2018
New Revision: 328219
URL: https://svnweb.freebsd.org/changeset/base/328219

Log:
  Add missing manufacturer/serial number string descriptors.
  
  MFC after:	2 weeks
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/dev/usb/template/usb_template_audio.c
  head/sys/dev/usb/template/usb_template_kbd.c
  head/sys/dev/usb/template/usb_template_midi.c
  head/sys/dev/usb/template/usb_template_modem.c
  head/sys/dev/usb/template/usb_template_mouse.c
  head/sys/dev/usb/template/usb_template_phone.c

Modified: head/sys/dev/usb/template/usb_template_audio.c
==============================================================================
--- head/sys/dev/usb/template/usb_template_audio.c	Sun Jan 21 15:42:36 2018	(r328218)
+++ head/sys/dev/usb/template/usb_template_audio.c	Sun Jan 21 17:31:31 2018	(r328219)
@@ -72,19 +72,25 @@ enum {
 	AUDIO_MIXER_INDEX,
 	AUDIO_RECORD_INDEX,
 	AUDIO_PLAYBACK_INDEX,
+	AUDIO_MANUFACTURER_INDEX,
 	AUDIO_PRODUCT_INDEX,
+	AUDIO_SERIAL_NUMBER_INDEX,
 	AUDIO_MAX_INDEX,
 };
 
-#define	AUDIO_DEFAULT_PRODUCT		"Audio Test Device"
 #define	AUDIO_DEFAULT_MIXER		"Mixer interface"
 #define	AUDIO_DEFAULT_RECORD		"Record interface"
 #define	AUDIO_DEFAULT_PLAYBACK		"Playback interface"
+#define	AUDIO_DEFAULT_MANUFACTURER	"FreeBSD foundation"
+#define	AUDIO_DEFAULT_PRODUCT		"Audio Test Device"
+#define	AUDIO_DEFAULT_SERIAL_NUMBER	"March 2008"
 
 static struct usb_string_descriptor	audio_mixer;
 static struct usb_string_descriptor	audio_record;
 static struct usb_string_descriptor	audio_playback;
+static struct usb_string_descriptor	audio_manufacturer;
 static struct usb_string_descriptor	audio_product;
+static struct usb_string_descriptor	audio_serial_number;
 
 static struct sysctl_ctx_list		audio_ctx_list;
 
@@ -364,7 +370,9 @@ struct usb_temp_device_desc usb_template_audio = {
 	.bDeviceClass = UDCLASS_COMM,
 	.bDeviceSubClass = 0,
 	.bDeviceProtocol = 0,
+	.iManufacturer = AUDIO_MANUFACTURER_INDEX,
 	.iProduct = AUDIO_PRODUCT_INDEX,
+	.iSerialNumber = AUDIO_SERIAL_NUMBER_INDEX,
 };
 
 /*------------------------------------------------------------------------*
@@ -382,7 +390,9 @@ audio_get_string_desc(uint16_t lang_id, uint8_t string
 		[AUDIO_MIXER_INDEX] = &audio_mixer,
 		[AUDIO_RECORD_INDEX] = &audio_record,
 		[AUDIO_PLAYBACK_INDEX] = &audio_playback,
+		[AUDIO_MANUFACTURER_INDEX] = &audio_manufacturer,
 		[AUDIO_PRODUCT_INDEX] = &audio_product,
+		[AUDIO_SERIAL_NUMBER_INDEX] = &audio_serial_number,
 	};
 
 	if (string_index == 0) {
@@ -409,8 +419,12 @@ audio_init(void *arg __unused)
 	    AUDIO_DEFAULT_RECORD);
 	usb_make_str_desc(&audio_playback, sizeof(audio_playback),
 	    AUDIO_DEFAULT_PLAYBACK);
+	usb_make_str_desc(&audio_manufacturer, sizeof(audio_manufacturer),
+	    AUDIO_DEFAULT_MANUFACTURER);
 	usb_make_str_desc(&audio_product, sizeof(audio_product),
 	    AUDIO_DEFAULT_PRODUCT);
+	usb_make_str_desc(&audio_serial_number, sizeof(audio_serial_number),
+	    AUDIO_DEFAULT_SERIAL_NUMBER);
 
 	snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_AUDIO);
 	sysctl_ctx_init(&audio_ctx_list);
@@ -440,9 +454,17 @@ audio_init(void *arg __unused)
 	    "A", "Playback interface string");
 #endif
 	SYSCTL_ADD_PROC(&audio_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
+	    "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &audio_manufacturer, sizeof(audio_manufacturer), usb_temp_sysctl,
+	    "A", "Manufacturer string");
+	SYSCTL_ADD_PROC(&audio_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
 	    "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
 	    &audio_product, sizeof(audio_product), usb_temp_sysctl,
 	    "A", "Product string");
+	SYSCTL_ADD_PROC(&audio_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
+	    "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &audio_serial_number, sizeof(audio_serial_number), usb_temp_sysctl,
+	    "A", "Serial number string");
 }
 
 static void

Modified: head/sys/dev/usb/template/usb_template_kbd.c
==============================================================================
--- head/sys/dev/usb/template/usb_template_kbd.c	Sun Jan 21 15:42:36 2018	(r328218)
+++ head/sys/dev/usb/template/usb_template_kbd.c	Sun Jan 21 17:31:31 2018	(r328219)
@@ -70,15 +70,21 @@
 enum {
 	KBD_LANG_INDEX,
 	KBD_INTERFACE_INDEX,
+	KBD_MANUFACTURER_INDEX,
 	KBD_PRODUCT_INDEX,
+	KBD_SERIAL_NUMBER_INDEX,
 	KBD_MAX_INDEX,
 };
 
 #define	KBD_DEFAULT_INTERFACE		"Keyboard Interface"
+#define	KBD_DEFAULT_MANUFACTURER	"FreeBSD foundation"
 #define	KBD_DEFAULT_PRODUCT		"Keyboard Test Device"
+#define	KBD_DEFAULT_SERIAL_NUMBER	"March 2008"
 
 static struct usb_string_descriptor	kbd_interface;
+static struct usb_string_descriptor	kbd_manufacturer;
 static struct usb_string_descriptor	kbd_product;
+static struct usb_string_descriptor	kbd_serial_number;
 
 static struct sysctl_ctx_list		kbd_ctx_list;
 
@@ -172,9 +178,9 @@ struct usb_temp_device_desc usb_template_kbd = {
 	.bDeviceClass = UDCLASS_COMM,
 	.bDeviceSubClass = 0,
 	.bDeviceProtocol = 0,
-	.iManufacturer = 0,
+	.iManufacturer = KBD_MANUFACTURER_INDEX,
 	.iProduct = KBD_PRODUCT_INDEX,
-	.iSerialNumber = 0,
+	.iSerialNumber = KBD_SERIAL_NUMBER_INDEX,
 };
 
 /*------------------------------------------------------------------------*
@@ -210,7 +216,9 @@ keyboard_get_string_desc(uint16_t lang_id, uint8_t str
 	static const void *ptr[KBD_MAX_INDEX] = {
 		[KBD_LANG_INDEX] = &usb_string_lang_en,
 		[KBD_INTERFACE_INDEX] = &kbd_interface,
+		[KBD_MANUFACTURER_INDEX] = &kbd_manufacturer,
 		[KBD_PRODUCT_INDEX] = &kbd_product,
+		[KBD_SERIAL_NUMBER_INDEX] = &kbd_serial_number,
 	};
 
 	if (string_index == 0) {
@@ -233,8 +241,12 @@ kbd_init(void *arg __unused)
 
 	usb_make_str_desc(&kbd_interface, sizeof(kbd_interface),
 	    KBD_DEFAULT_INTERFACE);
+	usb_make_str_desc(&kbd_manufacturer, sizeof(kbd_manufacturer),
+	    KBD_DEFAULT_MANUFACTURER);
 	usb_make_str_desc(&kbd_product, sizeof(kbd_product),
 	    KBD_DEFAULT_PRODUCT);
+	usb_make_str_desc(&kbd_serial_number, sizeof(kbd_serial_number),
+	    KBD_DEFAULT_SERIAL_NUMBER);
 
 	snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_KBD);
 	sysctl_ctx_init(&kbd_ctx_list);
@@ -256,9 +268,17 @@ kbd_init(void *arg __unused)
 	    "A", "Interface string");
 #endif
 	SYSCTL_ADD_PROC(&kbd_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
+	    "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &kbd_manufacturer, sizeof(kbd_manufacturer), usb_temp_sysctl,
+	    "A", "Manufacturer string");
+	SYSCTL_ADD_PROC(&kbd_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
 	    "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
 	    &kbd_product, sizeof(kbd_product), usb_temp_sysctl,
 	    "A", "Product string");
+	SYSCTL_ADD_PROC(&kbd_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
+	    "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &kbd_serial_number, sizeof(kbd_serial_number), usb_temp_sysctl,
+	    "A", "Serial number string");
 }
 
 static void

Modified: head/sys/dev/usb/template/usb_template_midi.c
==============================================================================
--- head/sys/dev/usb/template/usb_template_midi.c	Sun Jan 21 15:42:36 2018	(r328218)
+++ head/sys/dev/usb/template/usb_template_midi.c	Sun Jan 21 17:31:31 2018	(r328219)
@@ -69,15 +69,21 @@
 enum {
 	MIDI_LANG_INDEX,
 	MIDI_INTERFACE_INDEX,
+	MIDI_MANUFACTURER_INDEX,
 	MIDI_PRODUCT_INDEX,
+	MIDI_SERIAL_NUMBER_INDEX,
 	MIDI_MAX_INDEX,
 };
 
 #define	MIDI_DEFAULT_INTERFACE		"MIDI interface"
+#define	MIDI_DEFAULT_MANUFACTURER	"FreeBSD foundation"
 #define	MIDI_DEFAULT_PRODUCT		"MIDI Test Device"
+#define	MIDI_DEFAULT_SERIAL_NUMBER	"March 2008"
 
 static struct usb_string_descriptor	midi_interface;
+static struct usb_string_descriptor	midi_manufacturer;
 static struct usb_string_descriptor	midi_product;
+static struct usb_string_descriptor	midi_serial_number;
 
 static struct sysctl_ctx_list		midi_ctx_list;
 
@@ -212,9 +218,9 @@ struct usb_temp_device_desc usb_template_midi = {
 	.bDeviceClass = 0,
 	.bDeviceSubClass = 0,
 	.bDeviceProtocol = 0,
-	.iManufacturer = 0,
+	.iManufacturer = MIDI_MANUFACTURER_INDEX,
 	.iProduct = MIDI_PRODUCT_INDEX,
-	.iSerialNumber = 0,
+	.iSerialNumber = MIDI_SERIAL_NUMBER_INDEX,
 };
 
 /*------------------------------------------------------------------------*
@@ -230,7 +236,9 @@ midi_get_string_desc(uint16_t lang_id, uint8_t string_
 	static const void *ptr[MIDI_MAX_INDEX] = {
 		[MIDI_LANG_INDEX] = &usb_string_lang_en,
 		[MIDI_INTERFACE_INDEX] = &midi_interface,
+		[MIDI_MANUFACTURER_INDEX] = &midi_manufacturer,
 		[MIDI_PRODUCT_INDEX] = &midi_product,
+		[MIDI_SERIAL_NUMBER_INDEX] = &midi_serial_number,
 	};
 
 	if (string_index == 0) {
@@ -253,8 +261,12 @@ midi_init(void *arg __unused)
 
 	usb_make_str_desc(&midi_interface, sizeof(midi_interface),
 	    MIDI_DEFAULT_INTERFACE);
+	usb_make_str_desc(&midi_manufacturer, sizeof(midi_manufacturer),
+	    MIDI_DEFAULT_MANUFACTURER);
 	usb_make_str_desc(&midi_product, sizeof(midi_product),
 	    MIDI_DEFAULT_PRODUCT);
+	usb_make_str_desc(&midi_serial_number, sizeof(midi_serial_number),
+	    MIDI_DEFAULT_SERIAL_NUMBER);
 
 	snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_MIDI);
 	sysctl_ctx_init(&midi_ctx_list);
@@ -276,9 +288,17 @@ midi_init(void *arg __unused)
 	    "A", "Interface string");
 #endif
 	SYSCTL_ADD_PROC(&midi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
+	    "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &midi_manufacturer, sizeof(midi_manufacturer), usb_temp_sysctl,
+	    "A", "Manufacturer string");
+	SYSCTL_ADD_PROC(&midi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
 	    "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
 	    &midi_product, sizeof(midi_product), usb_temp_sysctl,
 	    "A", "Product string");
+	SYSCTL_ADD_PROC(&midi_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
+	    "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &midi_serial_number, sizeof(midi_serial_number), usb_temp_sysctl,
+	    "A", "Serial number string");
 }
 
 static void

Modified: head/sys/dev/usb/template/usb_template_modem.c
==============================================================================
--- head/sys/dev/usb/template/usb_template_modem.c	Sun Jan 21 15:42:36 2018	(r328218)
+++ head/sys/dev/usb/template/usb_template_modem.c	Sun Jan 21 17:31:31 2018	(r328219)
@@ -70,15 +70,21 @@
 enum {
 	MODEM_LANG_INDEX,
 	MODEM_INTERFACE_INDEX,
+	MODEM_MANUFACTURER_INDEX,
 	MODEM_PRODUCT_INDEX,
+	MODEM_SERIAL_NUMBER_INDEX,
 	MODEM_MAX_INDEX,
 };
 
 #define	MODEM_DEFAULT_INTERFACE		"Modem interface"
+#define	MODEM_DEFAULT_MANUFACTURER	"FreeBSD foundation"
 #define MODEM_DEFAULT_PRODUCT		"Modem Test Device"
+#define	MODEM_DEFAULT_SERIAL_NUMBER	"March 2008"
 
 static struct usb_string_descriptor	modem_interface;
+static struct usb_string_descriptor	modem_manufacturer;
 static struct usb_string_descriptor	modem_product;
+static struct usb_string_descriptor	modem_serial_number;
 
 static struct sysctl_ctx_list		modem_ctx_list;
 
@@ -207,9 +213,9 @@ struct usb_temp_device_desc usb_template_modem = {
 	.bDeviceClass = UDCLASS_COMM,
 	.bDeviceSubClass = 0,
 	.bDeviceProtocol = 0,
-	.iManufacturer = 0,
+	.iManufacturer = MODEM_MANUFACTURER_INDEX,
 	.iProduct = MODEM_PRODUCT_INDEX,
-	.iSerialNumber = 0,
+	.iSerialNumber = MODEM_SERIAL_NUMBER_INDEX,
 };
 
 /*------------------------------------------------------------------------*
@@ -238,7 +244,9 @@ modem_get_string_desc(uint16_t lang_id, uint8_t string
 	static const void *ptr[MODEM_MAX_INDEX] = {
 		[MODEM_LANG_INDEX] = &usb_string_lang_en,
 		[MODEM_INTERFACE_INDEX] = &modem_interface,
+		[MODEM_MANUFACTURER_INDEX] = &modem_manufacturer,
 		[MODEM_PRODUCT_INDEX] = &modem_product,
+		[MODEM_SERIAL_NUMBER_INDEX] = &modem_serial_number,
 	};
 
 	if (string_index == 0) {
@@ -261,8 +269,12 @@ modem_init(void *arg __unused)
 
 	usb_make_str_desc(&modem_interface, sizeof(modem_interface),
 	    MODEM_DEFAULT_INTERFACE);
+	usb_make_str_desc(&modem_manufacturer, sizeof(modem_manufacturer),
+	    MODEM_DEFAULT_MANUFACTURER);
 	usb_make_str_desc(&modem_product, sizeof(modem_product),
 	    MODEM_DEFAULT_PRODUCT);
+	usb_make_str_desc(&modem_serial_number, sizeof(modem_serial_number),
+	    MODEM_DEFAULT_SERIAL_NUMBER);
 
 	snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_MODEM);
 	sysctl_ctx_init(&modem_ctx_list);
@@ -284,9 +296,17 @@ modem_init(void *arg __unused)
 	    "A", "Interface string");
 #endif
 	SYSCTL_ADD_PROC(&modem_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
+	    "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &modem_manufacturer, sizeof(modem_manufacturer), usb_temp_sysctl,
+	    "A", "Manufacturer string");
+	SYSCTL_ADD_PROC(&modem_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
 	    "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
 	    &modem_product, sizeof(modem_product), usb_temp_sysctl,
 	    "A", "Product string");
+	SYSCTL_ADD_PROC(&modem_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
+	    "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &modem_serial_number, sizeof(modem_serial_number), usb_temp_sysctl,
+	    "A", "Serial number string");
 }
 
 static void

Modified: head/sys/dev/usb/template/usb_template_mouse.c
==============================================================================
--- head/sys/dev/usb/template/usb_template_mouse.c	Sun Jan 21 15:42:36 2018	(r328218)
+++ head/sys/dev/usb/template/usb_template_mouse.c	Sun Jan 21 17:31:31 2018	(r328219)
@@ -70,15 +70,21 @@
 enum {
 	MOUSE_LANG_INDEX,
 	MOUSE_INTERFACE_INDEX,
+	MOUSE_MANUFACTURER_INDEX,
 	MOUSE_PRODUCT_INDEX,
+	MOUSE_SERIAL_NUMBER_INDEX,
 	MOUSE_MAX_INDEX,
 };
 
 #define	MOUSE_DEFAULT_INTERFACE		"Mouse interface"
+#define	MOUSE_DEFAULT_MANUFACTURER	"FreeBSD foundation"
 #define	MOUSE_DEFAULT_PRODUCT		"Mouse Test Interface"
+#define	MOUSE_DEFAULT_SERIAL_NUMBER	"March 2008"
 
 static struct usb_string_descriptor	mouse_interface;
+static struct usb_string_descriptor	mouse_manufacturer;
 static struct usb_string_descriptor	mouse_product;
+static struct usb_string_descriptor	mouse_serial_number;
 
 static struct sysctl_ctx_list		mouse_ctx_list;
 
@@ -170,9 +176,9 @@ struct usb_temp_device_desc usb_template_mouse = {
 	.bDeviceClass = UDCLASS_COMM,
 	.bDeviceSubClass = 0,
 	.bDeviceProtocol = 0,
-	.iManufacturer = 0,
+	.iManufacturer = MOUSE_MANUFACTURER_INDEX,
 	.iProduct = MOUSE_PRODUCT_INDEX,
-	.iSerialNumber = 0,
+	.iSerialNumber = MOUSE_SERIAL_NUMBER_INDEX,
 };
 
 /*------------------------------------------------------------------------*
@@ -208,7 +214,9 @@ mouse_get_string_desc(uint16_t lang_id, uint8_t string
 	static const void *ptr[MOUSE_MAX_INDEX] = {
 		[MOUSE_LANG_INDEX] = &usb_string_lang_en,
 		[MOUSE_INTERFACE_INDEX] = &mouse_interface,
+		[MOUSE_MANUFACTURER_INDEX] = &mouse_manufacturer,
 		[MOUSE_PRODUCT_INDEX] = &mouse_product,
+		[MOUSE_SERIAL_NUMBER_INDEX] = &mouse_serial_number,
 	};
 
 	if (string_index == 0) {
@@ -231,8 +239,12 @@ mouse_init(void *arg __unused)
 
 	usb_make_str_desc(&mouse_interface, sizeof(mouse_interface),
 	    MOUSE_DEFAULT_INTERFACE);
+	usb_make_str_desc(&mouse_manufacturer, sizeof(mouse_manufacturer),
+	    MOUSE_DEFAULT_MANUFACTURER);
 	usb_make_str_desc(&mouse_product, sizeof(mouse_product),
 	    MOUSE_DEFAULT_PRODUCT);
+	usb_make_str_desc(&mouse_serial_number, sizeof(mouse_serial_number),
+	    MOUSE_DEFAULT_SERIAL_NUMBER);
 
 	snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_MOUSE);
 	sysctl_ctx_init(&mouse_ctx_list);
@@ -254,9 +266,17 @@ mouse_init(void *arg __unused)
 	    "A", "Interface string");
 #endif
 	SYSCTL_ADD_PROC(&mouse_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
+	    "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &mouse_manufacturer, sizeof(mouse_manufacturer), usb_temp_sysctl,
+	    "A", "Manufacturer string");
+	SYSCTL_ADD_PROC(&mouse_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
 	    "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
 	    &mouse_product, sizeof(mouse_product), usb_temp_sysctl,
 	    "A", "Product string");
+	SYSCTL_ADD_PROC(&mouse_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
+	    "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &mouse_serial_number, sizeof(mouse_serial_number), usb_temp_sysctl,
+	    "A", "Serial number string");
 }
 
 static void

Modified: head/sys/dev/usb/template/usb_template_phone.c
==============================================================================
--- head/sys/dev/usb/template/usb_template_phone.c	Sun Jan 21 15:42:36 2018	(r328218)
+++ head/sys/dev/usb/template/usb_template_phone.c	Sun Jan 21 17:31:31 2018	(r328219)
@@ -72,22 +72,28 @@ enum {
 	PHONE_MIXER_INDEX,
 	PHONE_RECORD_INDEX,
 	PHONE_PLAYBACK_INDEX,
-	PHONE_PRODUCT_INDEX,
 	PHONE_HID_INDEX,
+	PHONE_MANUFACTURER_INDEX,
+	PHONE_PRODUCT_INDEX,
+	PHONE_SERIAL_NUMBER_INDEX,
 	PHONE_MAX_INDEX,
 };
 
 #define	PHONE_DEFAULT_MIXER		"Mixer interface"
 #define	PHONE_DEFAULT_RECORD		"Record interface"
 #define	PHONE_DEFAULT_PLAYBACK		"Playback interface"
-#define	PHONE_DEFAULT_PRODUCT		"USB Phone Device"
 #define	PHONE_DEFAULT_HID		"HID interface"
+#define	PHONE_DEFAULT_MANUFACTURER	"FreeBSD foundation"
+#define	PHONE_DEFAULT_PRODUCT		"USB Phone Device"
+#define	PHONE_DEFAULT_SERIAL_NUMBER	"March 2008"
 
 static struct usb_string_descriptor	phone_mixer;
 static struct usb_string_descriptor	phone_record;
 static struct usb_string_descriptor	phone_playback;
-static struct usb_string_descriptor	phone_product;
 static struct usb_string_descriptor	phone_hid;
+static struct usb_string_descriptor	phone_manufacturer;
+static struct usb_string_descriptor	phone_product;
+static struct usb_string_descriptor	phone_serial_number;
 
 static struct sysctl_ctx_list		phone_ctx_list;
 
@@ -362,9 +368,9 @@ struct usb_temp_device_desc usb_template_phone = {
 	.bDeviceClass = UDCLASS_IN_INTERFACE,
 	.bDeviceSubClass = 0,
 	.bDeviceProtocol = 0,
-	.iManufacturer = 0,
+	.iManufacturer = PHONE_MANUFACTURER_INDEX,
 	.iProduct = PHONE_PRODUCT_INDEX,
-	.iSerialNumber = 0,
+	.iSerialNumber = PHONE_SERIAL_NUMBER_INDEX,
 };
 
 /*------------------------------------------------------------------------*
@@ -402,8 +408,10 @@ phone_get_string_desc(uint16_t lang_id, uint8_t string
 		[PHONE_MIXER_INDEX] = &phone_mixer,
 		[PHONE_RECORD_INDEX] = &phone_record,
 		[PHONE_PLAYBACK_INDEX] = &phone_playback,
-		[PHONE_PRODUCT_INDEX] = &phone_product,
 		[PHONE_HID_INDEX] = &phone_hid,
+		[PHONE_MANUFACTURER_INDEX] = &phone_manufacturer,
+		[PHONE_PRODUCT_INDEX] = &phone_product,
+		[PHONE_SERIAL_NUMBER_INDEX] = &phone_serial_number,
 	};
 
 	if (string_index == 0) {
@@ -430,10 +438,14 @@ phone_init(void *arg __unused)
 	    PHONE_DEFAULT_RECORD);
 	usb_make_str_desc(&phone_playback, sizeof(phone_playback),
 	    PHONE_DEFAULT_PLAYBACK);
-	usb_make_str_desc(&phone_product, sizeof(phone_product),
-	    PHONE_DEFAULT_PRODUCT);
 	usb_make_str_desc(&phone_hid, sizeof(phone_hid),
 	    PHONE_DEFAULT_HID);
+	usb_make_str_desc(&phone_manufacturer, sizeof(phone_manufacturer),
+	    PHONE_DEFAULT_MANUFACTURER);
+	usb_make_str_desc(&phone_product, sizeof(phone_product),
+	    PHONE_DEFAULT_PRODUCT);
+	usb_make_str_desc(&phone_serial_number, sizeof(phone_serial_number),
+	    PHONE_DEFAULT_SERIAL_NUMBER);
 
 	snprintf(parent_name, sizeof(parent_name), "%d", USB_TEMP_PHONE);
 	sysctl_ctx_init(&phone_ctx_list);
@@ -461,15 +473,23 @@ phone_init(void *arg __unused)
 	    "playback", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
 	    &phone_playback, sizeof(phone_playback), usb_temp_sysctl,
 	    "A", "Playback interface string");
+	SYSCTL_ADD_PROC(&phone_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
+	    "hid", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &phone_hid, sizeof(phone_hid), usb_temp_sysctl,
+	    "A", "HID interface string");
 #endif
 	SYSCTL_ADD_PROC(&phone_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
+	    "manufacturer", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &phone_manufacturer, sizeof(phone_manufacturer), usb_temp_sysctl,
+	    "A", "Manufacturer string");
+	SYSCTL_ADD_PROC(&phone_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
 	    "product", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
 	    &phone_product, sizeof(phone_product), usb_temp_sysctl,
 	    "A", "Product string");
 	SYSCTL_ADD_PROC(&phone_ctx_list, SYSCTL_CHILDREN(parent), OID_AUTO,
-	    "hid", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
-	    &phone_hid, sizeof(phone_hid), usb_temp_sysctl,
-	    "A", "HID interface string");
+	    "serial_number", CTLTYPE_STRING | CTLFLAG_RWTUN | CTLFLAG_MPSAFE,
+	    &phone_serial_number, sizeof(phone_serial_number), usb_temp_sysctl,
+	    "A", "Serial number string");
 }
 
 static void



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201801211731.w0LHVVQS048416>