Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.photonvision.common.hardware.metrics.cmds.FileCmds;
import org.photonvision.common.hardware.metrics.cmds.LinuxCmds;
import org.photonvision.common.hardware.metrics.cmds.PiCmds;
import org.photonvision.common.hardware.metrics.cmds.QCS6490Cmds;
import org.photonvision.common.hardware.metrics.cmds.RK3588Cmds;
import org.photonvision.common.logging.LogGroup;
import org.photonvision.common.logging.Logger;
Expand All @@ -49,6 +50,8 @@ public void setConfig(HardwareConfig config) {
cmds = new PiCmds(); // Pi's can use a hardcoded command set
} else if (Platform.isRK3588()) {
cmds = new RK3588Cmds(); // RK3588 chipset hardcoded command set
} else if (Platform.isQCS6490()) {
cmds = new QCS6490Cmds(); // QCS6490 chipset hardcoded command set
} else if (Platform.isLinux()) {
cmds = new LinuxCmds(); // Linux/Unix platforms assume a nominal command set
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright (C) Photon Vision.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

package org.photonvision.common.hardware.metrics.cmds;

import org.photonvision.common.configuration.HardwareConfig;

public class QCS6490Cmds extends LinuxCmds {
/** Applies pi-specific commands, ignoring any input configuration */
public void initCmds(HardwareConfig config) {
super.initCmds(config);

/* Thermal zone information can be found in /sys/class/thermal/thermal_zone* directories:
* zone/type: Contains the thermal zone type/name (e.g., "acpi", "x86_pkg_temp")
* zone/temp: Current temperature in millidegrees Celsius (divide by 1000 for actual temp)
* zone/policy: Thermal governor policy (e.g., "step_wise", "power_allocator")
* Each thermal_zone* directory represents a different temperature sensor in the system
*/

cpuTemperatureCommand =
"cat /sys/class/thermal/thermal_zone10/temp | awk '{printf \"%.1f\", $1/1000}'";

// TODO: NPU usage, doesn't seem to be in the same place as the opi. We're gonna just wait on QC
// to get back to us on this one.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ public enum Platform {
false,
OSType.LINUX,
true),
LINUX_QCS6490(
"Linux AARCH 64-bit with QCS6490",
Platform::getLinuxDeviceTreeModel,
"linuxarm64",
true,
OSType.LINUX,
true), // QCS6490 SBCs
LINUX_AARCH64(
"Linux AARCH64",
Platform::getLinuxDeviceTreeModel,
Expand Down Expand Up @@ -124,6 +131,10 @@ public static boolean isRK3588() {
return Platform.isOrangePi() || Platform.isCoolPi4b() || Platform.isRock5C();
}

public static boolean isQCS6490() {
return isRubik();
}

public static boolean isRaspberryPi() {
return currentPlatform.isPi;
}
Expand Down Expand Up @@ -162,6 +173,7 @@ public static boolean isAthena() {
String.format("Unknown Platform. OS: %s, Architecture: %s", OS_NAME, OS_ARCH);
private static final String UnknownDeviceModelString = "Unknown";

// TODO: add rubik, but waiting for more info on architecture
public static Platform getCurrentPlatform() {
String OS_NAME;
if (Platform.OS_NAME != null) {
Expand Down Expand Up @@ -219,6 +231,9 @@ public static Platform getCurrentPlatform() {
// TODO - os detection needed?
if (isRK3588()) {
return LINUX_RK3588_64;
} else if (isQCS6490()) {
return LINUX_QCS6490;

} else {
return LINUX_AARCH64;
}
Expand Down Expand Up @@ -256,6 +271,10 @@ private static boolean isJetsonSBC() {
return fileHasText("/proc/device-tree/model", "NVIDIA Jetson");
}

private static boolean isRubik() {
return fileHasText("/proc/device-tree/model", "Rubik");
}

static String getLinuxDeviceTreeModel() {
var deviceTreeModelPath = Paths.get("/proc/device-tree/model");
try {
Expand Down
Loading