summaryrefslogtreecommitdiffstats
path: root/VolumeManager.cpp
diff options
context:
space:
mode:
authorMike Lockwood <lockwood@android.com>2011-06-17 20:55:07 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-06-17 20:55:07 -0700
commit6b715592ec94f9d75ca8119ace824ff729c104c2 (patch)
treeb01b2dd0e9501285e24c0a18384329e11aa32495 /VolumeManager.cpp
parent86bccb14d6db2435e0115b20e8e30f8200d06ef1 (diff)
parenta976656ff90291b9437a4d37b48e82abcd48195e (diff)
downloadsystem_vold-6b715592ec94f9d75ca8119ace824ff729c104c2.zip
system_vold-6b715592ec94f9d75ca8119ace824ff729c104c2.tar.gz
system_vold-6b715592ec94f9d75ca8119ace824ff729c104c2.tar.bz2
Merge "Remove obsolete code for monitoring USB status"
Diffstat (limited to 'VolumeManager.cpp')
-rw-r--r--VolumeManager.cpp116
1 files changed, 0 insertions, 116 deletions
diff --git a/VolumeManager.cpp b/VolumeManager.cpp
index c21eab3..c41baf3 100644
--- a/VolumeManager.cpp
+++ b/VolumeManager.cpp
@@ -56,47 +56,10 @@ VolumeManager::VolumeManager() {
mVolumes = new VolumeCollection();
mActiveContainers = new AsecIdCollection();
mBroadcaster = NULL;
- mUsbMassStorageEnabled = false;
- mUsbConnected = false;
mUmsSharingCount = 0;
mSavedDirtyRatio = -1;
// set dirty ratio to 0 when UMS is active
mUmsDirtyRatio = 0;
-
- readInitialState();
-}
-
-void VolumeManager::readInitialState() {
- FILE *fp;
- char state[255];
-
- /*
- * Read the initial mass storage enabled state
- */
- if ((fp = fopen("/sys/devices/virtual/usb_composite/usb_mass_storage/enable", "r"))) {
- if (fgets(state, sizeof(state), fp)) {
- mUsbMassStorageEnabled = !strncmp(state, "1", 1);
- } else {
- SLOGE("Failed to read usb_mass_storage enabled state (%s)", strerror(errno));
- }
- fclose(fp);
- } else {
- SLOGD("USB mass storage support is not enabled in the kernel");
- }
-
- /*
- * Read the initial USB connected state
- */
- if ((fp = fopen("/sys/devices/virtual/switch/usb_configuration/state", "r"))) {
- if (fgets(state, sizeof(state), fp)) {
- mUsbConnected = !strncmp(state, "1", 1);
- } else {
- SLOGE("Failed to read usb_configuration switch (%s)", strerror(errno));
- }
- fclose(fp);
- } else {
- SLOGD("usb_configuration switch is not enabled in the kernel");
- }
}
VolumeManager::~VolumeManager() {
@@ -157,56 +120,6 @@ int VolumeManager::addVolume(Volume *v) {
return 0;
}
-void VolumeManager::notifyUmsAvailable(bool available) {
- char msg[255];
-
- snprintf(msg, sizeof(msg), "Share method ums now %s",
- (available ? "available" : "unavailable"));
- SLOGD(msg);
- getBroadcaster()->sendBroadcast(ResponseCode::ShareAvailabilityChange,
- msg, false);
-}
-
-void VolumeManager::handleSwitchEvent(NetlinkEvent *evt) {
- const char *devpath = evt->findParam("DEVPATH");
- const char *name = evt->findParam("SWITCH_NAME");
- const char *state = evt->findParam("SWITCH_STATE");
-
- if (!name || !state) {
- SLOGW("Switch %s event missing name/state info", devpath);
- return;
- }
-
- bool oldAvailable = massStorageAvailable();
- if (!strcmp(name, "usb_configuration")) {
- mUsbConnected = !strcmp(state, "1");
- SLOGD("USB %s", mUsbConnected ? "connected" : "disconnected");
- bool newAvailable = massStorageAvailable();
- if (newAvailable != oldAvailable) {
- notifyUmsAvailable(newAvailable);
- }
- }
-}
-void VolumeManager::handleUsbCompositeEvent(NetlinkEvent *evt) {
- const char *function = evt->findParam("FUNCTION");
- const char *enabled = evt->findParam("ENABLED");
-
- if (!function || !enabled) {
- SLOGW("usb_composite event missing function/enabled info");
- return;
- }
-
- if (!strcmp(function, "usb_mass_storage")) {
- bool oldAvailable = massStorageAvailable();
- mUsbMassStorageEnabled = !strcmp(enabled, "1");
- SLOGD("usb_mass_storage function %s", mUsbMassStorageEnabled ? "enabled" : "disabled");
- bool newAvailable = massStorageAvailable();
- if (newAvailable != oldAvailable) {
- notifyUmsAvailable(newAvailable);
- }
- }
-}
-
void VolumeManager::handleBlockEvent(NetlinkEvent *evt) {
const char *devpath = evt->findParam("DEVPATH");
@@ -961,17 +874,6 @@ int VolumeManager::listMountedObbs(SocketClient* cli) {
return 0;
}
-int VolumeManager::shareAvailable(const char *method, bool *avail) {
-
- if (strcmp(method, "ums")) {
- errno = ENOSYS;
- return -1;
- }
-
- *avail = massStorageAvailable();
- return 0;
-}
-
int VolumeManager::shareEnabled(const char *label, const char *method, bool *enabled) {
Volume *v = lookupVolume(label);
@@ -993,24 +895,6 @@ int VolumeManager::shareEnabled(const char *label, const char *method, bool *ena
return 0;
}
-int VolumeManager::simulate(const char *cmd, const char *arg) {
-
- if (!strcmp(cmd, "ums")) {
- if (!strcmp(arg, "connect")) {
- notifyUmsAvailable(true);
- } else if (!strcmp(arg, "disconnect")) {
- notifyUmsAvailable(false);
- } else {
- errno = EINVAL;
- return -1;
- }
- } else {
- errno = EINVAL;
- return -1;
- }
- return 0;
-}
-
int VolumeManager::shareVolume(const char *label, const char *method) {
Volume *v = lookupVolume(label);