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

Commit 50439244 authored by Jack Pham's avatar Jack Pham
Browse files

usb: gadget: f_mtp: Change the icon to camera for PTP composition



The PTP function currently returns the same Extended Configuration
Descriptor as that of MTP. This results in Windows hosts displaying
a phone icon rather than a camera icon. Update the compatibleID
to correctly indicate the PTP configuration.

Change-Id: If286c5b80874a95be0b5ecc533d0e5c7a14f39d3
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent fc2b8f06
Loading
Loading
Loading
Loading
+11 −2
Original line number Diff line number Diff line
@@ -330,10 +330,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),
@@ -1271,6 +1273,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",