usb: gadget: f_fs: Update driver to handle compat id descriptors

Extended compat ID descriptor contains fixed-length header section and
one or more function section. Function section contains five fields as:
bFirstInterfaceNumber, Reserved1, compatibleID, subCompatibleID and
Reserved2. Specification suggests that Reserved1 needs to be set as 0x1
but f_fs driver fails processing descriptors if Reserved1 field is 0x1.
This results into USB enumeration issue due to incomplete descriptors.

This issue is seen with newer adbd which is passing extended compat ID
descriptors.

Change-Id: I6c6dae3ab2322bc914e3b04c8a29b4fcab19322f
Signed-off-by: Mayank Rana <mrana@codeaurora.org>
Signed-off-by: William Wu <william.wu@rock-chips.com>
(am from git@10.10.10.29/kernel/msm android-msm-wahoo-4.4-oreo-dr1
 commit 1431dc81797891e90c4ea37db4f00665df4fe697)
This commit is contained in:
Mayank Rana
2016-03-25 13:57:14 -07:00
committed by Tao Huang
parent c8d875c9c6
commit 548b453dcc

View File

@@ -2073,11 +2073,17 @@ static int __ffs_data_do_os_desc(enum ffs_os_desc_type type,
if (len < sizeof(*d) ||
d->bFirstInterfaceNumber >= ffs->interfaces_count ||
d->Reserved1)
d->Reserved1 != 1) {
pr_err("%s(): Invalid os_desct_ext_compat\n",
__func__);
return -EINVAL;
}
for (i = 0; i < ARRAY_SIZE(d->Reserved2); ++i)
if (d->Reserved2[i])
if (d->Reserved2[i]) {
pr_err("%s(): Invalid Reserved2 of ext_compat\n",
__func__);
return -EINVAL;
}
length = sizeof(struct usb_ext_compat_desc);
}