From bd1e6725744ea080054426936c2bcbe1a7261a3b Mon Sep 17 00:00:00 2001 From: samfreund Date: Wed, 2 Jul 2025 12:53:40 -0500 Subject: [PATCH 01/11] exit and delete-self on systemcore --- .../src/main/java/org/photonvision/Main.java | 53 +++++++++++++++++++ .../common/hardware/Platform.java | 4 ++ 2 files changed, 57 insertions(+) diff --git a/photon-server/src/main/java/org/photonvision/Main.java b/photon-server/src/main/java/org/photonvision/Main.java index 7e527e3f83..93e676e363 100644 --- a/photon-server/src/main/java/org/photonvision/Main.java +++ b/photon-server/src/main/java/org/photonvision/Main.java @@ -18,8 +18,14 @@ package org.photonvision; import edu.wpi.first.hal.HAL; +import java.io.File; +import java.io.FileWriter; import java.io.IOException; +import java.net.URISyntaxException; +import java.net.URL; import java.nio.file.Path; +import java.security.CodeSource; +import java.security.ProtectionDomain; import java.util.ArrayList; import java.util.List; import org.apache.commons.cli.*; @@ -172,6 +178,36 @@ public static void main(String[] args) { + Platform.getPlatformName() + (Platform.isRaspberryPi() ? (" (Pi " + PiVersion.getPiVersion() + ")") : "")); + if (Platform.isSystemCore()) { + File jarLocation = getJarLocation(); + if (jarLocation == null) { + logger.error("SystemCore is not a supported platform for PhotonVision!"); + System.exit(1); + } + // Make a file where the PV JAR is located indicating systemcore is not supported + try { + File notSupportedFile = + new File(jarLocation.getParent(), "SYSTEMCORE_NOT_SUPPORTED_BY_PHOTONVISION.txt"); + try (FileWriter writer = new FileWriter(notSupportedFile)) { + writer.write("SystemCore is not a supported platform for PhotonVision.\n"); + writer.write("PhotonVision has been uninstalled from this device.\n"); + writer.write("Please visit https://docs.photonvision.org for supported platforms."); + } + } catch (IOException e) { + logger.error("Failed to create SystemCore not supported file", e); + System.exit(1); + } + + // Delete the PV JAR + if (!jarLocation.delete()) { + logger.error("Failed to delete PhotonVision JAR file on SystemCore!"); + System.exit(1); + } + + // Exit + System.exit(1); + } + if (OsImageVersion.IMAGE_VERSION.isPresent()) { logger.info("PhotonVision image version: " + OsImageVersion.IMAGE_VERSION.get()); } @@ -308,4 +344,21 @@ public static void main(String[] args) { HardwareManager.getInstance().setRunning(true); Server.initialize(DEFAULT_WEBPORT); } + + public static File getJarLocation() { + try { + ProtectionDomain protectionDomain = Main.class.getProtectionDomain(); + CodeSource codeSource = protectionDomain.getCodeSource(); + if (codeSource != null) { + URL location = codeSource.getLocation(); + return new File(location.toURI()); + } else { + logger.error("Could not determine JAR location: code source is null"); + return null; + } + } catch (URISyntaxException e) { + logger.error("Error determining JAR location", e); + return null; + } + } } diff --git a/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java b/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java index 5603989a41..fe9913cd7f 100644 --- a/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java +++ b/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java @@ -124,6 +124,10 @@ public static boolean isRK3588() { return Platform.isOrangePi() || Platform.isCoolPi4b() || Platform.isRock5C(); } + public static boolean isSystemCore() { + return new File("/home/systemcore").exists(); + } + public static boolean isRaspberryPi() { return currentPlatform.isPi; } From 566a9a0760cef5f6424747abcc7108f096af0772 Mon Sep 17 00:00:00 2001 From: samfreund Date: Wed, 2 Jul 2025 13:00:45 -0500 Subject: [PATCH 02/11] update docs to reflect systemcore not being supported --- docs/source/docs/quick-start/common-setups.md | 5 +++++ photon-server/src/main/java/org/photonvision/Main.java | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/source/docs/quick-start/common-setups.md b/docs/source/docs/quick-start/common-setups.md index 7d6ffaf602..767c4f535e 100644 --- a/docs/source/docs/quick-start/common-setups.md +++ b/docs/source/docs/quick-start/common-setups.md @@ -13,6 +13,11 @@ PhotonVision requires dedicated hardware, above and beyond a roboRIO. This page The Orange Pi 5 is the only currently supported device for object detection. ::: +## SystemCore Support + +The SystemCore is not supported by PhotonVision. PhotonVision is designed to utilize the entirety of the coprocessor's resources, and this could prove to be dangerous if attempted on the main robot controller. +There are no current plans to support running on SystemCore alongside robot code, and any attempts to do so are entirely at your own risk and will require a separate fork of PhotonVision. + ## SD Cards - 8GB or larger micro SD card diff --git a/photon-server/src/main/java/org/photonvision/Main.java b/photon-server/src/main/java/org/photonvision/Main.java index 93e676e363..6c224c1e8c 100644 --- a/photon-server/src/main/java/org/photonvision/Main.java +++ b/photon-server/src/main/java/org/photonvision/Main.java @@ -191,7 +191,7 @@ public static void main(String[] args) { try (FileWriter writer = new FileWriter(notSupportedFile)) { writer.write("SystemCore is not a supported platform for PhotonVision.\n"); writer.write("PhotonVision has been uninstalled from this device.\n"); - writer.write("Please visit https://docs.photonvision.org for supported platforms."); + writer.write("Please visit https://docs.photonvision.org/en/stable/docs/quick-start/common-setups.html#Unsupported-devices for more information."); } } catch (IOException e) { logger.error("Failed to create SystemCore not supported file", e); From 9ca00cbba0a4e8a262fa0d1ed62e95613281af37 Mon Sep 17 00:00:00 2001 From: samfreund Date: Wed, 2 Jul 2025 14:05:40 -0500 Subject: [PATCH 03/11] some debugging update stuff I missed --- .../src/main/java/org/photonvision/Main.java | 9 +++++++-- .../org/photonvision/common/hardware/Platform.java | 14 ++++++++++++-- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/photon-server/src/main/java/org/photonvision/Main.java b/photon-server/src/main/java/org/photonvision/Main.java index 6c224c1e8c..ace601f138 100644 --- a/photon-server/src/main/java/org/photonvision/Main.java +++ b/photon-server/src/main/java/org/photonvision/Main.java @@ -179,9 +179,13 @@ public static void main(String[] args) { + (Platform.isRaspberryPi() ? (" (Pi " + PiVersion.getPiVersion() + ")") : "")); if (Platform.isSystemCore()) { + logger.error( + "SystemCore is not a supported platform for PhotonVision!\n " + + "PhotonVision will now proceed to uninstall itself from this device.\n" + + "Please visit https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#unsupported-devices for more information."); + File jarLocation = getJarLocation(); if (jarLocation == null) { - logger.error("SystemCore is not a supported platform for PhotonVision!"); System.exit(1); } // Make a file where the PV JAR is located indicating systemcore is not supported @@ -191,7 +195,8 @@ public static void main(String[] args) { try (FileWriter writer = new FileWriter(notSupportedFile)) { writer.write("SystemCore is not a supported platform for PhotonVision.\n"); writer.write("PhotonVision has been uninstalled from this device.\n"); - writer.write("Please visit https://docs.photonvision.org/en/stable/docs/quick-start/common-setups.html#Unsupported-devices for more information."); + writer.write( + "Please visit https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#unsupported-devices for more information."); } } catch (IOException e) { logger.error("Failed to create SystemCore not supported file", e); diff --git a/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java b/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java index fe9913cd7f..7bbd2d99c1 100644 --- a/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java +++ b/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java @@ -44,6 +44,13 @@ public enum Platform { true, OSType.LINUX, true), // Raspberry Pi 3/4 with a 64-bit image + LINUX_SYSTEMCORE( + "Linux Systemcore 64-bit NOT SUPPORTED", + Platform::getUnknownModel, + "linuxarm64", + false, + OSType.LINUX, + false), // SystemCore 64-bit LINUX_RK3588_64( "Linux AARCH 64-bit with RK3588", Platform::getLinuxDeviceTreeModel, @@ -125,7 +132,8 @@ public static boolean isRK3588() { } public static boolean isSystemCore() { - return new File("/home/systemcore").exists(); + File sysCore = new File("/home/systemcore"); + return sysCore.exists(); } public static boolean isRaspberryPi() { @@ -198,7 +206,9 @@ public static Platform getCurrentPlatform() { } if (OS_NAME.startsWith("Linux")) { - if (isPiSBC()) { + if (isSystemCore()) { + return LINUX_SYSTEMCORE; + } else if (isPiSBC()) { if (OS_ARCH.equals("arm") || OS_ARCH.equals("arm32")) { return LINUX_RASPBIAN32; } else if (OS_ARCH.equals("aarch64") || OS_ARCH.equals("arm64")) { From 089d357bb23aed81e90ca51b5f0328f0f8e82f13 Mon Sep 17 00:00:00 2001 From: Sam Freund Date: Thu, 3 Jul 2025 12:37:31 -0500 Subject: [PATCH 04/11] Update docs link --- photon-server/src/main/java/org/photonvision/Main.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/photon-server/src/main/java/org/photonvision/Main.java b/photon-server/src/main/java/org/photonvision/Main.java index ace601f138..9d78beb8e4 100644 --- a/photon-server/src/main/java/org/photonvision/Main.java +++ b/photon-server/src/main/java/org/photonvision/Main.java @@ -182,7 +182,7 @@ public static void main(String[] args) { logger.error( "SystemCore is not a supported platform for PhotonVision!\n " + "PhotonVision will now proceed to uninstall itself from this device.\n" - + "Please visit https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#unsupported-devices for more information."); + + "Please visit https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#systemcore-support for more information."); File jarLocation = getJarLocation(); if (jarLocation == null) { @@ -196,7 +196,7 @@ public static void main(String[] args) { writer.write("SystemCore is not a supported platform for PhotonVision.\n"); writer.write("PhotonVision has been uninstalled from this device.\n"); writer.write( - "Please visit https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#unsupported-devices for more information."); + "Please visit https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#systemcore-support for more information."); } } catch (IOException e) { logger.error("Failed to create SystemCore not supported file", e); From 6106d4970fbd5f797dd219e4e5db93f83847a185 Mon Sep 17 00:00:00 2001 From: samfreund Date: Fri, 4 Jul 2025 08:15:25 -0500 Subject: [PATCH 05/11] add fallback method of determining systemcore --- docs/source/docs/quick-start/common-setups.md | 2 +- photon-server/src/main/resources/web/index.html | 15 ++++++++++++++- .../photonvision/common/hardware/Platform.java | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/docs/source/docs/quick-start/common-setups.md b/docs/source/docs/quick-start/common-setups.md index 767c4f535e..dfd37e9f50 100644 --- a/docs/source/docs/quick-start/common-setups.md +++ b/docs/source/docs/quick-start/common-setups.md @@ -16,7 +16,7 @@ The Orange Pi 5 is the only currently supported device for object detection. ## SystemCore Support The SystemCore is not supported by PhotonVision. PhotonVision is designed to utilize the entirety of the coprocessor's resources, and this could prove to be dangerous if attempted on the main robot controller. -There are no current plans to support running on SystemCore alongside robot code, and any attempts to do so are entirely at your own risk and will require a separate fork of PhotonVision. +There are no current plans to support running on SystemCore alongside robot code, and any attempts to do so are entirely at your own risk and will require a separate fork of PhotonVision. ## SD Cards diff --git a/photon-server/src/main/resources/web/index.html b/photon-server/src/main/resources/web/index.html index 641b6da394..f5511e2b3b 100644 --- a/photon-server/src/main/resources/web/index.html +++ b/photon-server/src/main/resources/web/index.html @@ -1 +1,14 @@ -

UIs should be copied, but yours wasn't!

+ + + + + + + Photon Client + + + + +
+ + diff --git a/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java b/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java index 7bbd2d99c1..f4ef936179 100644 --- a/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java +++ b/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java @@ -133,7 +133,7 @@ public static boolean isRK3588() { public static boolean isSystemCore() { File sysCore = new File("/home/systemcore"); - return sysCore.exists(); + return sysCore.exists() | fileHasText("/etc/os-release", "systemcore"); } public static boolean isRaspberryPi() { From fce016cdd44bec7354bc3508616060835d41e432 Mon Sep 17 00:00:00 2001 From: Sam Freund Date: Fri, 4 Jul 2025 12:52:30 -0500 Subject: [PATCH 06/11] Discard changes to photon-server/src/main/resources/web/index.html --- photon-server/src/main/resources/web/index.html | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/photon-server/src/main/resources/web/index.html b/photon-server/src/main/resources/web/index.html index f5511e2b3b..641b6da394 100644 --- a/photon-server/src/main/resources/web/index.html +++ b/photon-server/src/main/resources/web/index.html @@ -1,14 +1 @@ - - - - - - - Photon Client - - - - -
- - +

UIs should be copied, but yours wasn't!

From 00d1d041fe50bb530b72c498ce6f0627c61e15ad Mon Sep 17 00:00:00 2001 From: samfreund Date: Fri, 31 Oct 2025 18:39:18 -0500 Subject: [PATCH 07/11] exit and serve static webserver --- .../src/main/java/org/photonvision/Main.java | 78 +++++++++++++------ 1 file changed, 55 insertions(+), 23 deletions(-) diff --git a/photon-server/src/main/java/org/photonvision/Main.java b/photon-server/src/main/java/org/photonvision/Main.java index 9d78beb8e4..44e8305fe3 100644 --- a/photon-server/src/main/java/org/photonvision/Main.java +++ b/photon-server/src/main/java/org/photonvision/Main.java @@ -19,7 +19,6 @@ import edu.wpi.first.hal.HAL; import java.io.File; -import java.io.FileWriter; import java.io.IOException; import java.net.URISyntaxException; import java.net.URL; @@ -179,34 +178,67 @@ public static void main(String[] args) { + (Platform.isRaspberryPi() ? (" (Pi " + PiVersion.getPiVersion() + ")") : "")); if (Platform.isSystemCore()) { + String docsLink = + "https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#systemcore-support"; + logger.error( "SystemCore is not a supported platform for PhotonVision!\n " - + "PhotonVision will now proceed to uninstall itself from this device.\n" - + "Please visit https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#systemcore-support for more information."); + + "Please visit " + + docsLink + + " for more information."); - File jarLocation = getJarLocation(); - if (jarLocation == null) { - System.exit(1); - } - // Make a file where the PV JAR is located indicating systemcore is not supported try { - File notSupportedFile = - new File(jarLocation.getParent(), "SYSTEMCORE_NOT_SUPPORTED_BY_PHOTONVISION.txt"); - try (FileWriter writer = new FileWriter(notSupportedFile)) { - writer.write("SystemCore is not a supported platform for PhotonVision.\n"); - writer.write("PhotonVision has been uninstalled from this device.\n"); - writer.write( - "Please visit https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#systemcore-support for more information."); + int port = 5800; + com.sun.net.httpserver.HttpServer server = null; + try { + server = + com.sun.net.httpserver.HttpServer.create(new java.net.InetSocketAddress(port), 0); + } catch (Exception e) { + logger.warn("Failed to bind to port 5800, exiting: " + e.getMessage()); + port = DEFAULT_WEBPORT; + server = + com.sun.net.httpserver.HttpServer.create(new java.net.InetSocketAddress(port), 0); } - } catch (IOException e) { - logger.error("Failed to create SystemCore not supported file", e); - System.exit(1); - } - // Delete the PV JAR - if (!jarLocation.delete()) { - logger.error("Failed to delete PhotonVision JAR file on SystemCore!"); - System.exit(1); + final int boundPort = port; + server.createContext( + "/", + exchange -> { + String html = + "" + + "Unsupported platform" + + "

Main Robot Controllers shouldn't run PhotonVision, but yours does! Please uninstall PhotonVision. " + + "If you choose to modify PhotonVision so that it functions on SystemCore, " + + "you do so entirely at your own risk and without any support. " + + "For more information, see " + + docsLink + + ".

"; + byte[] resp = html.getBytes(java.nio.charset.StandardCharsets.UTF_8); + exchange.getResponseHeaders().set("Content-Type", "text/html; charset=utf-8"); + exchange.sendResponseHeaders(200, resp.length); + try (java.io.OutputStream os = exchange.getResponseBody()) { + os.write(resp); + } + }); + server.setExecutor(java.util.concurrent.Executors.newSingleThreadExecutor()); + server.start(); + logger.info( + "Served SystemCore warning page on port " + + boundPort + + " - process will remain running to serve the page."); + + // Prevent main from exiting so the page remains available. + final Object lock = new Object(); + synchronized (lock) { + try { + lock.wait(); + } catch (InterruptedException ignored) { + } + } + } catch (Exception e) { + logger.error("Failed to start static warning page server", e); } // Exit From 9519bbae9dd02c47bfb11eeed1d86cd0b3984ee4 Mon Sep 17 00:00:00 2001 From: samfreund Date: Fri, 31 Oct 2025 18:44:54 -0500 Subject: [PATCH 08/11] switch to serving via javalin --- .../src/main/java/org/photonvision/Main.java | 46 ++++++++----------- 1 file changed, 20 insertions(+), 26 deletions(-) diff --git a/photon-server/src/main/java/org/photonvision/Main.java b/photon-server/src/main/java/org/photonvision/Main.java index 44e8305fe3..339244b32c 100644 --- a/photon-server/src/main/java/org/photonvision/Main.java +++ b/photon-server/src/main/java/org/photonvision/Main.java @@ -189,41 +189,35 @@ public static void main(String[] args) { try { int port = 5800; - com.sun.net.httpserver.HttpServer server = null; + io.javalin.Javalin app = null; try { - server = - com.sun.net.httpserver.HttpServer.create(new java.net.InetSocketAddress(port), 0); + app = io.javalin.Javalin.create(cfg -> cfg.showJavalinBanner = false).start(port); } catch (Exception e) { logger.warn("Failed to bind to port 5800, exiting: " + e.getMessage()); port = DEFAULT_WEBPORT; - server = - com.sun.net.httpserver.HttpServer.create(new java.net.InetSocketAddress(port), 0); + app = io.javalin.Javalin.create(cfg -> cfg.showJavalinBanner = false).start(port); } final int boundPort = port; - server.createContext( + final String html = + "" + + "Unsupported platform" + + "

Main Robot Controllers shouldn't run PhotonVision, but yours does! Please uninstall PhotonVision. " + + "If you choose to modify PhotonVision so that it functions on SystemCore, " + + "you do so entirely at your own risk and without any support. " + + "For more information, see " + + docsLink + + ".

"; + + app.get( "/", - exchange -> { - String html = - "" - + "Unsupported platform" - + "

Main Robot Controllers shouldn't run PhotonVision, but yours does! Please uninstall PhotonVision. " - + "If you choose to modify PhotonVision so that it functions on SystemCore, " - + "you do so entirely at your own risk and without any support. " - + "For more information, see " - + docsLink - + ".

"; - byte[] resp = html.getBytes(java.nio.charset.StandardCharsets.UTF_8); - exchange.getResponseHeaders().set("Content-Type", "text/html; charset=utf-8"); - exchange.sendResponseHeaders(200, resp.length); - try (java.io.OutputStream os = exchange.getResponseBody()) { - os.write(resp); - } + ctx -> { + ctx.contentType("text/html; charset=utf-8"); + ctx.result(html); }); - server.setExecutor(java.util.concurrent.Executors.newSingleThreadExecutor()); - server.start(); + logger.info( "Served SystemCore warning page on port " + boundPort From 47149cef5cb9118d47a689955f4d95e64922266f Mon Sep 17 00:00:00 2001 From: samfreund Date: Sat, 1 Nov 2025 01:18:27 -0500 Subject: [PATCH 09/11] link to uninstall script --- photon-server/src/main/java/org/photonvision/Main.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/photon-server/src/main/java/org/photonvision/Main.java b/photon-server/src/main/java/org/photonvision/Main.java index 510fecffa0..b6f01d18b7 100644 --- a/photon-server/src/main/java/org/photonvision/Main.java +++ b/photon-server/src/main/java/org/photonvision/Main.java @@ -178,7 +178,7 @@ public static void main(String[] args) { + Platform.getPlatformName() + (Platform.isRaspberryPi() ? (" (Pi " + PiVersion.getPiVersion() + ")") : "")); - if (Platform.isSystemCore()) { + if (Platform.isSystemCore() || true) { String docsLink = "https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#systemcore-support"; @@ -203,7 +203,9 @@ public static void main(String[] args) { final String html = "" + "Unsupported platform" - + "

Main Robot Controllers shouldn't run PhotonVision, but yours does! Please uninstall PhotonVision. " + + "

Main Robot Controllers shouldn't run PhotonVision, but yours does! " + + "Please uninstall PhotonVision. " + "If you choose to modify PhotonVision so that it functions on SystemCore, " + "you do so entirely at your own risk and without any support. " + "For more information, see Date: Thu, 25 Dec 2025 20:48:50 -0600 Subject: [PATCH 10/11] abstract to a helper --- .../src/main/java/org/photonvision/Main.java | 126 +++++++++--------- 1 file changed, 65 insertions(+), 61 deletions(-) diff --git a/photon-server/src/main/java/org/photonvision/Main.java b/photon-server/src/main/java/org/photonvision/Main.java index e1a09eb51d..e8fa98247a 100644 --- a/photon-server/src/main/java/org/photonvision/Main.java +++ b/photon-server/src/main/java/org/photonvision/Main.java @@ -170,6 +170,70 @@ private static void addTestModeSources() { VisionSourceManager.getInstance().registerLoadedConfigs(cameraConfigs); } + private static void serveDenialPage() { + String docsLink = + "https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#systemcore-support"; + + logger.error( + "SystemCore is not a supported platform for PhotonVision!\n " + + "Please visit " + + docsLink + + " for more information."); + + try { + int port = 5800; + io.javalin.Javalin app = null; + try { + app = io.javalin.Javalin.create(cfg -> cfg.showJavalinBanner = false).start(port); + } catch (Exception e) { + logger.warn("Failed to bind to port 5800, exiting: " + e.getMessage()); + port = DEFAULT_WEBPORT; + app = io.javalin.Javalin.create(cfg -> cfg.showJavalinBanner = false).start(port); + } + + final int boundPort = port; + final String html = + "" + + "Unsupported platform" + + "

Main Robot Controllers shouldn't run PhotonVision, but yours does! " + + "Please uninstall PhotonVision. " + + "If you choose to modify PhotonVision so that it functions on SystemCore, " + + "you do so entirely at your own risk and without any support. " + + "For more information, see " + + docsLink + + ".

"; + + app.get( + "/", + ctx -> { + ctx.contentType("text/html; charset=utf-8"); + ctx.result(html); + }); + + logger.info( + "Served SystemCore warning page on port " + + boundPort + + " - process will remain running to serve the page."); + + // Prevent main from exiting so the page remains available. + final Object lock = new Object(); + synchronized (lock) { + try { + lock.wait(); + } catch (InterruptedException ignored) { + } + } + } catch (Exception e) { + logger.error("Failed to start static warning page server", e); + } + + // Exit + System.exit(1); + } + public static void main(String[] args) { logger.info( "Starting PhotonVision version " @@ -179,67 +243,7 @@ public static void main(String[] args) { + (Platform.isRaspberryPi() ? (" (Pi " + PiVersion.getPiVersion() + ")") : "")); if (Platform.isSystemCore()) { - String docsLink = - "https://docs.photonvision.org/en/latest/docs/quick-start/common-setups.html#systemcore-support"; - - logger.error( - "SystemCore is not a supported platform for PhotonVision!\n " - + "Please visit " - + docsLink - + " for more information."); - - try { - int port = 5800; - io.javalin.Javalin app = null; - try { - app = io.javalin.Javalin.create(cfg -> cfg.showJavalinBanner = false).start(port); - } catch (Exception e) { - logger.warn("Failed to bind to port 5800, exiting: " + e.getMessage()); - port = DEFAULT_WEBPORT; - app = io.javalin.Javalin.create(cfg -> cfg.showJavalinBanner = false).start(port); - } - - final int boundPort = port; - final String html = - "" - + "Unsupported platform" - + "

Main Robot Controllers shouldn't run PhotonVision, but yours does! " - + "Please uninstall PhotonVision. " - + "If you choose to modify PhotonVision so that it functions on SystemCore, " - + "you do so entirely at your own risk and without any support. " - + "For more information, see " - + docsLink - + ".

"; - - app.get( - "/", - ctx -> { - ctx.contentType("text/html; charset=utf-8"); - ctx.result(html); - }); - - logger.info( - "Served SystemCore warning page on port " - + boundPort - + " - process will remain running to serve the page."); - - // Prevent main from exiting so the page remains available. - final Object lock = new Object(); - synchronized (lock) { - try { - lock.wait(); - } catch (InterruptedException ignored) { - } - } - } catch (Exception e) { - logger.error("Failed to start static warning page server", e); - } - - // Exit - System.exit(1); + serveDenialPage(); } if (OsImageVersion.IMAGE_VERSION.isPresent()) { From da5ce3b1ba9f7db7b06d19f7e8710b747f2e0d5a Mon Sep 17 00:00:00 2001 From: samfreund Date: Fri, 26 Dec 2025 21:02:20 -0600 Subject: [PATCH 11/11] fix bad merge --- .../src/main/java/org/photonvision/common/hardware/Platform.java | 1 - 1 file changed, 1 deletion(-) diff --git a/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java b/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java index 784a5b360c..2b079ec0b4 100644 --- a/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java +++ b/photon-targeting/src/main/java/org/photonvision/common/hardware/Platform.java @@ -45,7 +45,6 @@ public enum Platform { LINUX_SYSTEMCORE( "Linux Systemcore 64-bit NOT SUPPORTED", Platform::getUnknownModel, - "linuxarm64", false, OSType.LINUX, false), // SystemCore 64-bit