lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1277505914-22719-1-git-send-email-rob@emanuele.us>
Date:	Fri, 25 Jun 2010 15:45:14 -0700
From:	Rob Emanuele <rob@...nuele.us>
To:	linux-kernel@...r.kernel.org
Cc:	Rob Emanuele <rob@...nuele.us>
Subject: [PATCH] usb gadget, serial: Add a serial number field to the usb descriptor.

This way it can support the iSerialNumber parameter.

Signed-off-by: Rob Emanuele <rob@...nuele.us>
---
 drivers/usb/gadget/serial.c |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c
index f46a609..7f64524 100644
--- a/drivers/usb/gadget/serial.c
+++ b/drivers/usb/gadget/serial.c
@@ -63,13 +63,16 @@
 
 #define STRING_MANUFACTURER_IDX		0
 #define STRING_PRODUCT_IDX		1
-#define STRING_DESCRIPTION_IDX		2
+#define STRING_SERIAL_IDX		2
+#define STRING_DESCRIPTION_IDX		3
 
 static char manufacturer[50];
+static char serialnum[25];
 
 static struct usb_string strings_dev[] = {
 	[STRING_MANUFACTURER_IDX].s = manufacturer,
 	[STRING_PRODUCT_IDX].s = GS_VERSION_NAME,
+	[STRING_SERIAL_IDX].s = serialnum,
 	[STRING_DESCRIPTION_IDX].s = NULL /* updated; f(use_acm) */,
 	{  } /* end of list */
 };
@@ -175,7 +178,7 @@ static int __init gs_bind(struct usb_composite_dev *cdev)
 	 * contents can be overridden by the composite_dev glue.
 	 */
 
-	/* device description: manufacturer, product */
+	/* device description: manufacturer, product, serialnum */
 	snprintf(manufacturer, sizeof manufacturer, "%s %s with %s",
 		init_utsname()->sysname, init_utsname()->release,
 		gadget->name);
@@ -193,6 +196,14 @@ static int __init gs_bind(struct usb_composite_dev *cdev)
 
 	device_desc.iProduct = status;
 
+	snprintf(serialnum, sizeof serialnum, "non-unique");
+	status = usb_string_id(cdev);
+	if (status < 0)
+		goto fail;
+	strings_dev[STRING_SERIAL_IDX].id = status;
+
+	device_desc.iSerialNumber = status;
+
 	/* config description */
 	status = usb_string_id(cdev);
 	if (status < 0)
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ