]> cvs.zerfleddert.de Git - ms2-fixes/commitdiff
wait for module to be loaded before trying to set parameters
authorMichael Gernoth <michael@gernoth.net>
Mon, 29 Oct 2012 11:42:49 +0000 (12:42 +0100)
committerMichael Gernoth <michael@gernoth.net>
Mon, 29 Oct 2012 11:42:49 +0000 (12:42 +0100)
MS2Debounce/src/de/rmdir/ms2debounce/DebounceModuleHelper.java

index fbcc8374aad6c3532db6fbbacfe9cdf5cb219e12..b01b2b52930fe67dc20e25f8738cbb210bea0de0 100644 (file)
@@ -93,6 +93,16 @@ public class DebounceModuleHelper
 
                runAsRoot(insmod + " " + debounce_ko);
 
+               int cnt = 10;
+               while ((!isLoaded()) && (cnt > 0)) {
+                       try {
+                               Thread.sleep(100);
+                       } catch (Exception e) {
+                               return false;
+                       }
+                       cnt--;
+               }
+
                if (!isLoaded()) {
                        return false;
                }
@@ -123,6 +133,7 @@ public class DebounceModuleHelper
 
        public synchronized boolean isLoaded() {
                boolean loaded = false;
+
                try {
                        String read;
 
@@ -131,10 +142,13 @@ public class DebounceModuleHelper
 
                        while((read = modules_buf.readLine()) != null) {
                                if (read.regionMatches(0, "debounce", 0, 8)) {
-                                       loaded = true;
+                                       File sysdir = new File("/sys/devices/debounce");
+                                       if (sysdir.exists() && sysdir.isDirectory()) {
+                                               loaded = true;
+                                               break;
+                                       }
                                }
                        }
-
                } catch (Exception e) {
                        loaded = false;
                }
Impressum, Datenschutz