diff options
author | San Mehat <san@google.com> | 2009-12-22 08:32:33 -0800 |
---|---|---|
committer | San Mehat <san@google.com> | 2010-01-01 10:57:33 -0800 |
commit | 0cde53ce7b44ce189d0bc6fa81c0036e096deb51 (patch) | |
tree | 80194ce3c0bc0ca293e6a4bc791a8026774d534d /main.cpp | |
parent | a1c2ca1c70e52cccb7e63f4be8d7127b22afc0e5 (diff) | |
download | system_vold-0cde53ce7b44ce189d0bc6fa81c0036e096deb51.zip system_vold-0cde53ce7b44ce189d0bc6fa81c0036e096deb51.tar.gz system_vold-0cde53ce7b44ce189d0bc6fa81c0036e096deb51.tar.bz2 |
vold2: Manually bootstrap the ums switch since switch kernel uevents are broken
Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'main.cpp')
-rw-r--r-- | main.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -78,6 +78,35 @@ int main() { } coldboot("/sys/block"); + /* + * Switch uevents are broken. + * For now we manually bootstrap + * the ums switch + */ + { + FILE *fp; + char state[255]; + + if (!(fp = fopen("/sys/devices/virtual/switch/usb_mass_storage/state", + "r"))) { + LOGE("Failed to open ums switch (%s)", strerror(errno)); + exit(1); + } + if (!fgets(state, sizeof(state), fp)) { + LOGE("Failed to read switch state (%s)", strerror(errno)); + fclose(fp); + exit(1); + } + if (!strncmp(state, "online", 6)) { + LOGD("Bootstrapped ums is connected"); + vm->notifyUmsConnected(true); + } else { + LOGD("Bootstrapped ums is disconnected"); + vm->notifyUmsConnected(false); + } + fclose(fp); + } +// coldboot("/sys/class/switch"); /* * Now that we're up, we can respond to commands |