[PATCH v4 08/43] usb: gadget: composite: introduce new USB function ops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Introduce two new USB function operations:

1. prep_descs() prepares and assigns entity (interface and endpoint)
descriptors to USB function. It's mandatory, in the new function API,
as each USB function should have at least minimalistic set of entity
descriptors. The minimum is single inferface with one altsetting with
no endpoins (ep0 only). Descriptors assigned to function in prep_descs()
callback are used during bind procedure.

2. prep_vendor_descs() - prepares and assigns class and vendor specific
descriptors to function. This function is called after binding function
to UDC hardware, which means that interface numbers and endpoint addresses
are already assigned so that function can use these values to prepare
class or vendor specific descriptors and attach them to function.

Signed-off-by: Robert Baldyga <r.baldyga@xxxxxxxxxxx>
---
 include/linux/usb/composite.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index 91948c7..7ede101 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -293,6 +293,10 @@ struct usb_os_desc_table {
  *	can expose more than one interface. If an interface is a member of
  *	an IAD, only the first interface of IAD has its entry in the table.
  * @os_desc_n: Number of entries in os_desc_table
+ * @prep_descs: Returns standard function descriptors (interface and endpoint
+ *	descritptors).
+ * @prep_vendor_descs: Attaches vendor or class specific descriptors to
+ *	standard descriptors.
  * @bind: Before the gadget can register, all of its functions bind() to the
  *	available resources including string and interface identifiers used
  *	in interface or class descriptors; endpoints; I/O buffers; and so on.
@@ -361,6 +365,10 @@ struct usb_function {
 	 * Related:  unbind() may kfree() but bind() won't...
 	 */
 
+	/* new function API*/
+	int			(*prep_descs)(struct usb_function *);
+	int			(*prep_vendor_descs)(struct usb_function *);
+
 	/* configuration management:  bind/unbind */
 	int			(*bind)(struct usb_configuration *,
 					struct usb_function *);
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux