Thread (9 messages) 9 messages, 4 authors, 2018-03-26

USB: announce bcdDevice as well as idVendor, idProduct.

From: Andrew Chant <hidden>
Date: 2018-03-24 01:08:49
Also in: lkml

On Fri, Mar 23, 2018 at 5:48 PM, Andrew Chant [off-list ref] wrote:
On Fri, Mar 23, 2018 at 5:33 PM, Benson Leung [off-list ref] wrote:
quoted
Print bcdDevice which is used by vendors to identify different versions
of the same product (or different versions of firmware).

Adding this to the logs will be useful for support purposes.

Signed-off-by: Benson Leung <bleung@chromium.org>
---
 drivers/usb/core/hub.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index aaeef03c0d83..739d599814b6 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2192,14 +2192,16 @@ static void show_string(struct usb_device *udev, char *id, char *string)

 static void announce_device(struct usb_device *udev)
 {
-       dev_info(&udev->dev, "New USB device found, idVendor=%04x, idProduct=%04x\n",
-               le16_to_cpu(udev->descriptor.idVendor),
-               le16_to_cpu(udev->descriptor.idProduct));
        dev_info(&udev->dev,
-               "New USB device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
-               udev->descriptor.iManufacturer,
-               udev->descriptor.iProduct,
-               udev->descriptor.iSerialNumber);
+                "New USB device found, idVendor=%04x, idProduct=%04x, bcdDevice=%04x\n",
+                le16_to_cpu(udev->descriptor.idVendor),
+                le16_to_cpu(udev->descriptor.idProduct),
+                le16_to_cpu(udev->descriptor.bcdDevice));
+       dev_info(&udev->dev,
+                "New USB device strings: Mfr=%d, Product=%d, SerialNumber=%d\n",
+                udev->descriptor.iManufacturer,
+                udev->descriptor.iProduct,
+                udev->descriptor.iSerialNumber);
        show_string(udev, "Product", udev->product);
        show_string(udev, "Manufacturer", udev->manufacturer);
        show_string(udev, "SerialNumber", udev->serial);
--
2.17.0.rc0.231.g781580f067-goog
quoted
+                "New USB device found, idVendor=%04x, idProduct=%04x, bcdDevice=%04x\n",
Can you please decode bcdDevice into a decimal string?

lsusb -v does this (bcdDevice: 0.03 for example) and in my experience
it has generally matched up with how hardware manufacturers refer
to their firmware.
Nevermind, %x should show bcd properly.  looks fine.
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help