Linux USB
 help / color / mirror / Atom feed
* [PATCH] USB: Improve "New device found" printout message
@ 2026-08-27 15:38 Martin Rys
  2026-08-28  5:43 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Rys @ 2026-08-27 15:38 UTC (permalink / raw)
  To: linux-usb

Hi,

it's my first time posting on any Linux mailing list, hopefully am doing
everything right.

While checking out dmesg I saw that there's an extra space after
"bcdDevice=":
  usb 1-5.2: New USB device found, idVendor=0583, idProduct=a000,
bcdDevice= 1.00
  usb 1-5.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0

Turns out that was introduced in
https://github.com/torvalds/linux/commit/73c6d3b284cf7b31c03fdaa2476f48f8da0932f8
(USB: announce bcdDevice as well as idVendor, idProduct.), as it was
trying to keep the same formatting as `lsusb -v`:

  idProduct          0x0276 GXT 165 Gaming Mouse
  bcdDevice            1.00
  iManufacturer           1 SINOWEALTH

 but lsusb presumably uses %2x to have a fixed-width text, so the number
of spacing it needs to do so it all lines up under a monospace font is
predictable.

In dmesg, it just causes it to look odd if there's no character in the
first hex slot, as "12.00" looks fine, but " 1.00" does not.

While staring at this I've also noticed that there's a comma instead of
a colon after the first message, so I've fixed that up too.

Martin



From a0bc389b6bf4641fbd894f8acd4c1c5709728862 Mon Sep 17 00:00:00 2001
From: Martin Rys <martin@archlinux.org>
Date: Thu, 27 Aug 2026 17:05:45 +0200
Subject: [PATCH] USB: Improve "New device found" printout message

Use colon instead of comma like the later message does.

Do not print a useless space after `bcdDevice=` - this was introduced as
the formatting was copied from `lsusb -v` printout, but that one has
preceding spaces, this one does not.

Signed-off-by: Martin Rys <martin@archlinux.org>
---
 drivers/usb/core/hub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 3345b3298daf..c382215a1177 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -2411,7 +2411,7 @@ static void announce_device_ids(struct usb_device
*udev)
        u16 bcdDevice = le16_to_cpu(udev->descriptor.bcdDevice);
 
        dev_info(&udev->dev,
-               "New USB device found, idVendor=%04x, idProduct=%04x,
bcdDevice=%2x.%02x\n",
+               "New USB device found: idVendor=%04x, idProduct=%04x,
bcdDevice=%x.%02x\n",
                le16_to_cpu(udev->descriptor.idVendor),
                le16_to_cpu(udev->descriptor.idProduct),
                bcdDevice >> 8, bcdDevice & 0xff);
-- 
2.55.0



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

* Re: [PATCH] USB: Improve "New device found" printout message
  2026-08-27 15:38 [PATCH] USB: Improve "New device found" printout message Martin Rys
@ 2026-08-28  5:43 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2026-08-28  5:43 UTC (permalink / raw)
  To: Martin Rys; +Cc: linux-usb

On Thu, Aug 27, 2026 at 05:38:35PM +0200, Martin Rys wrote:
> Hi,
> 
> it's my first time posting on any Linux mailing list, hopefully am doing
> everything right.
> 
> While checking out dmesg I saw that there's an extra space after
> "bcdDevice=":
>   usb 1-5.2: New USB device found, idVendor=0583, idProduct=a000,
> bcdDevice= 1.00
>   usb 1-5.2: New USB device strings: Mfr=0, Product=2, SerialNumber=0
> 
> Turns out that was introduced in
> https://github.com/torvalds/linux/commit/73c6d3b284cf7b31c03fdaa2476f48f8da0932f8
> (USB: announce bcdDevice as well as idVendor, idProduct.), as it was
> trying to keep the same formatting as `lsusb -v`:
> 
>   idProduct          0x0276 GXT 165 Gaming Mouse
>   bcdDevice            1.00
>   iManufacturer           1 SINOWEALTH
> 
>  but lsusb presumably uses %2x to have a fixed-width text, so the number
> of spacing it needs to do so it all lines up under a monospace font is
> predictable.
> 
> In dmesg, it just causes it to look odd if there's no character in the
> first hex slot, as "12.00" looks fine, but " 1.00" does not.
> 
> While staring at this I've also noticed that there's a comma instead of
> a colon after the first message, so I've fixed that up too.

Cool, but this all doesn't belong here, the patch changelog should
contain enough information for us to understand this.

> 
> Martin
> 
> 
> 
> >From a0bc389b6bf4641fbd894f8acd4c1c5709728862 Mon Sep 17 00:00:00 2001
> From: Martin Rys <martin@archlinux.org>
> Date: Thu, 27 Aug 2026 17:05:45 +0200
> Subject: [PATCH] USB: Improve "New device found" printout message

The patch shouldn't be part of the middle of the email, just send it on
it's own.  See lots of examples on the mailing list for how that looks.

> 
> Use colon instead of comma like the later message does.
> 
> Do not print a useless space after `bcdDevice=` - this was introduced as
> the formatting was copied from `lsusb -v` printout, but that one has
> preceding spaces, this one does not.
> 
> Signed-off-by: Martin Rys <martin@archlinux.org>
> ---
>  drivers/usb/core/hub.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
> index 3345b3298daf..c382215a1177 100644
> --- a/drivers/usb/core/hub.c
> +++ b/drivers/usb/core/hub.c
> @@ -2411,7 +2411,7 @@ static void announce_device_ids(struct usb_device
> *udev)
>         u16 bcdDevice = le16_to_cpu(udev->descriptor.bcdDevice);
>  
>         dev_info(&udev->dev,
> -               "New USB device found, idVendor=%04x, idProduct=%04x,
> bcdDevice=%2x.%02x\n",
> +               "New USB device found: idVendor=%04x, idProduct=%04x,
> bcdDevice=%x.%02x\n",
>                 le16_to_cpu(udev->descriptor.idVendor),
>                 le16_to_cpu(udev->descriptor.idProduct),
>                 bcdDevice >> 8, bcdDevice & 0xff);
> -- 
> 2.55.0

The patch is line-wrapped and whitespace damaged and can't be applied.
Perhaps use a tool like git send-email or b4 to send it?

thanks,

greg k-h

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

end of thread, other threads:[~2026-08-28  5:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-27 15:38 [PATCH] USB: Improve "New device found" printout message Martin Rys
2026-08-28  5:43 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox