Remove configure() from Mtp
Instead of configuring the server each
time the connection happens, UsbService
will now pass in the control fd with the
descriptors already written. Also, PTP
endpoints have been moved to their own
directory at /dev/usb-ffs/ptp rather than
using the same ones as mtp.
Bug: 72877174
Test: Verify PTP and MTP config changes work
Change-Id: I9a0336afd610aa397c9947568c308afb89b27c08
diff --git a/media/mtp/MtpFfsCompatHandle.cpp b/media/mtp/MtpFfsCompatHandle.cpp
index 3dd73f3..d2b342c 100644
--- a/media/mtp/MtpFfsCompatHandle.cpp
+++ b/media/mtp/MtpFfsCompatHandle.cpp
@@ -61,7 +61,8 @@
namespace android {
-MtpFfsCompatHandle::MtpFfsCompatHandle() :
+MtpFfsCompatHandle::MtpFfsCompatHandle(int controlFd) :
+ MtpFfsHandle(controlFd),
mMaxWrite(USB_FFS_MAX_WRITE),
mMaxRead(USB_FFS_MAX_READ) {}
@@ -108,10 +109,8 @@
return ret;
}
-int MtpFfsCompatHandle::start() {
- mLock.lock();
-
- if (!openEndpoints())
+int MtpFfsCompatHandle::start(bool ptp) {
+ if (!openEndpoints(ptp))
return -1;
for (unsigned i = 0; i < NUM_IO_BUFS; i++) {