Loading media/mtp/MtpDevice.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -866,15 +866,19 @@ int MtpDevice::submitEventRequest() { return currentHandle; } int MtpDevice::reapEventRequest(int handle) { int MtpDevice::reapEventRequest(int handle, uint32_t (*parameters)[3]) { Mutex::Autolock autoLock(mEventMutex); if (!mProcessingEvent || mCurrentEventHandle != handle) { if (!mProcessingEvent || mCurrentEventHandle != handle || !parameters) { return -1; } mProcessingEvent = false; const int readSize = mEventPacket.readResponse(mRequestIntr->dev); const int result = mEventPacket.getEventCode(); return readSize == 0 ? 0 : result; // MTP event has three parameters. (*parameters)[0] = mEventPacket.getParameter(1); (*parameters)[1] = mEventPacket.getParameter(2); (*parameters)[2] = mEventPacket.getParameter(3); return readSize != 0 ? result : 0; } void MtpDevice::discardEventRequest(int handle) { Loading media/mtp/MtpDevice.h +3 −2 Original line number Diff line number Diff line Loading @@ -124,8 +124,9 @@ public: int submitEventRequest(); // Waits for MTP event from the device and returns MTP event code. It blocks the current thread // until it receives an event from the device. |handle| should be a request handle returned // by |submitEventRequest|. Returns 0 for cancellations. Returns -1 for errors. int reapEventRequest(int handle); // by |submitEventRequest|. The function writes event parameters to |parameters|. Returns 0 for // cancellations. Returns -1 for errors. int reapEventRequest(int handle, uint32_t (*parameters)[3]); // Cancels an event request. |handle| should be request handle returned by // |submitEventRequest|. If there is a thread blocked by |reapEventRequest| with the same // |handle|, the thread will resume. Loading Loading
media/mtp/MtpDevice.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -866,15 +866,19 @@ int MtpDevice::submitEventRequest() { return currentHandle; } int MtpDevice::reapEventRequest(int handle) { int MtpDevice::reapEventRequest(int handle, uint32_t (*parameters)[3]) { Mutex::Autolock autoLock(mEventMutex); if (!mProcessingEvent || mCurrentEventHandle != handle) { if (!mProcessingEvent || mCurrentEventHandle != handle || !parameters) { return -1; } mProcessingEvent = false; const int readSize = mEventPacket.readResponse(mRequestIntr->dev); const int result = mEventPacket.getEventCode(); return readSize == 0 ? 0 : result; // MTP event has three parameters. (*parameters)[0] = mEventPacket.getParameter(1); (*parameters)[1] = mEventPacket.getParameter(2); (*parameters)[2] = mEventPacket.getParameter(3); return readSize != 0 ? result : 0; } void MtpDevice::discardEventRequest(int handle) { Loading
media/mtp/MtpDevice.h +3 −2 Original line number Diff line number Diff line Loading @@ -124,8 +124,9 @@ public: int submitEventRequest(); // Waits for MTP event from the device and returns MTP event code. It blocks the current thread // until it receives an event from the device. |handle| should be a request handle returned // by |submitEventRequest|. Returns 0 for cancellations. Returns -1 for errors. int reapEventRequest(int handle); // by |submitEventRequest|. The function writes event parameters to |parameters|. Returns 0 for // cancellations. Returns -1 for errors. int reapEventRequest(int handle, uint32_t (*parameters)[3]); // Cancels an event request. |handle| should be request handle returned by // |submitEventRequest|. If there is a thread blocked by |reapEventRequest| with the same // |handle|, the thread will resume. Loading