Loading media/mtp/MtpServer.cpp +42 −23 Original line number Diff line number Diff line Loading @@ -325,6 +325,14 @@ bool MtpServer::handleRequest() { mSendObjectHandle = kInvalidObjectHandle; } int containertype = mRequest.getContainerType(); if (containertype != MTP_CONTAINER_TYPE_COMMAND) { ALOGE("wrong container type %d", containertype); return false; } ALOGV("got command %s (%x)", MtpDebug::getOperationCodeName(operation), operation); switch (operation) { case MTP_OPERATION_GET_DEVICE_INFO: response = doGetDeviceInfo(); Loading Loading @@ -415,7 +423,8 @@ bool MtpServer::handleRequest() { response = doEndEditObject(); break; default: ALOGE("got unsupported command %s", MtpDebug::getOperationCodeName(operation)); ALOGE("got unsupported command %s (%x)", MtpDebug::getOperationCodeName(operation), operation); response = MTP_RESPONSE_OPERATION_NOT_SUPPORTED; break; } Loading Loading @@ -950,9 +959,14 @@ MtpResponseCode MtpServer::doSendObject() { fchmod(mfr.fd, mFilePermission); umask(mask); if (initialData > 0) if (initialData > 0) { ret = write(mfr.fd, mData.getData(), initialData); } if (ret < 0) { ALOGE("failed to write initial data"); result = MTP_RESPONSE_GENERAL_ERROR; } else { if (mSendObjectFileSize - initialData > 0) { mfr.offset = initialData; if (mSendObjectFileSize == 0xFFFFFFFF) { Loading @@ -967,6 +981,7 @@ MtpResponseCode MtpServer::doSendObject() { ret = ioctl(mFD, MTP_RECEIVE_FILE, (unsigned long)&mfr); ALOGV("MTP_RECEIVE_FILE returned %d\n", ret); } } close(mfr.fd); if (ret < 0) { Loading Loading @@ -1131,6 +1146,9 @@ MtpResponseCode MtpServer::doSendPartialObject() { length -= initialData; } if (ret < 0) { ALOGE("failed to write initial data"); } else { if (length > 0) { mtp_file_range mfr; mfr.fd = edit->mFD; Loading @@ -1141,6 +1159,7 @@ MtpResponseCode MtpServer::doSendPartialObject() { ret = ioctl(mFD, MTP_RECEIVE_FILE, (unsigned long)&mfr); ALOGV("MTP_RECEIVE_FILE returned %d", ret); } } if (ret < 0) { mResponse.setParameter(1, 0); if (errno == ECANCELED) Loading Loading
media/mtp/MtpServer.cpp +42 −23 Original line number Diff line number Diff line Loading @@ -325,6 +325,14 @@ bool MtpServer::handleRequest() { mSendObjectHandle = kInvalidObjectHandle; } int containertype = mRequest.getContainerType(); if (containertype != MTP_CONTAINER_TYPE_COMMAND) { ALOGE("wrong container type %d", containertype); return false; } ALOGV("got command %s (%x)", MtpDebug::getOperationCodeName(operation), operation); switch (operation) { case MTP_OPERATION_GET_DEVICE_INFO: response = doGetDeviceInfo(); Loading Loading @@ -415,7 +423,8 @@ bool MtpServer::handleRequest() { response = doEndEditObject(); break; default: ALOGE("got unsupported command %s", MtpDebug::getOperationCodeName(operation)); ALOGE("got unsupported command %s (%x)", MtpDebug::getOperationCodeName(operation), operation); response = MTP_RESPONSE_OPERATION_NOT_SUPPORTED; break; } Loading Loading @@ -950,9 +959,14 @@ MtpResponseCode MtpServer::doSendObject() { fchmod(mfr.fd, mFilePermission); umask(mask); if (initialData > 0) if (initialData > 0) { ret = write(mfr.fd, mData.getData(), initialData); } if (ret < 0) { ALOGE("failed to write initial data"); result = MTP_RESPONSE_GENERAL_ERROR; } else { if (mSendObjectFileSize - initialData > 0) { mfr.offset = initialData; if (mSendObjectFileSize == 0xFFFFFFFF) { Loading @@ -967,6 +981,7 @@ MtpResponseCode MtpServer::doSendObject() { ret = ioctl(mFD, MTP_RECEIVE_FILE, (unsigned long)&mfr); ALOGV("MTP_RECEIVE_FILE returned %d\n", ret); } } close(mfr.fd); if (ret < 0) { Loading Loading @@ -1131,6 +1146,9 @@ MtpResponseCode MtpServer::doSendPartialObject() { length -= initialData; } if (ret < 0) { ALOGE("failed to write initial data"); } else { if (length > 0) { mtp_file_range mfr; mfr.fd = edit->mFD; Loading @@ -1141,6 +1159,7 @@ MtpResponseCode MtpServer::doSendPartialObject() { ret = ioctl(mFD, MTP_RECEIVE_FILE, (unsigned long)&mfr); ALOGV("MTP_RECEIVE_FILE returned %d", ret); } } if (ret < 0) { mResponse.setParameter(1, 0); if (errno == ECANCELED) Loading