From: Michael Gernoth Date: Wed, 31 Oct 2012 07:43:22 +0000 (+0100) Subject: don't try to unload module when it's not loaded, more logging X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/ms2-fixes/commitdiff_plain/f2b5155d2d9182c8f84d481ca73702b0b6d9c3d9 don't try to unload module when it's not loaded, more logging --- diff --git a/MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java b/MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java index 1a424f8..56698dc 100644 --- a/MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java +++ b/MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java @@ -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; } }