[PATCH] usb: also announce bcdDevice

From: Paul Bolle
Date: Sat May 05 2012 - 07:52:43 EST


Currently announce_device() does print the idVendor and idProduct values
but does not print the bcdDevice value. USB devices are accurately
identified by all three values. See, for instance, the USB storage
quirks which will only apply for a certain (range of) bcdDevice
value(s). So it seems useful to also print bcdDevice when announcing USB
devices.

Signed-off-by: Paul Bolle <pebolle@xxxxxxxxxx>
---
0) This is something I ran into while trying to track down the log
errors generated by each of the USB sticks I happen to have lying
around. Of course, there are other ways to track down the bcdDevice
value of a specific device ("lusb -v -d $vendorid:$productid | grep
bcdDevice" or "usb-devices | grep $vendorid.*$productid" come to mind).
But since idVendor and idProduct are already printed by this debugging
aid I think adding bcdDevice makes sense too. But is this all worth the
small bit of additional noise?

1) The patch generates a checkpatch warning: "quoted string split across
lines". But since it is hard to grep for this entire string without
knowing the printk "conversion specifications" in the string beforehand,
I think the warning can be ignored here. Note that I actually found this
string by git grepping for just "New USB device found".

drivers/usb/core/Kconfig | 4 ++--
drivers/usb/core/hub.c | 6 ++++--
2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index 18d02e3..85f795b 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -14,8 +14,8 @@ config USB_ANNOUNCE_NEW_DEVICES
depends on USB
default N
help
- Say Y here if you want the USB core to always announce the
- idVendor, idProduct, Manufacturer, Product, and SerialNumber
+ Say Y here if you want the USB core to always announce the idVendor,
+ idProduct, bcdDevice, Manufacturer, Product, and SerialNumber
strings for every new USB device to the syslog. This option is
usually used by distro vendors to help with debugging and to
let users know what specific device was added to the machine
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index ec6c97d..6e1bfaea 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -1726,9 +1726,11 @@ 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",
+ dev_info(&udev->dev, "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.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,
--
1.7.7.6



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/