Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 52eeb774 authored by Mayank Rana's avatar Mayank Rana
Browse files

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.

CRs-Fixed: 994161
Change-Id: Id18261d76edd859ef078f4510dd82b8a6c1ca4bd
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 241c08df
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -2199,11 +2199,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);
	}