diff --git a/termux-app/src/main/java/com/termux/app/TermuxActivity.java b/termux-app/src/main/java/com/termux/app/TermuxActivity.java index 0c5086a4..f4139cfd 100644 --- a/termux-app/src/main/java/com/termux/app/TermuxActivity.java +++ b/termux-app/src/main/java/com/termux/app/TermuxActivity.java @@ -20,8 +20,11 @@ import android.graphics.Typeface; import android.media.AudioAttributes; import android.media.SoundPool; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.os.IBinder; +import android.system.ErrnoException; +import android.system.Os; import android.text.SpannableString; import android.text.Spanned; import android.text.TextUtils; @@ -609,12 +612,8 @@ public final class TermuxActivity extends Activity implements ServiceConnection return (DrawerLayout) findViewById(R.id.drawer_layout); } - String getPM3ExecutablePath() { - return TermuxService.HOME_PATH + File.separator + "proxmark3"; - } - String[] getPM3Args() { - if (true) return null; + if (false) return null; else { return new String[]{ "socket:DXL.COM.ASL" @@ -622,6 +621,33 @@ public final class TermuxActivity extends Activity implements ServiceConnection } } + public static String getABISupported(boolean has64So) { + if (has64So && Build.SUPPORTED_64_BIT_ABIS.length > 0) + return Build.SUPPORTED_64_BIT_ABIS[0]; + if (!has64So && Build.SUPPORTED_32_BIT_ABIS.length > 0) + return Build.SUPPORTED_32_BIT_ABIS[0]; + if (Build.SUPPORTED_64_BIT_ABIS.length > 0) + return Build.SUPPORTED_64_BIT_ABIS[0]; + if (Build.SUPPORTED_32_BIT_ABIS.length > 0) + return Build.SUPPORTED_32_BIT_ABIS[0]; + return null; + } + + public static String getPM3ClientPath() { + String file = TermuxService.HOME_PATH + + File.separator + + "proxmark3" + + File.separator + + "proxmark3_" + + getABISupported(true); + try { + Os.chmod(file, 0700); + } catch (ErrnoException e) { + e.printStackTrace(); + } + return file; + } + void addNewSession(boolean failSafe, String sessionName) { if (mTermService.getSessions().size() >= MAX_SESSIONS) { new AlertDialog.Builder(this).setTitle(R.string.max_terminals_reached_title).setMessage(R.string.max_terminals_reached_message) @@ -629,7 +655,7 @@ public final class TermuxActivity extends Activity implements ServiceConnection } else { TerminalSession currentSession = getCurrentTermSession(); String workingDirectory = (currentSession == null) ? null : currentSession.getCwd(); - TerminalSession newSession = mTermService.createTermSession(getPM3ExecutablePath(), getPM3Args(), workingDirectory, failSafe); + TerminalSession newSession = mTermService.createTermSession(getPM3ClientPath(), getPM3Args(), workingDirectory, failSafe); if (sessionName != null) { newSession.mSessionName = sessionName; } diff --git a/termux-app/src/main/java/com/termux/app/TermuxInstaller.java b/termux-app/src/main/java/com/termux/app/TermuxInstaller.java index 34275129..2339f557 100644 --- a/termux-app/src/main/java/com/termux/app/TermuxInstaller.java +++ b/termux-app/src/main/java/com/termux/app/TermuxInstaller.java @@ -130,9 +130,6 @@ final class TermuxInstaller { throw new RuntimeException("Unable to rename staging folder"); }*/ - //TODO PM3 Client init - - activity.runOnUiThread(whenDone); } catch (final Exception e) { Log.e(EmulatorDebug.LOG_TAG, "Bootstrap error", e);