diff options
author | Mike Lockwood <lockwood@android.com> | 2010-06-23 08:20:59 -0400 |
---|---|---|
committer | Colin Cross <ccross@android.com> | 2011-06-14 09:09:07 -0700 |
commit | e2dc503c4220b7d86815283f7d18c0b14af64470 (patch) | |
tree | 86b791420885196c018cc05bd527d5996762d976 /include/linux/usb | |
parent | 0de5a69f62827cbf1cf4a254811aab65200e5a2d (diff) |
USB: gadget: composite: Add userspace notifications for USB state changes
Add switch to notify current USB configuration. This can be used to detect
USB connect and disconnect events.
Broadcast a change via the usb_composite class when a USB function is
enabled or disabled.
Rename usb_function.hidden to usb_function.disabled.
Signed-off-by: Mike Lockwood <lockwood@android.com>
Diffstat (limited to 'include/linux/usb')
-rw-r--r-- | include/linux/usb/composite.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h index a521e8c0e55..0b2d2919edb 100644 --- a/include/linux/usb/composite.h +++ b/include/linux/usb/composite.h @@ -36,6 +36,7 @@ #include <linux/usb/ch9.h> #include <linux/usb/gadget.h> +#include <linux/switch.h> /* * USB function drivers should return USB_GADGET_DELAYED_STATUS if they @@ -108,7 +109,9 @@ struct usb_function { struct usb_descriptor_header **hs_descriptors; struct usb_configuration *config; - int hidden; + + /* disabled is zero if the function is enabled */ + int disabled; /* REVISIT: bind() functions can be marked __init, which * makes trouble for section mismatch analysis. See if @@ -147,6 +150,8 @@ int usb_function_activate(struct usb_function *); int usb_interface_id(struct usb_configuration *, struct usb_function *); +void usb_function_set_enabled(struct usb_function *, int); + /** * ep_choose - select descriptor endpoint at current device speed * @g: gadget, connected and running at some speed @@ -365,6 +370,8 @@ struct usb_composite_dev { /* protects deactivations and delayed_status counts*/ spinlock_t lock; + + struct switch_dev sdev; }; extern int usb_string_id(struct usb_composite_dev *c); |