am 3ec9d06f: Merge "MtpDevice: Handle zero length packets in readResponse()" into honeycomb-mr1
* commit '3ec9d06f070db3a8899ad235736abd0ffaf6f578':
MtpDevice: Handle zero length packets in readResponse()
diff --git a/media/mtp/MtpDevice.cpp b/media/mtp/MtpDevice.cpp
index 4ea8849..2e86159 100644
--- a/media/mtp/MtpDevice.cpp
+++ b/media/mtp/MtpDevice.cpp
@@ -819,6 +819,10 @@
return mResponse.getResponseCode();
}
int ret = mResponse.read(mRequestIn1);
+ // handle zero length packets, which might occur if the data transfer
+ // ends on a packet boundary
+ if (ret == 0)
+ ret = mResponse.read(mRequestIn1);
if (ret >= MTP_CONTAINER_HEADER_SIZE) {
mResponse.dump();
return mResponse.getResponseCode();