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 From 26ff4c02af239f80e65de5f4571fbecfcc2a3e09 Mon Sep 17 00:00:00 2001 From: Jason Riordan Date: Thu, 16 Jan 2014 22:44:15 -0500 Subject: Enable UMS mounting of storage drives Change-Id: I4c369222cf16cb5bd87f007c3b172cd787d20fb1 --- etc/init.rc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/etc/init.rc b/etc/init.rc index aeec483a3..8cff20ec6 100644 --- a/etc/init.rc +++ b/etc/init.rc @@ -41,6 +41,16 @@ on boot on property:sys.powerctl=* powerctl ${sys.powerctl} +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} + service ueventd /sbin/ueventd critical -- cgit v1.2.3