]> git.zerfleddert.de Git - ms2-fixes/commitdiff
small update to adapt app to new module interface
authorMichael Gernoth <michael@gernoth.net>
Mon, 4 Jul 2011 19:42:06 +0000 (21:42 +0200)
committerMichael Gernoth <michael@gernoth.net>
Mon, 4 Jul 2011 19:42:06 +0000 (21:42 +0200)
MS2Debounce/assets/debounce.ko
MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java

index c6ec28e26513f0f56e98eae5ebf96818fa29a5f6..ebcac51d9e3444f34e36a4a76778882b51d8630e 100644 (file)
Binary files a/MS2Debounce/assets/debounce.ko and b/MS2Debounce/assets/debounce.ko differ
index 9c0a59e5da45e422a6702da9844b3f96504d855d..5e2a47677371e281e619edc0b0b97fa034da1a68 100644 (file)
@@ -4,7 +4,9 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.File;
 import java.io.FileReader;
 import java.io.OutputStream;
 import java.io.File;
 import java.io.FileReader;
+import java.io.FileWriter;
 import java.io.BufferedReader;
 import java.io.BufferedReader;
+import java.io.BufferedWriter;
 import java.io.DataOutputStream;
 
 import android.content.Context;
 import java.io.DataOutputStream;
 
 import android.content.Context;
@@ -21,7 +23,8 @@ public class DebounceModuleHelper
        }
 
        public void loadModule() {
        }
 
        public void loadModule() {
-               loadModule(getSavedDelay());
+               _loadModule();
+               setDelay(getSavedDelay());
        }
 
        protected void runAsRoot(String command) throws java.io.IOException,java.lang.InterruptedException {
        }
 
        protected void runAsRoot(String command) throws java.io.IOException,java.lang.InterruptedException {
@@ -35,7 +38,7 @@ public class DebounceModuleHelper
                rootcmd.waitFor();
        }
 
                rootcmd.waitFor();
        }
 
-       public synchronized void loadModule(int delay) {
+       public synchronized void _loadModule() {
                File debounce_ko = new File(ctx.getFilesDir() + "/debounce.ko");
 
                extractModule();
                File debounce_ko = new File(ctx.getFilesDir() + "/debounce.ko");
 
                extractModule();
@@ -48,7 +51,7 @@ public class DebounceModuleHelper
                }
 
                try {
                }
 
                try {
-                       runAsRoot("/system/bin/insmod " + debounce_ko + " debounce_delay=" + delay);
+                       runAsRoot("/system/bin/insmod " + debounce_ko);
                } catch (Exception e) {
                        return;
                }
                } catch (Exception e) {
                        return;
                }
@@ -99,34 +102,39 @@ public class DebounceModuleHelper
                try {
                        String read;
 
                try {
                        String read;
 
-                       FileReader delay = new FileReader("/sys/module/debounce/parameters/debounce_delay");
+                       FileReader delay = new FileReader("/sys/devices/debounce/debounce_delay");
                        BufferedReader delay_buf = new BufferedReader(delay);
 
                        read = delay_buf.readLine();
                        if (read != null) {
                                debounce_delay = Integer.parseInt(read.trim());
                        }
                        BufferedReader delay_buf = new BufferedReader(delay);
 
                        read = delay_buf.readLine();
                        if (read != null) {
                                debounce_delay = Integer.parseInt(read.trim());
                        }
+
+                       delay_buf.close();
                } catch (Exception e) {}
 
                return debounce_delay;
        }
 
                } catch (Exception e) {}
 
                return debounce_delay;
        }
 
-       public synchronized void setDelay(int delay) {
-               if (isLoaded()) {
-                       if (getDelay() == delay) {
-                               return;
-                       }
-
-                       unloadModule();
+       public synchronized void setDelay(int debounce_delay) {
+               if (!isLoaded()) {
+                       return;
                }
 
                }
 
-               loadModule(delay);
+               try {
+                       FileWriter delay = new FileWriter("/sys/devices/debounce/debounce_delay");
+                       BufferedWriter delay_buf = new BufferedWriter(delay);
+
+                       delay_buf.write((new Integer(debounce_delay)).toString());
+
+                       delay_buf.close();
+               } catch (Exception e) {}
        }
 
        public synchronized int getSavedDelay() {
                SharedPreferences settings = ctx.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
 
        }
 
        public synchronized int getSavedDelay() {
                SharedPreferences settings = ctx.getSharedPreferences(PREFS_NAME, Context.MODE_PRIVATE);
 
-               return settings.getInt("debounce_delay", 15);
+               return settings.getInt("debounce_delay", 8);
        }
 
        public synchronized void setSavedDelay(int delay) {
        }
 
        public synchronized void setSavedDelay(int delay) {
Impressum, Datenschutz