Module Name: src
Committed By: mlelstv
Date: Sat May 4 12:45:14 UTC 2024
Modified Files:
src/sys/dev/usb: usb_subr.c
Log Message:
Make usb address and hub topology available to drvctl.
To generate a diff of this commit:
cvs rdiff -u -r1.278 -r1.279 src/sys/dev/usb/usb_subr.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.278 src/sys/dev/usb/usb_subr.c:1.279
--- src/sys/dev/usb/usb_subr.c:1.278 Tue Apr 11 08:50:07 2023
+++ src/sys/dev/usb/usb_subr.c Sat May 4 12:45:13 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr.c,v 1.278 2023/04/11 08:50:07 riastradh Exp $ */
+/* $NetBSD: usb_subr.c,v 1.279 2024/05/04 12:45:13 mlelstv 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.278 2023/04/11 08:50:07 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.279 2024/05/04 12:45:13 mlelstv Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1083,6 +1083,24 @@ usbd_properties(device_t dv, struct usbd
vendor = UGETW(dd->idVendor);
product = UGETW(dd->idProduct);
+ prop_dictionary_set_uint8(dict, "address", dev->ud_addr);
+
+ if (dev->ud_myhub) {
+ struct usbd_device *hdev = dev->ud_myhub;
+ struct usbd_hub *hub = hdev->ud_hub;
+ int p;
+
+ KASSERT(hub != NULL);
+
+ prop_dictionary_set_uint8(dict, "hub-address", hdev->ud_addr);
+ for (p=1; p <= hub->uh_hubdesc.bNbrPorts; ++p) {
+ if (hub->uh_ports[p-1].up_dev == dev) {
+ prop_dictionary_set_uint8(dict, "hub-port", p);
+ break;
+ }
+ }
+ }
+
prop_dictionary_set_uint8(dict, "class", class);
prop_dictionary_set_uint8(dict, "subclass", subclass);
prop_dictionary_set_uint16(dict, "release", release);