mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 19:08:57 +09:00
ANDROID: usb: gadget: f_accessory: fix CTS test stuck
f_accessory: fix CTS test stuck since CTS 9.0. - Refine acc_read() process. The data length that user (test program) wants to read is different from they really requested. This will cause the test flow stuck on the 2nd or the 3rd transfers in accessory test. (By connecting 2 phones with CtsVerifier.apk and CtsVerifierUSBCompanion.apk installed.) Bug: 174729307 Change-Id: I5367c8075ed37534e8bed94b60cc79135ae5aebc Signed-off-by: Macpaul Lin <macpaul.lin@mediatek.com>
This commit is contained in:
@@ -689,6 +689,7 @@ static ssize_t acc_read(struct file *fp, char __user *buf,
|
||||
struct acc_dev *dev = fp->private_data;
|
||||
struct usb_request *req;
|
||||
ssize_t r = count;
|
||||
ssize_t data_length;
|
||||
unsigned xfer;
|
||||
int ret = 0;
|
||||
|
||||
@@ -710,6 +711,15 @@ static ssize_t acc_read(struct file *fp, char __user *buf,
|
||||
goto done;
|
||||
}
|
||||
|
||||
/*
|
||||
* Calculate the data length by considering termination character.
|
||||
* Then compansite the difference of rounding up to
|
||||
* integer multiple of maxpacket size.
|
||||
*/
|
||||
data_length = count;
|
||||
data_length += dev->ep_out->maxpacket - 1;
|
||||
data_length -= data_length % dev->ep_out->maxpacket;
|
||||
|
||||
if (dev->rx_done) {
|
||||
// last req cancelled. try to get it.
|
||||
req = dev->rx_req[0];
|
||||
@@ -719,7 +729,7 @@ static ssize_t acc_read(struct file *fp, char __user *buf,
|
||||
requeue_req:
|
||||
/* queue a request */
|
||||
req = dev->rx_req[0];
|
||||
req->length = count;
|
||||
req->length = data_length;
|
||||
dev->rx_done = 0;
|
||||
ret = usb_ep_queue(dev->ep_out, req, GFP_KERNEL);
|
||||
if (ret < 0) {
|
||||
|
||||
Reference in New Issue
Block a user