Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/dev/usb Pull up following revision(s) (requested by j...
details: https://anonhg.NetBSD.org/src/rev/a05f511c2464
branches: netbsd-7
changeset: 799707:a05f511c2464
user: msaitoh <msaitoh%NetBSD.org@localhost>
date: Mon Nov 16 14:45:03 2015 +0000
description:
Pull up following revision(s) (requested by joerg in ticket #1032):
sys/dev/usb/usb_subr.c: revision 1.204
Attach serial number as property to all USB devices having one.
diffstat:
sys/dev/usb/usb_subr.c | 26 ++++++++++++++++++++++++--
1 files changed, 24 insertions(+), 2 deletions(-)
diffs (61 lines):
diff -r f75f7d3840b5 -r a05f511c2464 sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c Mon Nov 16 14:41:44 2015 +0000
+++ b/sys/dev/usb/usb_subr.c Mon Nov 16 14:45:03 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr.c,v 1.196 2014/02/17 07:34:21 skrll Exp $ */
+/* $NetBSD: usb_subr.c,v 1.196.4.1 2015/11/16 14:45:03 msaitoh Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.196 2014/02/17 07:34:21 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.196.4.1 2015/11/16 14:45:03 msaitoh Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -828,6 +828,24 @@
return (USBD_NORMAL_COMPLETION);
}
+static void
+usbd_serialnumber(device_t dv, usbd_device_handle dev)
+{
+ usb_device_descriptor_t *dd = &dev->ddesc;
+ char *serialnumber;
+
+ serialnumber = malloc(USB_MAX_ENCODED_STRING_LEN, M_USB, M_NOWAIT);
+ if (serialnumber == NULL)
+ return;
+ serialnumber[0] = '\0';
+ (void)usbd_get_string(dev, dd->iSerialNumber, serialnumber);
+ if (serialnumber[0]) {
+ prop_dictionary_set_cstring(device_properties(dv),
+ "serialnumber", serialnumber);
+ }
+ free(serialnumber, M_USB);
+}
+
static usbd_status
usbd_attachwholedevice(device_t parent, usbd_device_handle dev, int port,
int usegeneric)
@@ -864,6 +882,7 @@
dev->subdevs[0] = dv;
dev->subdevlen = 1;
dev->nifaces_claimed = 1; /* XXX */
+ usbd_serialnumber(dv, dev);
}
return (USBD_NORMAL_COMPLETION);
}
@@ -924,6 +943,9 @@
usbd_ifprint, config_stdsubmatch);
if (!dv)
continue;
+
+ usbd_serialnumber(dv, dev);
+
ifaces[i] = 0; /* claim */
/* account for ifaces claimed by the driver behind our back */
for (j = 0; j < nifaces; j++) {
Home |
Main Index |
Thread Index |
Old Index