All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24  0:33 ` Benson Leung
  0 siblings, 0 replies; 18+ messages in thread
From: Benson Leung @ 2018-03-24  0:33 UTC (permalink / raw)
  To: gregkh, linux-usb, linux-kernel; +Cc: achant, bleung, Benson Leung

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


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24  0:33 ` Benson Leung
  0 siblings, 0 replies; 18+ messages in thread
From: Benson Leung @ 2018-03-24  0:33 UTC (permalink / raw)
  To: gregkh, linux-usb, linux-kernel; +Cc: achant, bleung, Benson Leung

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);

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24  0:48   ` Andrew Chant
  0 siblings, 0 replies; 18+ messages in thread
From: Andrew Chant @ 2018-03-24  0:48 UTC (permalink / raw)
  To: Benson Leung; +Cc: gregkh, linux-usb, linux-kernel, Benson Leung

On Fri, Mar 23, 2018 at 5:33 PM, Benson Leung <bleung@chromium.org> wrote:
> 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
>

> +                "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.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24  0:48   ` Andrew Chant
  0 siblings, 0 replies; 18+ messages in thread
From: Andrew Chant @ 2018-03-24  0:48 UTC (permalink / raw)
  To: Benson Leung; +Cc: gregkh, linux-usb, linux-kernel, Benson Leung

On Fri, Mar 23, 2018 at 5:33 PM, Benson Leung <bleung@chromium.org> wrote:
> 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
>

> +                "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.
---
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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24  1:08     ` Andrew Chant
  0 siblings, 0 replies; 18+ messages in thread
From: Andrew Chant @ 2018-03-24  1:08 UTC (permalink / raw)
  To: Benson Leung; +Cc: gregkh, linux-usb, linux-kernel, Benson Leung

On Fri, Mar 23, 2018 at 5:48 PM, Andrew Chant <achant@google.com> wrote:
> On Fri, Mar 23, 2018 at 5:33 PM, Benson Leung <bleung@chromium.org> wrote:
>> 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
>>
>
>> +                "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.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24  1:08     ` Andrew Chant
  0 siblings, 0 replies; 18+ messages in thread
From: Andrew Chant @ 2018-03-24  1:08 UTC (permalink / raw)
  To: Benson Leung; +Cc: gregkh, linux-usb, linux-kernel, Benson Leung

On Fri, Mar 23, 2018 at 5:48 PM, Andrew Chant <achant@google.com> wrote:
> On Fri, Mar 23, 2018 at 5:33 PM, Benson Leung <bleung@chromium.org> wrote:
>> 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
>>
>
>> +                "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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24  1:31   ` Benson Leung
  0 siblings, 0 replies; 18+ messages in thread
From: Benson Leung @ 2018-03-24  1:31 UTC (permalink / raw)
  To: gregkh, linux-usb, linux-kernel; +Cc: achant, bleung, Benson Leung

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


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [v2] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24  1:31   ` Benson Leung
  0 siblings, 0 replies; 18+ messages in thread
From: Benson Leung @ 2018-03-24  1:31 UTC (permalink / raw)
  To: gregkh, linux-usb, linux-kernel; +Cc: achant, bleung, Benson Leung

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);

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24  1:34       ` Benson Leung
  0 siblings, 0 replies; 18+ messages in thread
From: Benson Leung @ 2018-03-24  1:34 UTC (permalink / raw)
  To: Andrew Chant; +Cc: Benson Leung, gregkh, linux-usb, linux-kernel, bleung

[-- Attachment #1: Type: text/plain, Size: 673 bytes --]

On Fri, Mar 23, 2018 at 06:08:07PM -0700, Andrew Chant wrote:
> >> +                "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.

I like the way lsusb -v does it better. Take a look at v2.

Thanks,
Benson

-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24  1:34       ` Benson Leung
  0 siblings, 0 replies; 18+ messages in thread
From: Benson Leung @ 2018-03-24  1:34 UTC (permalink / raw)
  To: Andrew Chant; +Cc: Benson Leung, gregkh, linux-usb, linux-kernel, bleung

On Fri, Mar 23, 2018 at 06:08:07PM -0700, Andrew Chant wrote:
> >> +                "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.

I like the way lsusb -v does it better. Take a look at v2.

Thanks,
Benson

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24 16:06     ` Alan Stern
  0 siblings, 0 replies; 18+ messages in thread
From: Alan Stern @ 2018-03-24 16:06 UTC (permalink / raw)
  To: Benson Leung; +Cc: gregkh, linux-usb, linux-kernel, achant, bleung

On Fri, 23 Mar 2018, Benson Leung wrote:

> 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),

Unnecessary and incorrect whitespace changes.

> +		 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);

Same here.

Alan Stern

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [v2] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24 16:06     ` Alan Stern
  0 siblings, 0 replies; 18+ messages in thread
From: Alan Stern @ 2018-03-24 16:06 UTC (permalink / raw)
  To: Benson Leung; +Cc: gregkh, linux-usb, linux-kernel, achant, bleung

On Fri, 23 Mar 2018, Benson Leung wrote:

> 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),

Unnecessary and incorrect whitespace changes.

> +		 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);

Same here.

Alan Stern
---
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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24 17:40   ` Benson Leung
  0 siblings, 0 replies; 18+ messages in thread
From: Benson Leung @ 2018-03-24 17:40 UTC (permalink / raw)
  To: gregkh, linux-usb, linux-kernel, stern; +Cc: achant, bleung, Benson Leung

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>
---

v3: Remove unnecessary whitespace changes.
v2: Format for decimal output.

 drivers/usb/core/hub.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index aaeef03c0d83..779725836cf5 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2192,9 +2192,13 @@ 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",
+	u16 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));
+		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,
-- 
2.17.0.rc0.231.g781580f067-goog

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [v3] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24 17:40   ` Benson Leung
  0 siblings, 0 replies; 18+ messages in thread
From: Benson Leung @ 2018-03-24 17:40 UTC (permalink / raw)
  To: gregkh, linux-usb, linux-kernel, stern; +Cc: achant, bleung, Benson Leung

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>
---

v3: Remove unnecessary whitespace changes.
v2: Format for decimal output.

 drivers/usb/core/hub.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index aaeef03c0d83..779725836cf5 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2192,9 +2192,13 @@ 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",
+	u16 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));
+		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,

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v2] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24 17:43       ` Benson Leung
  0 siblings, 0 replies; 18+ messages in thread
From: Benson Leung @ 2018-03-24 17:43 UTC (permalink / raw)
  To: Alan Stern; +Cc: Benson Leung, gregkh, linux-usb, linux-kernel, achant

[-- Attachment #1: Type: text/plain, Size: 453 bytes --]

On Sat, Mar 24, 2018 at 12:06:20PM -0400, Alan Stern wrote:
> > +	dev_info(&udev->dev,
> > +		 "New USB device found, idVendor=%04x, idProduct=%04x, bcdDevice=%2x.%02x\n",
> > +		 le16_to_cpu(udev->descriptor.idVendor),
> 
> Unnecessary and incorrect whitespace changes.
 
Thanks Alan. Fixed in v3.

Benson
-- 
Benson Leung
Staff Software Engineer
Chrome OS Kernel
Google Inc.
bleung@google.com
Chromium OS Project
bleung@chromium.org

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [v2] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-24 17:43       ` Benson Leung
  0 siblings, 0 replies; 18+ messages in thread
From: Benson Leung @ 2018-03-24 17:43 UTC (permalink / raw)
  To: Alan Stern; +Cc: Benson Leung, gregkh, linux-usb, linux-kernel, achant

On Sat, Mar 24, 2018 at 12:06:20PM -0400, Alan Stern wrote:
> > +	dev_info(&udev->dev,
> > +		 "New USB device found, idVendor=%04x, idProduct=%04x, bcdDevice=%2x.%02x\n",
> > +		 le16_to_cpu(udev->descriptor.idVendor),
> 
> Unnecessary and incorrect whitespace changes.
 
Thanks Alan. Fixed in v3.

Benson

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-26 18:27     ` Alan Stern
  0 siblings, 0 replies; 18+ messages in thread
From: Alan Stern @ 2018-03-26 18:27 UTC (permalink / raw)
  To: Benson Leung; +Cc: gregkh, linux-usb, linux-kernel, achant, bleung

On Sat, 24 Mar 2018, Benson Leung wrote:

> 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>
> ---
> 
> v3: Remove unnecessary whitespace changes.
> v2: Format for decimal output.
> 
>  drivers/usb/core/hub.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index aaeef03c0d83..779725836cf5 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -2192,9 +2192,13 @@ 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",
> +	u16 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));
> +		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,

Acked-by: Alan Stern <stern@rowland.harvard.edu>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [v3] USB: announce bcdDevice as well as idVendor, idProduct.
@ 2018-03-26 18:27     ` Alan Stern
  0 siblings, 0 replies; 18+ messages in thread
From: Alan Stern @ 2018-03-26 18:27 UTC (permalink / raw)
  To: Benson Leung; +Cc: gregkh, linux-usb, linux-kernel, achant, bleung

On Sat, 24 Mar 2018, Benson Leung wrote:

> 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>
> ---
> 
> v3: Remove unnecessary whitespace changes.
> v2: Format for decimal output.
> 
>  drivers/usb/core/hub.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index aaeef03c0d83..779725836cf5 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -2192,9 +2192,13 @@ 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",
> +	u16 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));
> +		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,

Acked-by: Alan Stern <stern@rowland.harvard.edu>
---
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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2018-03-26 18:27 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-24  0:33 [PATCH] USB: announce bcdDevice as well as idVendor, idProduct Benson Leung
2018-03-24  0:33 ` Benson Leung
2018-03-24  0:48 ` [PATCH] " Andrew Chant
2018-03-24  0:48   ` Andrew Chant
2018-03-24  1:08   ` [PATCH] " Andrew Chant
2018-03-24  1:08     ` Andrew Chant
2018-03-24  1:34     ` [PATCH] " Benson Leung
2018-03-24  1:34       ` Benson Leung
2018-03-24  1:31 ` [PATCH v2] " Benson Leung
2018-03-24  1:31   ` [v2] " Benson Leung
2018-03-24 16:06   ` [PATCH v2] " Alan Stern
2018-03-24 16:06     ` [v2] " Alan Stern
2018-03-24 17:43     ` [PATCH v2] " Benson Leung
2018-03-24 17:43       ` [v2] " Benson Leung
2018-03-24 17:40 ` [PATCH v3] " Benson Leung
2018-03-24 17:40   ` [v3] " Benson Leung
2018-03-26 18:27   ` [PATCH v3] " Alan Stern
2018-03-26 18:27     ` [v3] " Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.