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

Commit c313b8a7 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge changes If286c5b8,I6679a1c1 into msm-4.14

* changes:
  usb: gadget: f_mtp: Change the icon to camera for PTP composition
  usb: gadget: f_mtp: Handle OS descriptors properly
parents e0d0b5c1 c6875dd9
Loading
Loading
Loading
Loading
+15 −3
Original line number Diff line number Diff line
@@ -310,10 +310,12 @@ struct mtp_ext_config_desc_function {
};

/* MTP Extended Configuration Descriptor */
struct {
struct mtp_ext_config_desc {
	struct mtp_ext_config_desc_header	header;
	struct mtp_ext_config_desc_function    function;
} mtp_ext_config_desc = {
};

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),
@@ -1113,6 +1115,13 @@ static int mtp_ctrlrequest(struct usb_composite_dev *cdev,
			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';
			}
		}
	} else if ((ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_CLASS) {
		DBG(cdev, "class request: %d index: %d value: %d length: %d\n",
@@ -1235,6 +1244,7 @@ mtp_function_bind(struct usb_configuration *c, struct usb_function *f)
		mtp_ss_out_comp_desc.bMaxBurst = max_burst;
	}

	fi_mtp->func_inst.f = &dev->function;
	DBG(cdev, "%s speed %s: IN/%s, OUT/%s\n",
		gadget_is_superspeed(c->cdev->gadget) ? "super" :
		(gadget_is_dualspeed(c->cdev->gadget) ? "dual" : "full"),
@@ -1246,9 +1256,10 @@ static void
mtp_function_unbind(struct usb_configuration *c, struct usb_function *f)
{
	struct mtp_dev	*dev = func_to_mtp(f);
	struct mtp_instance *fi_mtp;
	struct usb_request *req;
	int i;

	fi_mtp = container_of(f->fi, struct mtp_instance, func_inst);
	mtp_string_defs[INTERFACE_STRING_INDEX].id = 0;
	while ((req = mtp_req_get(dev, &dev->tx_idle)))
		mtp_request_free(req, dev->ep_in);
@@ -1259,6 +1270,7 @@ mtp_function_unbind(struct usb_configuration *c, struct usb_function *f)
	dev->state = STATE_OFFLINE;
	kfree(f->os_desc_table);
	f->os_desc_n = 0;
	fi_mtp->func_inst.f = NULL;
}

static int mtp_function_set_alt(struct usb_function *f,