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

Commit d97d79c2 authored by James Wei's avatar James Wei
Browse files

MTP: handle cancel event while copying file

While received canceling event, error code is set but not
returned with correct state

Bug: 65644242
Test: manually copy file with / without cancel under Win10
Test: atest MtpFfsHandleTest
Change-Id: I601599c77bdd7c8615ed63970c8b22b8c5fcc315
parent 6976bebc
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -212,7 +212,6 @@ int MtpFfsHandle::handleControlRequest(const struct usb_ctrlrequest *setup) {
    uint16_t value = setup->wValue;
    std::vector<char> buf;
    buf.resize(length);
    int ret = 0;

    if (!(type & USB_DIR_IN)) {
        if (::read(mControl, buf.data(), length) != length) {
@@ -225,8 +224,8 @@ int MtpFfsHandle::handleControlRequest(const struct usb_ctrlrequest *setup) {
        case MTP_REQ_RESET:
        case MTP_REQ_CANCEL:
            errno = ECANCELED;
            ret = -1;
            break;
            return -1;
        //    break;
        case MTP_REQ_GET_DEVICE_STATUS:
        {
            if (length < sizeof(struct mtp_device_status) + 4) {