]> git.zerfleddert.de Git - ms2-fixes/commitdiff
don't try to unload module when it's not loaded, more logging
authorMichael Gernoth <michael@gernoth.net>
Wed, 31 Oct 2012 07:43:22 +0000 (08:43 +0100)
committerMichael Gernoth <michael@gernoth.net>
Wed, 31 Oct 2012 07:43:22 +0000 (08:43 +0100)
MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java

index 1a424f85842a573927d6c93240ac9af757c3ed36..56698dcd95dc22f4ce219620490f5e52c901813c 100644 (file)
@@ -82,7 +82,10 @@ public class DebounceModuleHelper
        }
 
        public synchronized boolean _loadModule() throws NotRootedException,ShellException {
+               Log.i(TAG, "Loading module");
+
                if (isLoaded()) {
+                       Log.i(TAG, "Module already loaded");
                        return true;
                }
 
@@ -90,6 +93,7 @@ public class DebounceModuleHelper
                if (!insmod.exists()) {
                        insmod = new File("/system/xbin/insmod");
                        if (!insmod.exists()) {
+                               Log.e(TAG, "insmod not found");
                                return false;
                        }
                }
@@ -115,12 +119,14 @@ public class DebounceModuleHelper
                        try {
                                Thread.sleep(100);
                        } catch (Exception e) {
+                               Log.e(TAG, "Got Exception: " + e.getMessage() + " (" + e.getCause() + ")");
                                return false;
                        }
                        cnt--;
                }
 
                if (!isLoaded()) {
+                       Log.e(TAG, "Module doesn't appear to be correctly loaded");
                        return false;
                }
 
@@ -132,15 +138,24 @@ public class DebounceModuleHelper
                editor.putBoolean("safe_to_load", true);
                editor.commit();
 
+               Log.i(TAG, "Module loaded successfully");
                return true;
        }
 
        public synchronized void unloadModule() throws NotRootedException,ShellException {
+               Log.i(TAG, "Unloading module");
+
+               if (!isLoaded()) {
+                       Log.i(TAG, "Module not loaded");
+                       return;
+               }
+
                File rmmod = new File("/system/bin/rmmod");
 
                if (!rmmod.exists()) {
                        rmmod = new File("/system/xbin/rmmod");
                        if (!rmmod.exists()) {
+                               Log.e(TAG, "rmmod not found");
                                return;
                        }
                }
Impressum, Datenschutz