usb/gadget/uvc-configs Fix host unable to negotiate framesizes other than first
Hi Joel,
Thank you for the patch.
Quoted 15 lines · On Tuesday, 20 March 2018 22:28:53 EET Joel Pepper wrote:
- Add bFrameIndex as a
UVCG_FRAME_ATTR_ROfor each frame size.
- Automatically assign ascending bFrameIndex to each frame in a format.Before all "bFrameindex" attributes 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.
Now, when the containing format is linked into the streaming header, iterate over all child frame descriptors and assign ascending indices. The automatically assigned indices can be read from the new read only bFrameIndex configsfs attribute in each frame descriptor item.
Quoted 7 lines
v2: Add the new attribute to both MJPEG and uncompressed frame descriptors in
Documentation/ABI, with note that it was added only in a later kernel versionv3: Changed from simply allowing user to set the value for bFrameIndex to automatically assigning correct distinct frame indexes. Changed bFrameIndex from RW to RO
I like the new commit message, but it would be nice if you could also update the patch contents ;-)
(By the way the subject line should have mentioned "[PATCH v3]")
Quoted 14 lines
Signed-off-by Joel Pepper <[email protected]>--- Documentation/ABI/testing/configfs-usb-gadget-uvc | 17 +++++++++++++++++ drivers/usb/gadget/function/uvc_configfs.c | 3 +++ 2 files changed, 20 insertions(+)(quoted diff) +0
-0b/Documentation/ABI/testing/configfs-usb-gadget-uvc index 1ba0d0f..d435cf7 100644
Documentation/ABI/testing/configfs-usb-gadget-uvc +0
-0@@ -194,6 +194,14 @@ Description: Specific MJPEG frame descriptors bmCapabilities - still image support, fixed frame-rate support
Documentation/ABI/testing/configfs-usb-gadget-uvc Description: Specific MJPEG frame descriptors · line 205
Quoted 10 lines
Documentation/ABI/testing/configfs-usb-gadget-uvc +8
-0+Date: Mar 2018 +KernelVersion: 4.16 + + bFrameIndex - unique id for this framedescriptor; + if using multiple framedescriptors for + same format, user needs to set distinct + value for each frame descriptor + What: /config/usb-gadget/gadget/functions/uvc.name/streaming/
uncompressed
Quoted 40 lines
Documentation/ABI/testing/configfs-usb-gadget-uvc +4
-0Date: Dec 2014 KernelVersion: 4.0@@ -241,6 +249,15 @@ Description: Specific uncompressed frame descriptors bmCapabilities - still image support, fixed frame-rate support +Date: Mar 2018 +KernelVersion: 4.16 + + bFrameIndex - unique id for thisframedescriptor; + if using multiple
framedescriptors for + same format,
user needs to set distinct + value
for each frame descriptor +Documentation/ABI/testing/configfs-usb-gadget-uvc +1
-0+ What: /config/usb-gadget/gadget/functions/uvc.name/streaming/header Date: Dec 2014 KernelVersion: 4.0(quoted diff) +0
-0
b/drivers/usb/gadget/function/uvc_configfs.cindex c9b8cc4a..5966d65 100644drivers/usb/gadget/function/uvc_configfs.c +2
-0@@ -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[] = {drivers/usb/gadget/function/uvc_configfs.c +1
-0&uvcg_frame_attr_bm_capabilities, + &uvcg_frame_attr_b_frame_index, &uvcg_frame_attr_w_width, &uvcg_frame_attr_w_height, &uvcg_frame_attr_dw_min_bit_rate,