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

Commit 01bf131a authored by qctecmdr's avatar qctecmdr Committed by Gerrit - the friendly Code Review server
Browse files

Merge "usb: f_mtp: Don't handle OS descriptors from MTP driver"

parents e0c39261 5d93fbb5
Loading
Loading
Loading
Loading
+5 −28
Original line number Diff line number Diff line
@@ -354,20 +354,6 @@ struct mtp_ext_config_desc {
	struct mtp_ext_config_desc_function    function;
};

static struct mtp_ext_config_desc mtp_ext_config_desc = {
	.header = {
		.dwLength = __constant_cpu_to_le32(sizeof(mtp_ext_config_desc)),
		.bcdVersion = __constant_cpu_to_le16(0x0100),
		.wIndex = __constant_cpu_to_le16(4),
		.bCount = 1,
	},
	.function = {
		.bFirstInterfaceNumber = 0,
		.bInterfaceCount = 1,
		.compatibleID = { 'M', 'T', 'P' },
	},
};

struct mtp_device_status {
	__le16	wLength;
	__le16	wCode;
@@ -1328,20 +1314,7 @@ static int mtp_ctrlrequest(struct usb_composite_dev *cdev,
		mtp_log("vendor request: %d index: %d value: %d length: %d\n",
			ctrl->bRequest, w_index, w_value, w_length);

		if (ctrl->bRequest == 1
				&& (ctrl->bRequestType & USB_DIR_IN)
				&& (w_index == 4 || w_index == 5)) {
			value = (w_length < sizeof(mtp_ext_config_desc) ?
					w_length : sizeof(mtp_ext_config_desc));
			memcpy(cdev->req->buf, &mtp_ext_config_desc, value);

			/* update compatibleID if PTP */
			if (dev->function.fs_descriptors == fs_ptp_descs) {
				struct mtp_ext_config_desc *d = cdev->req->buf;

				d->function.compatibleID[0] = 'P';
			}
		}
		value = -EOPNOTSUPP;
	} else if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_CLASS) {
		mtp_log("class request: %d index: %d value: %d length: %d\n",
			ctrl->bRequest, w_index, w_value, w_length);
@@ -1814,6 +1787,10 @@ struct usb_function_instance *alloc_inst_mtp_ptp(bool mtp_config)
		return ERR_PTR(-ENOMEM);
	fi_mtp->func_inst.set_inst_name = mtp_set_inst_name;
	fi_mtp->func_inst.free_func_inst = mtp_free_inst;
	if (mtp_config)
		memcpy(fi_mtp->mtp_ext_compat_id, "MTP", 3);
	else
		memcpy(fi_mtp->mtp_ext_compat_id, "PTP", 3);

	fi_mtp->mtp_os_desc.ext_compat_id = fi_mtp->mtp_ext_compat_id;
	INIT_LIST_HEAD(&fi_mtp->mtp_os_desc.ext_prop);