From b71db443ea7998de4dfddce7adad640db70f221c Mon Sep 17 00:00:00 2001 From: David Brownell Date: Wed, 24 Mar 2004 21:43:15 -0800 Subject: [PATCH] USB: USB gadgets can autoconfigure endpoints This adds some code that gadget drivers can call from driver initialization, to simplify the "configure against this hardware" step. Add endpoint autoconfiguration for gadget drivers. Endpoint selection is currently being done with conditional compilation. That doesn't look nice, but more importantly it doesn't work well with the model that some distributions won't be custom-matched to hardware. Say, a PDA distro running on iPaq (pxa2xx_udc) or Axim (mq11xx_udc). This code just makes it easier for drivers to match to hardware at run-time. It's a convenience function for something they could have been doing already, but weren't. --- include/linux/usb_gadget.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/linux') diff --git a/include/linux/usb_gadget.h b/include/linux/usb_gadget.h index 503abfe9a9aa..3ba4e10d0372 100644 --- a/include/linux/usb_gadget.h +++ b/include/linux/usb_gadget.h @@ -731,6 +731,15 @@ int usb_descriptor_fillbuf(void *, unsigned, int usb_gadget_config_buf(const struct usb_config_descriptor *config, void *buf, unsigned buflen, const struct usb_descriptor_header **desc); +/*-------------------------------------------------------------------------*/ + +/* utility wrapping a simple endpoint selection policy */ + +extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *, + struct usb_endpoint_descriptor *) __init; + +extern void usb_ep_autoconfig_reset (struct usb_gadget *) __init; + #endif /* __KERNEL__ */ #endif /* __LINUX_USB_GADGET_H */ -- cgit v1.2.3