From d9cb90660a1b39c4900671f334771ef66afb8e00 Mon Sep 17 00:00:00 2001 From: Matt Mower Date: Sat, 14 Dec 2013 20:34:45 -0600 Subject: 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 --- partitionmanager.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/partitionmanager.cpp b/partitionmanager.cpp index da11e8dfe..38584a9fd 100644 --- a/partitionmanager.cpp +++ b/partitionmanager.cpp @@ -1520,6 +1520,7 @@ int TWPartitionManager::Open_Lun_File(string Partition_Path, string Lun_File) { 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 @@ int TWPartitionManager::usb_storage_disable(void) { 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; -- cgit v1.2.3