From 1e7e4fd25a32fe553c7bab32763e456fae5bca79 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 17 Feb 2018 06:57:17 +0000 Subject: [PATCH] Correct the PNP information generated by the usb driver to match the artificial NOMATCH usb does in lieu of creating a device_t for devices with no drivers. Also, correct bus to be 'uhub' since where USB devices attach, even though 'usb' is more logical, we need the physical bus here. Submitted by: hps@ --- sys/dev/usb/usb_hub.c | 10 +++++++++- sys/dev/usb/usbdi.h | 8 ++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/dev/usb/usb_hub.c b/sys/dev/usb/usb_hub.c index 59d56e65697..f42c30e9a86 100644 --- a/sys/dev/usb/usb_hub.c +++ b/sys/dev/usb/usb_hub.c @@ -1733,7 +1733,12 @@ uhub_child_pnpinfo_string(device_t parent, device_t child, } iface = usbd_get_iface(res.udev, res.iface_index); if (iface && iface->idesc) { - snprintf(buf, buflen, "vendor=0x%04x product=0x%04x " + snprintf(buf, buflen, + "bus=usb " +#if USB_HAVE_UGEN + "device=%s " +#endif + "vendor=0x%04x product=0x%04x " "devclass=0x%02x devsubclass=0x%02x " "devproto=0x%02x " "sernum=\"%s\" " @@ -1741,6 +1746,9 @@ uhub_child_pnpinfo_string(device_t parent, device_t child, "mode=%s " "intclass=0x%02x intsubclass=0x%02x " "intprotocol=0x%02x" "%s%s", +#if USB_HAVE_UGEN + res.udev->ugen_name, +#endif UGETW(res.udev->ddesc.idVendor), UGETW(res.udev->ddesc.idProduct), res.udev->ddesc.bDeviceClass, diff --git a/sys/dev/usb/usbdi.h b/sys/dev/usb/usbdi.h index 383876e14bb..147b5d5e71b 100644 --- a/sys/dev/usb/usbdi.h +++ b/sys/dev/usb/usbdi.h @@ -337,18 +337,18 @@ struct usb_device_id { } __aligned(32); #define USB_STD_PNP_INFO "M16:mask;U16:vendor;U16:product;L16:release;G16:release;" \ - "U8:devclass;U8:devsubclass;U8:devprotocol;" \ + "U8:devclass;U8:devsubclass;U8:devproto;" \ "U8:intclass;U8:intsubclass;U8:intprotocol;" #define USB_STD_PNP_HOST_INFO USB_STD_PNP_INFO "T:mode=host;" #define USB_STD_PNP_DEVICE_INFO USB_STD_PNP_INFO "T:mode=device;" #define USB_PNP_HOST_INFO(table) \ - MODULE_PNP_INFO(USB_STD_PNP_HOST_INFO, usb, table, table, sizeof(table[0]), \ + MODULE_PNP_INFO(USB_STD_PNP_HOST_INFO, uhub, table, table, sizeof(table[0]), \ sizeof(table) / sizeof(table[0])) #define USB_PNP_DEVICE_INFO(table) \ - MODULE_PNP_INFO(USB_STD_PNP_DEVICE_INFO, usb, table, table, sizeof(table[0]), \ + MODULE_PNP_INFO(USB_STD_PNP_DEVICE_INFO, uhub, table, table, sizeof(table[0]), \ sizeof(table) / sizeof(table[0])) #define USB_PNP_DUAL_INFO(table) \ - MODULE_PNP_INFO(USB_STD_PNP_INFO, usb, table, table, sizeof(table[0]), \ + MODULE_PNP_INFO(USB_STD_PNP_INFO, uhub, table, table, sizeof(table[0]), \ sizeof(table) / sizeof(table[0])) /* check that the size of the structure above is correct */