From aadf9c06d74fbb41af7be39661055fd367b4c643 Mon Sep 17 00:00:00 2001 From: Arne Schwabe Date: Tue, 17 Jul 2012 20:17:19 +0200 Subject: Implementier modprobe tun for more braindead images --- src/de/blinkt/openvpn/LaunchVPN.java | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) (limited to 'src/de/blinkt/openvpn/LaunchVPN.java') diff --git a/src/de/blinkt/openvpn/LaunchVPN.java b/src/de/blinkt/openvpn/LaunchVPN.java index b057a392..7b1c6cce 100644 --- a/src/de/blinkt/openvpn/LaunchVPN.java +++ b/src/de/blinkt/openvpn/LaunchVPN.java @@ -350,21 +350,14 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { // Check if we want to fix /dev/tun SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this); boolean usecm9fix = prefs.getBoolean("useCM9Fix", false); + boolean loadTunModule = prefs.getBoolean("loadTunModule", false); if(usecm9fix && !mCmfixed ) { - ProcessBuilder pb = new ProcessBuilder(new String[] {"su","-c","chown system /dev/tun"}); - try { - Process p = pb.start(); - int ret = p.waitFor(); - if(ret ==0) - mCmfixed=true; - } catch (InterruptedException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } + execeuteSUcmd("chown system /dev/tun"); } + if(loadTunModule) + execeuteSUcmd("modprobe tun"); if (intent != null) { @@ -383,6 +376,20 @@ public class LaunchVPN extends ListActivity implements OnItemClickListener { } + private void execeuteSUcmd(String command) { + ProcessBuilder pb = new ProcessBuilder(new String[] {"su","-c",command}); + try { + Process p = pb.start(); + int ret = p.waitFor(); + if(ret ==0) + mCmfixed=true; + } catch (InterruptedException e) { + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + } + private class startOpenVpnThread extends Thread { @Override -- cgit v1.2.3