summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTreeHugger Robot <treehugger-gerrit@google.com>2018-08-29 02:24:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2018-08-29 02:24:34 +0000
commit7b5cf1d95ec090fcd8a69c51e9783a3465f1faef (patch)
tree01ef62c7d35c670837c3a0e8680b8503dd5e30d7
parentc81899c885d5de143f43dfcd585b8a05fd629444 (diff)
parent4230b87e5afd0985492343236c196e6f5ed44f69 (diff)
downloadbonito-7b5cf1d95ec090fcd8a69c51e9783a3465f1faef.tar.gz
Merge "Fix PTP mount path" into pi-dev
-rw-r--r--usb/UsbGadget.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/usb/UsbGadget.cpp b/usb/UsbGadget.cpp
index 0941aed1..bc1756df 100644
--- a/usb/UsbGadget.cpp
+++ b/usb/UsbGadget.cpp
@@ -433,8 +433,7 @@ V1_0::Status UsbGadget::setupFunctions(
int i = 0;
std::string bootMode = GetProperty(PERSISTENT_BOOT_MODE, "");
- if (((functions & GadgetFunction::PTP) != 0) ||
- ((functions & GadgetFunction::MTP) != 0)) {
+ if (((functions & GadgetFunction::MTP) != 0)) {
ffsEnabled = true;
ALOGI("setCurrentUsbFunctions mtp");
if (!WriteStringToFile("1", DESC_USE_PATH)) return Status::ERROR;
@@ -448,6 +447,21 @@ V1_0::Status UsbGadget::setupFunctions(
mEndpointList.push_back("/dev/usb-ffs/mtp/ep1");
mEndpointList.push_back("/dev/usb-ffs/mtp/ep2");
mEndpointList.push_back("/dev/usb-ffs/mtp/ep3");
+ } else if (((functions & GadgetFunction::PTP) != 0)) {
+ ffsEnabled = true;
+ ALOGI("setCurrentUsbFunctions ptp");
+ if (!WriteStringToFile("1", DESC_USE_PATH)) return Status::ERROR;
+
+ if (inotify_add_watch(inotifyFd, "/dev/usb-ffs/ptp/", IN_ALL_EVENTS) == -1)
+ return Status::ERROR;
+
+
+ if (linkFunction("ffs.ptp", i++)) return Status::ERROR;
+
+ // Add endpoints to be monitored.
+ mEndpointList.push_back("/dev/usb-ffs/ptp/ep1");
+ mEndpointList.push_back("/dev/usb-ffs/ptp/ep2");
+ mEndpointList.push_back("/dev/usb-ffs/ptp/ep3");
}
if ((functions & GadgetFunction::MIDI) != 0) {