linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Benson Leung <bleung@chromium.org>
To: gregkh@linuxfoundation.org, linux-usb@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: achant@google.com, bleung@google.com, Benson Leung <bleung@chromium.org>
Subject: [PATCH v2] USB: announce bcdDevice as well as idVendor, idProduct.
Date: Fri, 23 Mar 2018 18:31:54 -0700	[thread overview]
Message-ID: <20180324013154.230119-1-bleung@chromium.org> (raw)
In-Reply-To: <20180324003330.180726-1-bleung@chromium.org>

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.

Match the %2x.%02x formatting that's used by lsusb -v for this same value.

Signed-off-by: Benson Leung <bleung@chromium.org>
--
v2: Format for decimal output.
---
 drivers/usb/core/hub.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index aaeef03c0d83..624cde7ffcea 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2192,14 +2192,19 @@ 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));
+	u16 bcdDevice;
+
+	bcdDevice = le16_to_cpu(udev->descriptor.bcdDevice);
+	dev_info(&udev->dev,
+		 "New USB device found, idVendor=%04x, idProduct=%04x, bcdDevice=%2x.%02x\n",
+		 le16_to_cpu(udev->descriptor.idVendor),
+		 le16_to_cpu(udev->descriptor.idProduct),
+		 bcdDevice >> 8, bcdDevice & 0xff);
 	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 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


  parent reply	other threads:[~2018-03-24  1:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-24  0:33 [PATCH] USB: announce bcdDevice as well as idVendor, idProduct Benson Leung
2018-03-24  0:48 ` Andrew Chant
2018-03-24  1:08   ` Andrew Chant
2018-03-24  1:34     ` Benson Leung
2018-03-24  1:31 ` Benson Leung [this message]
2018-03-24 16:06   ` [PATCH v2] " Alan Stern
2018-03-24 17:43     ` Benson Leung
2018-03-24 17:40 ` [PATCH v3] " Benson Leung
2018-03-26 18:27   ` Alan Stern

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180324013154.230119-1-bleung@chromium.org \
    --to=bleung@chromium.org \
    --cc=achant@google.com \
    --cc=bleung@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).