Set listener properties for UMS mount/unmount
Some kernels require the usb functions be defined before UMS mounting
of storage partitions will work. This sets the sys.storage.ums_enabled
property upon mount/unmount which can be listened for in init.rc.
Example routines to include in init.rc:
on property:sys.storage.ums_enabled=1
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/functions adb,mass_storage
write /sys/class/android_usb/android0/enable 1
on property:sys.storage.ums_enabled=0
write /sys/class/android_usb/android0/enable 0
write /sys/class/android_usb/android0/functions adb
write /sys/class/android_usb/android0/enable ${service.adb.root}
Change-Id: I8a8ad4b392abbaa173d402714bcb4049ba84ccca
diff --git a/partitionmanager.cpp b/partitionmanager.cpp
index da11e8d..38584a9 100644
--- a/partitionmanager.cpp
+++ b/partitionmanager.cpp
@@ -1520,6 +1520,7 @@
LOGERR("Unable to write to ums lunfile '%s': (%s)\n", Lun_File.c_str(), strerror(errno));
return false;
}
+ property_set("sys.storage.ums_enabled", "1");
return true;
}
@@ -1580,6 +1581,7 @@
Mount_All_Storage();
Update_System_Details();
UnMount_Main_Partitions();
+ property_set("sys.storage.ums_enabled", "0");
if (ret < 0 && index == 0) {
LOGERR("Unable to write to ums lunfile '%s'.", lun_file);
return false;