From: moo Date: Fri, 10 Oct 2025 22:32:11 +0000 (-0700) Subject: Fix buttton, should work now X-Git-Url: https://git.taranathan.com/?a=commitdiff_plain;h=fcb77568c4f0397ed3f1ae5814153d30bd0b4e19;p=FRC2026.git Fix buttton, should work now Fixed by making it copy the sshpass bin to obtain executable file permissions. --- diff --git a/src/main/java/frc/robot/commands/vision/ShutdownOrangePi.java b/src/main/java/frc/robot/commands/vision/ShutdownOrangePi.java index 22e947a..7817ef9 100644 --- a/src/main/java/frc/robot/commands/vision/ShutdownOrangePi.java +++ b/src/main/java/frc/robot/commands/vision/ShutdownOrangePi.java @@ -1,8 +1,13 @@ package frc.robot.commands.vision; +import java.nio.file.CopyOption; +import java.nio.file.FileSystems; import java.nio.file.Files; import java.nio.file.Path; +import java.nio.file.StandardCopyOption; import java.nio.file.attribute.PosixFilePermissions; +import java.nio.file.attribute.UserPrincipal; +import java.nio.file.attribute.UserPrincipalLookupService; import edu.wpi.first.wpilibj.Filesystem; import edu.wpi.first.wpilibj2.command.Command; @@ -39,8 +44,14 @@ public class ShutdownOrangePi extends Command { } try { - String binPath = Filesystem.getDeployDirectory() + "/sshpass"; - Files.setPosixFilePermissions(Path.of(binPath), PosixFilePermissions.fromString("rwxr-xr-x")); + String initialPath = Filesystem.getDeployDirectory() + "/sshpass"; + Path initalPathPath = Path.of(initialPath); + String binPath = "/home/lvuser/sshpass2"; + Path binPathPath = Path.of(binPath); + //copies to be able to get executable permissions on the new binary + Files.copy(initalPathPath, binPathPath, StandardCopyOption.REPLACE_EXISTING); + + Files.setPosixFilePermissions(binPathPath, PosixFilePermissions.fromString("rwxr-xr-x")); String[] commandString = new String[] { binPath, @@ -54,7 +65,7 @@ public class ShutdownOrangePi extends Command { this.process = Runtime.getRuntime().exec(commandString); } catch (Exception e) { String message = e.getMessage() == null ? "unknown" : e.getMessage(); - System.out.println("Failed to shutdown OrangePi. Reason: " + message); + System.out.println("Failed to shutdown OrangePi. Reason: " + e.getClass() + " -- " + message); } }