usb: gadget: uvc: add a new attribute streaming_intf

This patch adds a new uvc attribute "streaming_intf" to
show the number of streaming interface. The uvc application
program may needs to query the information.

Change-Id: I4554e204ab4457f67f35d2e7bfec2902196f79d3
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2019-07-27 16:56:55 +08:00
committed by Tao Huang
parent 2ba042367a
commit 017ed08206
3 changed files with 13 additions and 0 deletions

View File

@@ -913,6 +913,7 @@ uvc_function_bind(struct usb_configuration *c, struct usb_function *f)
}
uvc->streaming_intf = ret;
opts->streaming_intf = ret;
/* Copy descriptors */
f->fs_descriptors = uvc_copy_descriptors(uvc, USB_SPEED_FULL);

View File

@@ -26,6 +26,7 @@ struct f_uvc_opts {
unsigned int streaming_interval;
unsigned int streaming_maxpacket;
unsigned int streaming_maxburst;
unsigned int streaming_intf;
/*
* Control descriptors array pointers for full-/high-speed and

View File

@@ -2204,9 +2204,20 @@ UVCG_OPTS_ATTR(streaming_maxburst, streaming_maxburst, identity_conv,
#undef UVCG_OPTS_ATTR
static ssize_t f_uvc_opts_streaming_intf_show(struct config_item *item,
char *page)
{
struct f_uvc_opts *opts = to_f_uvc_opts(item);
return sprintf(page, "%d\n", opts->streaming_intf);
}
UVC_ATTR_RO(f_uvc_opts_, streaming_intf, streaming_intf);
static struct configfs_attribute *uvc_attrs[] = {
&f_uvc_opts_attr_streaming_bulk,
&f_uvc_opts_attr_streaming_interval,
&f_uvc_opts_attr_streaming_intf,
&f_uvc_opts_attr_streaming_maxpacket,
&f_uvc_opts_attr_streaming_maxburst,
NULL,