Fix occasional MTP kernel panic
Add a short sleep between setting up the sysfs entries for MTP and
actually sending MTP data to the MTP device. In some cases a
kernel panic was happening because we were sending data too soon.
Change-Id: Ie5e05690846fc84f161c91829de448bc049f87e2
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index de45493..975d557 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -1904,6 +1904,7 @@
TWFunc::write_file("/sys/class/android_usb/android0/idVendor", vendorstr);
TWFunc::write_file("/sys/class/android_usb/android0/idProduct", productstr);
property_set("sys.usb.config", "mtp,adb");
+ usleep(2000); // Short sleep to prevent an occasional kernel panic on some devices
std::vector<TWPartition*>::iterator iter;
/* To enable MTP debug, use the twrp command line feature to
* twrp set tw_mtp_debug 1