Index: usb_subr.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/usb_subr.c,v retrieving revision 1.277 diff -p -u -r1.277 usb_subr.c --- usb_subr.c 6 Apr 2022 22:01:45 -0000 1.277 +++ usb_subr.c 3 May 2022 16:31:17 -0000 @@ -1,4 +1,4 @@ -/* $NetBSD: usb_subr.c,v 1.277 2022/04/06 22:01:45 mlelstv Exp $ */ +/* $NetBSD: usb_subr.c,v 1.276 2022/04/06 21:51:29 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 -__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.277 2022/04/06 22:01:45 mlelstv Exp $"); +__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.276 2022/04/06 21:51:29 mlelstv Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -1081,6 +1081,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); Index: umodem_common.c =================================================================== RCS file: /cvsroot/src/sys/dev/usb/umodem_common.c,v retrieving revision 1.35 diff -p -u -r1.35 umodem_common.c --- umodem_common.c 7 Aug 2021 16:19:17 -0000 1.35 +++ umodem_common.c 3 May 2022 16:31:58 -0000 @@ -121,6 +121,7 @@ umodem_common_attach(device_t self, stru char *devinfop; usbd_status err; int data_ifcno; + int used_ifaces; int i; sc->sc_dev = self; @@ -154,14 +155,17 @@ umodem_common_attach(device_t self, stru sc->sc_acm_cap & USB_CDC_ACM_HAS_BREAK ? "" : "no "); /* Get the data interface too. */ + used_ifaces = 0; for (i = 0; i < uiaa->uiaa_nifaces; i++) { if (uiaa->uiaa_ifaces[i] != NULL) { id = usbd_get_interface_descriptor(uiaa->uiaa_ifaces[i]); if (id != NULL && id->bInterfaceNumber == data_ifcno) { sc->sc_data_iface = uiaa->uiaa_ifaces[i]; uiaa->uiaa_ifaces[i] = NULL; + ++used_ifaces; } - } + } else + ++used_ifaces; } if (sc->sc_data_iface == NULL) { aprint_error_dev(self, "no data interface\n"); @@ -260,6 +264,9 @@ umodem_common_attach(device_t self, stru ucaa->ucaa_iface = sc->sc_data_iface; ucaa->ucaa_arg = sc; + if (ucaa->ucaa_portno == UCOM_UNK_PORTNO) + ucaa->ucaa_portno = (used_ifaces + 1)/2; + usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc->sc_udev, sc->sc_dev); DPRINTF(("umodem_common_attach: sc=%p\n", sc));