summaryrefslogtreecommitdiffstats
path: root/include/linux/usb/gadget.h
diff options
context:
space:
mode:
authorDavid Lopo <lopo.david@gmail.com>2008-04-29 10:12:37 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2008-05-02 10:25:58 -0700
commita5e54b0dbb6a099793caf508b1d6c7d82f965ec3 (patch)
treea36d616f8445e9576214850054b0f1746f9c33be /include/linux/usb/gadget.h
parentc4d0f8cbca3a97900f85b082064a63c7a5928bd7 (diff)
USB GADGET/PERIPHERAL: g_file_storage Bulk-Only Transport compliance
Gadget can tell controller driver to ignore Clear-Feature(HALT_ENDPOINT) This API change enables future support for Bulk-Only Transport compliance Signed-off-by: David Lopo <lopo.david@gmail.com> Acked-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/usb/gadget.h')
-rw-r--r--include/linux/usb/gadget.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index d8128f7102c..cf468fbdbf8 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -114,6 +114,8 @@ struct usb_ep_ops {
int (*dequeue) (struct usb_ep *ep, struct usb_request *req);
int (*set_halt) (struct usb_ep *ep, int value);
+ int (*set_wedge) (struct usb_ep *ep);
+
int (*fifo_status) (struct usb_ep *ep);
void (*fifo_flush) (struct usb_ep *ep);
};
@@ -349,6 +351,25 @@ static inline int usb_ep_clear_halt(struct usb_ep *ep)
}
/**
+ * usb_ep_set_wedge - sets the halt feature and ignores clear requests
+ * @ep: the endpoint being wedged
+ *
+ * Use this to stall an endpoint and ignore CLEAR_FEATURE(HALT_ENDPOINT)
+ * requests. If the gadget driver clears the halt status, it will
+ * automatically unwedge the endpoint.
+ *
+ * Returns zero on success, else negative errno.
+ */
+static inline int
+usb_ep_set_wedge(struct usb_ep *ep)
+{
+ if (ep->ops->set_wedge)
+ return ep->ops->set_wedge(ep);
+ else
+ return ep->ops->set_halt(ep, 1);
+}
+
+/**
* usb_ep_fifo_status - returns number of bytes in fifo, or error
* @ep: the endpoint whose fifo status is being checked.
*