From: Wu, Hao Date: Thu, 17 May 2012 07:23:19 +0000 (+0800) Subject: usb/core: add uevent notification interface for usb warnings X-Git-Tag: 2.1b_release~733 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cc714347c2330219db29e4956cbe5abf9f44c4fb;p=platform%2Fkernel%2Fkernel-mfld-blackbay.git usb/core: add uevent notification interface for usb warnings BZ: 30607 This patch added basic notification function used to send uevents to userspace for usb warnings. Change-Id: I8cac8481d087a59eb069971207e75bb97ab7f3b5 Signed-off-by: Wu, Hao Reviewed-on: http://android.intel.com:8080/49176 Reviewed-by: Zhuang, Jin Can Reviewed-by: Tang, Richard Reviewed-by: Tang, Jianqiang Reviewed-by: Meng, Zhe Tested-by: Meng, Zhe Reviewed-by: buildbot Tested-by: buildbot --- diff --git a/drivers/usb/core/notify.c b/drivers/usb/core/notify.c index 7542dce..cc35a8b 100644 --- a/drivers/usb/core/notify.c +++ b/drivers/usb/core/notify.c @@ -66,3 +66,17 @@ void usb_notify_remove_bus(struct usb_bus *ubus) { blocking_notifier_call_chain(&usb_notifier_list, USB_BUS_REMOVE, ubus); } + +void usb_notify_warning(struct usb_device *udev, int error) +{ + char *notsupport[2] = { "USB_WARNING=DEVICE_NOT_SUPPORT", NULL }; + char *notrespond[2] = { "USB_WARNING=DEVICE_NOT_RESPONDING", NULL }; + char **uevent_envp = NULL; + + if (error == -ETIMEDOUT) + uevent_envp = notrespond; + else + uevent_envp = notsupport; + + kobject_uevent_env(&udev->dev.kobj, KOBJ_CHANGE, uevent_envp); +} diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index d44d4b7..39099f5 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -162,3 +162,5 @@ extern void usb_notify_remove_device(struct usb_device *udev); extern void usb_notify_add_bus(struct usb_bus *ubus); extern void usb_notify_remove_bus(struct usb_bus *ubus); +/* uevent notify stuff */ +extern void usb_notify_warning(struct usb_device *udev, int error);