On Mon, Mar 19, 2018 at 11:55:02AM +0100, Joel Pepper wrote:
> This adds bFrameIndex as a UVCG_FRAME_ATTR for each frame size.
> Beforehand all bFrameindex were set to "1" with no way to configure the 
> gadget otherwise.
> 
> This resulted in the host always negotiating for bFrameIndex 1 (i.e. the
> first framesize of the gadget).
> After the negotiation the host driver will set the user- or application-
> selected framesize while the gadget is actually set to the first
> framesize.
> 
> Note that this still requires the gadget to be configured with unique 
> 'bFrameindex's for each frameSize of each format through configfs. An
> alternative might be to automatically assign ascending indices when the
> format is linked into the streaming header, but the user space gadget
> application would need a way to check or predict the indices so that it
> can properly interpret PROBE/COMMIT CONTROL requests.
> 
> Signed-off-by: Joel Pepper <joel.pep...@rwth-aachen.de>
> ---
>  drivers/usb/gadget/function/uvc_configfs.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/usb/gadget/function/uvc_configfs.c 
> b/drivers/usb/gadget/function/uvc_configfs.c
> index c9b8cc4a..5966d65 100644
> --- a/drivers/usb/gadget/function/uvc_configfs.c
> +++ b/drivers/usb/gadget/function/uvc_configfs.c
> @@ -992,6 +992,8 @@ UVC_ATTR(uvcg_frame_, cname, aname);
>  
>  UVCG_FRAME_ATTR(bm_capabilities, bmCapabilities, noop_conversion,
>               noop_conversion, 8);
> +UVCG_FRAME_ATTR(b_frame_index, bFrameIndex, noop_conversion,
> +             noop_conversion, 8);
>  UVCG_FRAME_ATTR(w_width, wWidth, le16_to_cpu, cpu_to_le16, 16);
>  UVCG_FRAME_ATTR(w_height, wHeight, le16_to_cpu, cpu_to_le16, 16);
>  UVCG_FRAME_ATTR(dw_min_bit_rate, dwMinBitRate, le32_to_cpu, cpu_to_le32, 32);
> @@ -1137,6 +1139,7 @@ UVC_ATTR(uvcg_frame_, dw_frame_interval, 
> dwFrameInterval);
>  
>  static struct configfs_attribute *uvcg_frame_attrs[] = {
>       &uvcg_frame_attr_bm_capabilities,
> +     &uvcg_frame_attr_b_frame_index,

Isn't there also a Documentation/ABI/ update you need to do for this new
file?

thanks,

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

Reply via email to