Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f2a383e4de50ad9c03676e57703a97d081798e55
Commit:     f2a383e4de50ad9c03676e57703a97d081798e55
Parent:     5933101718ea3d283983a923c5524c88138e5564
Author:     Greg Kroah-Hartman <[EMAIL PROTECTED]>
AuthorDate: Mon Nov 26 22:11:55 2007 -0800
Committer:  Greg Kroah-Hartman <[EMAIL PROTECTED]>
CommitDate: Fri Feb 1 14:34:52 2008 -0800

    USB: always announce a device has been added to the system
    
    Distros (like SuSE) want to know this information, to make it easier
    to handle support issues.  Might as well let everyone benefit from this.
    This is also enabled whenever CONFIG_USB_DEBUG is enabled, to help with
    debugging.
    
    Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/usb/core/Kconfig |   15 +++++++++++++++
 drivers/usb/core/hub.c   |   36 ++++++++++++++++++++++++------------
 2 files changed, 39 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/core/Kconfig b/drivers/usb/core/Kconfig
index 97b09f2..5c33cdb 100644
--- a/drivers/usb/core/Kconfig
+++ b/drivers/usb/core/Kconfig
@@ -9,6 +9,21 @@ config USB_DEBUG
          of debug messages to the system log. Select this if you are having a
          problem with USB support and want to see more of what is going on.
 
+config USB_ANNOUNCE_NEW_DEVICES
+       bool "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
+         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
+         in what location.
+
+         If you do not want this kind of information sent to the system
+         log, or have any doubts about this, say N here.
+
 comment "Miscellaneous USB options"
        depends on USB
 
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 24c4116..f7c2219 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -37,6 +37,13 @@
 #define        USB_PERSIST     0
 #endif
 
+/* if we are in debug mode, always announce new devices */
+#ifdef DEBUG
+#ifndef CONFIG_USB_ANNOUNCE_NEW_DEVICES
+#define CONFIG_USB_ANNOUNCE_NEW_DEVICES
+#endif
+#endif
+
 struct usb_hub {
        struct device           *intfdev;       /* the "interface" device */
        struct usb_device       *hdev;
@@ -1207,7 +1214,7 @@ void usb_disconnect(struct usb_device **pdev)
        put_device(&udev->dev);
 }
 
-#ifdef DEBUG
+#ifdef CONFIG_USB_ANNOUNCE_NEW_DEVICES
 static void show_string(struct usb_device *udev, char *id, char *string)
 {
        if (!string)
@@ -1215,12 +1222,24 @@ static void show_string(struct usb_device *udev, char 
*id, char *string)
        dev_printk(KERN_INFO, &udev->dev, "%s: %s\n", id, 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);
+       show_string(udev, "Product", udev->product);
+       show_string(udev, "Manufacturer", udev->manufacturer);
+       show_string(udev, "SerialNumber", udev->serial);
+}
 #else
-static inline void show_string(struct usb_device *udev, char *id, char *string)
-{}
+static inline void announce_device(struct usb_device *udev) { }
 #endif
 
-
 #ifdef CONFIG_USB_OTG
 #include "otg_whitelist.h"
 #endif
@@ -1390,14 +1409,7 @@ int usb_new_device(struct usb_device *udev)
        }
 
        /* Tell the world! */
-       dev_dbg(&udev->dev, "new 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);
+       announce_device(udev);
        return err;
 
 fail:
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to