]> git.zerfleddert.de Git - ms2-fixes/commitdiff
use module included in ROM (when available)
authorMichael Gernoth <michael@gernoth.net>
Sun, 28 Oct 2012 11:55:47 +0000 (12:55 +0100)
committerMichael Gernoth <michael@gernoth.net>
Sun, 28 Oct 2012 11:55:47 +0000 (12:55 +0100)
MS2Debounce/AndroidManifest.xml
MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java

index d4b5fc9a3a2eeffd526aff3b09036fcfdec3ecf6..18daadcc59f0b7164273d7c3bf350291610e2b6d 100644 (file)
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="utf-8"?>
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
       package="de.rmdir.ms2debounce"
-      android:versionCode="5"
+      android:versionCode="6"
       android:versionName="1.5">
     <uses-sdk android:minSdkVersion="8" />
     <uses-configuration android:reqKeyboardType="qwerty" />
index 2ee55014884806f3637cc82527a6d0415015cd5d..fbcc8374aad6c3532db6fbbacfe9cdf5cb219e12 100644 (file)
@@ -69,9 +69,20 @@ public class DebounceModuleHelper
        }
 
        public synchronized boolean _loadModule() throws NotRootedException,ShellException {
-               File debounce_ko = new File(ctx.getFilesDir() + "/debounce.ko");
+               File insmod = new File("/system/bin/insmod");
+               if (!insmod.exists()) {
+                       insmod = new File("/system/xbin/insmod");
+                       if (!insmod.exists()) {
+                               return false;
+                       }
+               }
 
-               extractModule();
+               File debounce_ko = new File("/system/lib/modules/debounce.ko");
+               if (!debounce_ko.exists()) {
+                       debounce_ko = new File(ctx.getFilesDir() + "/debounce.ko");
+
+                       extractModule();
+               }
 
                SharedPreferences settings = ctx.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
                SharedPreferences.Editor editor = settings.edit();
@@ -80,7 +91,7 @@ public class DebounceModuleHelper
                        editor.commit();
                }
 
-               runAsRoot("/system/bin/insmod " + debounce_ko + " || /system/xbin/insmod " + debounce_ko);
+               runAsRoot(insmod + " " + debounce_ko);
 
                if (!isLoaded()) {
                        return false;
@@ -98,7 +109,16 @@ public class DebounceModuleHelper
        }
 
        public synchronized void unloadModule() throws NotRootedException,ShellException {
-               runAsRoot("/system/bin/rmmod debounce || /system/xbin/rmmod debounce");
+               File rmmod = new File("/system/bin/rmmod");
+
+               if (!rmmod.exists()) {
+                       rmmod = new File("/system/xbin/rmmod");
+                       if (!rmmod.exists()) {
+                               return;
+                       }
+               }
+
+               runAsRoot(rmmod + " debounce");
        }
 
        public synchronized boolean isLoaded() {
Impressum, Datenschutz