aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/core/hub.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2007-11-27 01:11:55 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-02-01 17:34:52 -0500
commitf2a383e4de50ad9c03676e57703a97d081798e55 (patch)
treec755110f43b899ba02a554004de87863b1277fab /drivers/usb/core/hub.c
parent5933101718ea3d283983a923c5524c88138e5564 (diff)
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 <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/hub.c')
-rw-r--r--drivers/usb/core/hub.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index 24c411697d1e..f7c2219c800f 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -37,6 +37,13 @@
37#define USB_PERSIST 0 37#define USB_PERSIST 0
38#endif 38#endif
39 39
40/* if we are in debug mode, always announce new devices */
41#ifdef DEBUG
42#ifndef CONFIG_USB_ANNOUNCE_NEW_DEVICES
43#define CONFIG_USB_ANNOUNCE_NEW_DEVICES
44#endif
45#endif
46
40struct usb_hub { 47struct usb_hub {
41 struct device *intfdev; /* the "interface" device */ 48 struct device *intfdev; /* the "interface" device */
42 struct usb_device *hdev; 49 struct usb_device *hdev;
@@ -1207,7 +1214,7 @@ void usb_disconnect(struct usb_device **pdev)
1207 put_device(&udev->dev); 1214 put_device(&udev->dev);
1208} 1215}
1209 1216
1210#ifdef DEBUG 1217#ifdef CONFIG_USB_ANNOUNCE_NEW_DEVICES
1211static void show_string(struct usb_device *udev, char *id, char *string) 1218static void show_string(struct usb_device *udev, char *id, char *string)
1212{ 1219{
1213 if (!string) 1220 if (!string)
@@ -1215,12 +1222,24 @@ static void show_string(struct usb_device *udev, char *id, char *string)
1215 dev_printk(KERN_INFO, &udev->dev, "%s: %s\n", id, string); 1222 dev_printk(KERN_INFO, &udev->dev, "%s: %s\n", id, string);
1216} 1223}
1217 1224
1225static void announce_device(struct usb_device *udev)
1226{
1227 dev_info(&udev->dev, "New USB device found, idVendor=%04x, idProduct=%04x\n",
1228 le16_to_cpu(udev->descriptor.idVendor),
1229 le16_to_cpu(udev->descriptor.idProduct));
1230 dev_info(&udev->dev, "New USB device strings: Mfr=%d, Product=%d, "
1231 "SerialNumber=%d\n",
1232 udev->descriptor.iManufacturer,
1233 udev->descriptor.iProduct,
1234 udev->descriptor.iSerialNumber);
1235 show_string(udev, "Product", udev->product);
1236 show_string(udev, "Manufacturer", udev->manufacturer);
1237 show_string(udev, "SerialNumber", udev->serial);
1238}
1218#else 1239#else
1219static inline void show_string(struct usb_device *udev, char *id, char *string) 1240static inline void announce_device(struct usb_device *udev) { }
1220{}
1221#endif 1241#endif
1222 1242
1223
1224#ifdef CONFIG_USB_OTG 1243#ifdef CONFIG_USB_OTG
1225#include "otg_whitelist.h" 1244#include "otg_whitelist.h"
1226#endif 1245#endif
@@ -1390,14 +1409,7 @@ int usb_new_device(struct usb_device *udev)
1390 } 1409 }
1391 1410
1392 /* Tell the world! */ 1411 /* Tell the world! */
1393 dev_dbg(&udev->dev, "new device strings: Mfr=%d, Product=%d, " 1412 announce_device(udev);
1394 "SerialNumber=%d\n",
1395 udev->descriptor.iManufacturer,
1396 udev->descriptor.iProduct,
1397 udev->descriptor.iSerialNumber);
1398 show_string(udev, "Product", udev->product);
1399 show_string(udev, "Manufacturer", udev->manufacturer);
1400 show_string(udev, "SerialNumber", udev->serial);
1401 return err; 1413 return err;
1402 1414
1403fail: 1415fail: