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

Commit 0866f292 authored by Ajay Agarwal's avatar Ajay Agarwal Committed by Pratham Pratap
Browse files

usb: f_mtp: Limit MTP Tx req length to 16k for ChipIdea



Currently, the f_mtp driver marks the mtp_tx_req_len to 1M.
As a result, file transfer from device to host PC fails for
devices using ChipIdea controller since it does not allow request
length greater than 16k for IN Endpoint. Hence, to allow such
file transfers, limit Tx req length to 16k.

Change-Id: Ib9ca95880ca0b1a2f0c66817e54e9a7b2af53fe6
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
[ppratap@codeaurora.org : replace DBG with mtp_log]
Signed-off-by: default avatarPratham Pratap <ppratap@codeaurora.org>
parent 85866d27
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -1384,6 +1384,12 @@ mtp_function_bind(struct usb_configuration *c, struct usb_function *f)
	dev->cdev = cdev;
	mtp_log("dev: %pK\n", dev);

	/* ChipIdea controller supports 16K request length for IN endpoint */
	if (cdev->gadget->is_chipidea && mtp_tx_req_len > 16384) {
		mtp_log("Truncating Tx Req length to 16K for ChipIdea\n");
		mtp_tx_req_len = 16384;
	}

	/* allocate interface ID(s) */
	id = usb_interface_id(c, f);
	if (id < 0)