big webui progress, big state table progress, big things incoming, stay tuned

This commit is contained in:
rawhide kobayashi 2025-03-10 03:33:57 -05:00
parent f548353fa6
commit 7f5812e1b7
Signed by: rawhide_k
GPG Key ID: E71F77DDBC513FD7
28 changed files with 13171 additions and 164 deletions

View File

@ -4,74 +4,252 @@ digraph bios
node [shape = "box"]
style = dashed
color = red
main [label = "Main"]
"Main"
//rankdir = "LR"
//VALUES ARE DEFAULT VALUES FROM A FRESHLY CLEARED CMOS
//THIS FILE IS NOT TO BE MODIFIED EXCEPT FOR BREAKING BIOS UPDATES
oc_tweaker [label = "OC Tweaker"]
gaming_mode [label = "Gaming Mode" value = "Disabled"]
tdp_to_105w [label = "TDP to 105W" value = "Disabled"]
subgraph cluster_oc_tweaker
{
"OC Tweaker"
"Gaming Mode"
"TDP to 105W"
"Performance Boost"
"Performance Preset"
"Platform Thermal throttle Limit(TjMax)"
"CPU Overclocking"
"DRAM Frequency"
"Memory Context Restore"
subgraph cluster_dram_profile
{
"DRAM Profile Configuration"
"DRAM Profile Configuration (Enter subfolder)"
"DRAM Profile Setting" [option_type = "list" value = "Auto" options = "Auto,DDR5-4800,XMP1-6000" traversal_key = "ArrowDown"]
"DRAM Performance Mode" [option_type = "list" value = "AMD AGESA Default" options = "AMD AGESA Default,Competitive,Aggressive" traversal_key = "ArrowDown"]
}
"DRAM Timing Configuration"
"VDDIO Voltage (VDDIO_MEM_S3)"
"DRAM VDD Voltage"
"DRAM VDDQ Voltage"
"DRAM VPP Voltage"
"Infinity Fabric Frequency"
"UCLK DIV1 MODE"
"SOC/Uncore OC Voltage (VDD_SOC)" [option_type = "field" value = "Auto"]
"VDD Misc Voltage"
"VDDG CCD Voltage"
"VDDG IOD Voltage"
"VDDP Voltage"
"Overclock Mode(Bus Speed)"
"BCLK 0 (MHz)" [option_type = "field" value = "Auto"]
"Spread Spectrum" [option_type = "list" value = "Auto" options = "Auto,Disabled,Enabled" traversal_key = "ArrowDown"]
"External Voltage Settings"
}
subgraph cluster_advanced
{
advanced [label = "Advanced"]
cpu_config [label = "CPU Configuration"]
pci_config [label = "PCI Configuration"]
onb_dev_config [label = "Onboard Devices Configuration"]
stor_config [label = "Storage Configuration"]
acpi_config [label = "ACPI Configuration"]
usb_config [label = "USB Configuration"]
trust_com [label = "Trusted Computing"]
amd_cbs [label = "AMD CBS"]
amd_pbs [label = "AMD PBS"]
amd_oc [label = "AMD Overclocking"]
oc_menu [label = "OC Menu"]
"Advanced"
"CPU Configuration"
"PCI Configuration"
"Onboard Devices Configuration"
"Storage Configuration"
"ACPI Configuration"
"USB Configuration"
"Trusted Computing"
"AMD PBS"
subgraph cluster_amd_cbs
{
"AMD CBS"
"CPU Common Options"
subgraph cluster_df_options
{
"DF Common Options"
"Memory Addressing"
"ACPI"
// why in the name of all that is unholy is this list in reverse?!
"ACPI SRAT L3 Cache As NUMA Domain" [option_type = "list" value = "Auto" options = "Auto,Enabled,Disabled" traversal_key = "ArrowUp"]
}
"UMC Common Options"
subgraph cluster_nbio
{
"NBIO Common Options"
"IOMMU"
"PCIe ARI Support"
"PCIe All Port ECRC"
"Advanced Error Reporting (AER)"
"PCIe ARI Enumeration"
subgraph cluster_gfx_config
{
"GFX Configuration"
"dGPU Only Mode" [option_type = "list" value = "Auto" options = "Auto,Disabled,Enabled" traversal_key = "ArrowDown"]
}
"Audio Configuration"
"PCIe loopback Mode"
"Persistence mode for legacy endpoints"
"Retimer margining support"
}
}
subgraph cluster_amd_overclocking
{
"AMD Overclocking"
"Manual CPU Overclocking"
"DDR and Infinity Fabric Frequency/Timings"
subgraph cluster_pbo
{
"Precision Boost Overdrive (Enter subfolder)"
"Precision Boost Overdrive"
"PBO Limits" [option_type = "list" value = "Auto" options = "Auto,Disable,Motherboard,Manual" traversal_key = "ArrowDown"]
"Precision Boost Overdrive Scalar Ctrl"
"Precision Boost Overdrive Scalar" [option_type = "list" value = "1X" options = "1X,2X,3X,4X,5X,6X,7X,8X,9X,10X" traversal_key = "ArrowDown"]
"CPU Boost Clock Override"
"Max CPU Boost Clock Override(+)" [option_type = "field" value = "25"]
"Platform Thermal Throttle Ctrl"
"GFX Curve Optimizer"
"Curve Optimizer"
"Curve Shaper"
}
}
}
tool [label = "Tool"]
hw_mon [label = "H/W Monitor"]
security [label = "Security"]
boot [label = "Boot"]
exit [label = "Exit"]
save_and_exit [label = "Save Changes and Exit"]
subgraph cluster_tool
{
"Tool"
"ASR USB LED test form"
"SSD Secure Erase Tool"
"Media Sanitization"
"Instant Flash"
"Auto Driver Installer" [option_type = "list" value = "Enabled" options = "Enabled,Disabled" traversal_key = "ArrowUp"]
}
"H/W Monitor"
"Security"
"Boot"
"Exit"
"Save Changes and Exit"
main -> oc_tweaker [keypath = "ArrowRight"]
oc_tweaker -> advanced [keypath = "ArrowRight"]
advanced -> tool [keypath = "ArrowRight"]
tool -> hw_mon [keypath = "ArrowRight"]
hw_mon -> security [keypath = "ArrowRight"]
security -> boot [keypath = "ArrowRight"]
boot -> exit [keypath = "ArrowRight"]
"Main" -> "OC Tweaker" [keypath = "ArrowRight"]
"OC Tweaker" -> "Advanced" [keypath = "ArrowRight"]
"Advanced" -> "Tool" [keypath = "ArrowRight"]
"Tool" -> "H/W Monitor" [keypath = "ArrowRight"]
"H/W Monitor" -> "Security" [keypath = "ArrowRight"]
"Security" -> "Boot" [keypath = "ArrowRight"]
"Boot" -> "Exit" [keypath = "ArrowRight"]
exit -> boot [keypath = "ArrowLeft"]
boot -> security [keypath = "ArrowLeft"]
security -> hw_mon [keypath = "ArrowLeft"]
hw_mon -> tool [keypath = "ArrowLeft"]
tool -> advanced [keypath = "ArrowLeft"]
advanced -> oc_tweaker [keypath = "ArrowLeft"]
oc_tweaker -> main [keypath = "ArrowLeft"]
"Exit" -> "Boot" [keypath = "ArrowLeft"]
"Boot" -> "Security" [keypath = "ArrowLeft"]
"Security" -> "H/W Monitor" [keypath = "ArrowLeft"]
"H/W Monitor" -> "Tool" [keypath = "ArrowLeft"]
"Tool" -> "Advanced" [keypath = "ArrowLeft"]
"Advanced" -> "OC Tweaker" [keypath = "ArrowLeft"]
"OC Tweaker" -> "Main" [keypath = "ArrowLeft"]
oc_tweaker -> gaming_mode [keypath = "Home"]
gaming_mode -> oc_tweaker [keypath = "Home"]
gaming_mode -> tdp_to_105w [keypath = "ArrowDown"]
tdp_to_105w -> gaming_mode [keypath = "ArrowUp"]
"OC Tweaker" -> "Gaming Mode" [keypath = "Home"]
"Gaming Mode" -> "TDP to 105W" [keypath = "ArrowDown"]
"TDP to 105W" -> "Performance Boost" [keypath = "ArrowDown"]
"Performance Boost" -> "Performance Preset" [keypath = "ArrowDown"]
"Performance Preset" -> "Platform Thermal throttle Limit(TjMax)" [keypath = "ArrowDown"]
"Platform Thermal throttle Limit(TjMax)" -> "CPU Overclocking" [keypath = "ArrowDown"]
"CPU Overclocking" -> "DRAM Frequency" [keypath = "ArrowDown"]
"DRAM Frequency" -> "Memory Context Restore" [keypath = "ArrowDown"]
"Memory Context Restore" -> "DRAM Profile Configuration" [keypath = "ArrowDown"]
advanced -> cpu_config [keypath = "Home"]
cpu_config -> pci_config [keypath = "ArrowDown"]
pci_config -> onb_dev_config [keypath = "ArrowDown"]
onb_dev_config -> stor_config [keypath = "ArrowDown"]
stor_config -> acpi_config [keypath = "ArrowDown"]
acpi_config -> usb_config [keypath = "ArrowDown"]
usb_config -> trust_com [keypath = "ArrowDown"]
trust_com -> amd_cbs [keypath = "ArrowDown"]
amd_cbs -> amd_pbs [keypath = "ArrowDown"]
amd_pbs -> amd_oc [keypath = "ArrowDown"]
"DRAM Profile Configuration" -> "DRAM Timing Configuration" [keypath = "ArrowDown"]
"DRAM Profile Configuration" -> "DRAM Profile Configuration (Enter subfolder)" [keypath = "Enter"]
"DRAM Profile Configuration (Enter subfolder)" -> "DRAM Profile Setting" [keypath = "Home"]
"DRAM Profile Setting" -> "DRAM Performance Mode" [keypath = "ArrowDown"]
cpu_config, pci_config, onb_dev_config, stor_config, acpi_config, usb_config, trust_com, amd_cbs, amd_pbs, amd_oc -> advanced [keypath = "Home"]
"DRAM Profile Setting", "DRAM Performance Mode" -> "DRAM Profile Configuration" [keypath = "Escape"]
amd_oc -> oc_menu [keypath = "Enter,Enter"]
oc_menu -> amd_oc [keypath = "Escape,Escape"]
"DRAM Timing Configuration" -> "VDDIO Voltage (VDDIO_MEM_S3)" [keypath = "ArrowDown"]
"VDDIO Voltage (VDDIO_MEM_S3)" -> "DRAM VDD Voltage" [keypath = "ArrowDown"]
"DRAM VDD Voltage" -> "DRAM VDDQ Voltage" [keypath = "ArrowDown"]
"DRAM VDDQ Voltage" -> "DRAM VPP Voltage" [keypath = "ArrowDown"]
"DRAM VPP Voltage" -> "Infinity Fabric Frequency" [keypath = "ArrowDown"]
"Infinity Fabric Frequency" -> "UCLK DIV1 MODE" [keypath = "ArrowDown"]
"UCLK DIV1 MODE" -> "SOC/Uncore OC Voltage (VDD_SOC)" [keypath = "ArrowDown"]
"SOC/Uncore OC Voltage (VDD_SOC)" -> "VDD Misc Voltage" [keypath = "ArrowDown"]
"VDD Misc Voltage" -> "VDDG CCD Voltage" [keypath = "ArrowDown"]
"VDDG CCD Voltage" -> "VDDG IOD Voltage" [keypath = "ArrowDown"]
"VDDG IOD Voltage" -> "VDDP Voltage" [keypath = "ArrowDown"]
"VDDP Voltage" -> "Overclock Mode(Bus Speed)" [keypath = "ArrowDown"]
"Overclock Mode(Bus Speed)" -> "BCLK 0 (MHz)" [keypath = "ArrowDown" initial_keypath = "Enter,ArrowDown,Enter,ArrowDown" visited = "false"]
"BCLK 0 (MHz)" -> "Spread Spectrum" [keypath = "ArrowDown"]
"Spread Spectrum" -> "External Voltage Settings" [keypath = "ArrowDown"]
exit -> save_and_exit [keypath = "Enter,Enter"]
"Gaming Mode", "TDP to 105W", "Performance Boost", "Performance Preset", "Platform Thermal throttle Limit(TjMax)", "CPU Overclocking", "DRAM Frequency", "Memory Context Restore", "DRAM Profile Configuration", "DRAM Timing Configuration", "VDDIO Voltage (VDDIO_MEM_S3)", "DRAM VDD Voltage", "DRAM VDDQ Voltage", "DRAM VPP Voltage", "Infinity Fabric Frequency", "UCLK DIV1 MODE", "SOC/Uncore OC Voltage (VDD_SOC)", "VDD Misc Voltage", "VDDG CCD Voltage", "VDDG IOD Voltage", "VDDP Voltage", "Overclock Mode(Bus Speed)", "BCLK 0 (MHz)", "Spread Spectrum", "External Voltage Settings" -> "OC Tweaker" [keypath = "Home"]
"Advanced" -> "CPU Configuration" [keypath = "Home"]
"CPU Configuration" -> "PCI Configuration" [keypath = "ArrowDown"]
"PCI Configuration" -> "Onboard Devices Configuration" [keypath = "ArrowDown"]
"Onboard Devices Configuration" -> "Storage Configuration" [keypath = "ArrowDown"]
"Storage Configuration" -> "ACPI Configuration" [keypath = "ArrowDown"]
"ACPI Configuration" -> "USB Configuration" [keypath = "ArrowDown"]
"USB Configuration" -> "Trusted Computing" [keypath = "ArrowDown"]
"Trusted Computing" -> "AMD CBS" [keypath = "ArrowDown"]
"AMD CBS" -> "AMD PBS" [keypath = "ArrowDown"]
"AMD CBS" -> "CPU Common Options" [keypath = "Enter"]
"CPU Common Options" -> "DF Common Options" [keypath = "ArrowDown"]
"DF Common Options" -> "Memory Addressing" [keypath = "Enter"]
"DF Common Options" -> "ACPI" [keypath = "Enter,ArrowDown"]
"ACPI" -> "ACPI SRAT L3 Cache As NUMA Domain" [keypath = "Enter"]
"ACPI SRAT L3 Cache As NUMA Domain" -> "ACPI" [keypath = "Escape"]
"ACPI" -> "DF Common Options" [keypath = "Escape"]
"DF Common Options" -> "UMC Common Options" [keypath = "ArrowDown"]
"UMC Common Options" -> "NBIO Common Options" [keypath = "ArrowDown"]
"NBIO Common Options" -> "IOMMU" [keypath = "Enter"]
"IOMMU" -> "PCIe ARI Support" [keypath = "ArrowDown"]
"PCIe ARI Support" -> "PCIe All Port ECRC" [keypath = "ArrowDown"]
"PCIe All Port ECRC" -> "Advanced Error Reporting (AER)" [keypath = "ArrowDown"]
"Advanced Error Reporting (AER)" -> "PCIe ARI Enumeration" [keypath = "ArrowDown"]
"PCIe ARI Enumeration" -> "GFX Configuration" [keypath = "ArrowDown"]
"GFX Configuration" -> "dGPU Only Mode" [keypath = "Enter"]
"dGPU Only Mode" -> "GFX Configuration" [keypath = "Escape"]
"GFX Configuration" -> "Audio Configuration" [keypath = "ArrowDown"]
"Audio Configuration" -> "PCIe loopback Mode" [keypath = "ArrowDown"]
"PCIe loopback Mode" -> "Persistence mode for legacy endpoints" [keypath = "ArrowDown"]
"Persistence mode for legacy endpoints" -> "Retimer margining support" [keypath = "ArrowDown"]
"IOMMU", "PCIe ARI Support", "PCIe All Port ECRC", "Advanced Error Reporting (AER)", "PCIe ARI Enumeration", "GFX Configuration", "Audio Configuration", "PCIe loopback Mode", "Persistence mode for legacy endpoints", "Retimer margining support" -> "NBIO Common Options" [keypath = "Escape"]
"CPU Common Options", "DF Common Options", "UMC Common Options", "NBIO Common Options" -> "AMD CBS" [keypath = "Escape"]
"AMD PBS" -> "AMD Overclocking" [keypath = "ArrowDown"]
"CPU Configuration", "PCI Configuration", "Onboard Devices Configuration", "Storage Configuration", "ACPI Configuration", "USB Configuration", "Trusted Computing", "AMD CBS", "AMD PBS", "AMD Overclocking" -> "Advanced" [keypath = "Home"]
"AMD Overclocking" -> "Manual CPU Overclocking" [keypath = "Enter,Enter"]
"AMD Overclocking" -> "DDR and Infinity Fabric Frequency/Timings" [keypath = "Enter,Enter,ArrowDown"]
"DDR and Infinity Fabric Frequency/Timings" -> "Precision Boost Overdrive (Enter subfolder)" [keypath = "ArrowDown"]
"Precision Boost Overdrive (Enter subfolder)" -> "Precision Boost Overdrive" [keypath = "Enter" initial_keypath = "Enter,Enter,ArrowDown,ArrowDown,ArrowDown,Enter" visited = "false"]
"Precision Boost Overdrive" -> "PBO Limits" [keypath = "ArrowDown"]
"PBO Limits" -> "Precision Boost Overdrive Scalar Ctrl" [keypath = "ArrowDown" initial_keypath = "ArrowDown,Enter,ArrowDown,Enter" visited = "false"]
"Precision Boost Overdrive Scalar Ctrl" -> "Precision Boost Overdrive Scalar" [keypath = "ArrowDown"]
"Precision Boost Overdrive Scalar" -> "CPU Boost Clock Override" [keypath = "ArrowDown" initial_keypath = "ArrowDown,Enter,ArrowDown,Enter" visited = "false"]
"CPU Boost Clock Override" -> "Max CPU Boost Clock Override(+)" [keypath = "ArrowDown"]
"Max CPU Boost Clock Override(+)" -> "Platform Thermal Throttle Ctrl" [keypath = "ArrowDown"]
"Platform Thermal Throttle Ctrl" -> "GFX Curve Optimizer" [keypath = "ArrowDown"]
"GFX Curve Optimizer" -> "Curve Optimizer" [keypath = "ArrowDown"]
"Curve Optimizer" -> "Curve Shaper" [keypath = "ArrowDown"]
"Precision Boost Overdrive", "PBO Limits", "Precision Boost Overdrive Scalar Ctrl", "CPU Boost Clock Override", "Platform Thermal Throttle Ctrl" -> "Precision Boost Overdrive (Enter subfolder)" [keypath = "Escape"]
"Precision Boost Overdrive (Enter subfolder)" -> "AMD Overclocking" [keypath = "Escape,Escape"]
"Tool" -> "ASR USB LED test form" [keypath = "Home"]
"ASR USB LED test form" -> "SSD Secure Erase Tool" [keypath = "ArrowDown"]
"SSD Secure Erase Tool" -> "Media Sanitization" [keypath = "ArrowDown"]
"Media Sanitization" -> "Instant Flash" [keypath = "ArrowDown"]
"Instant Flash" -> "Auto Driver Installer" [keypath = "ArrowDown"]
"ASR USB LED test form", "SSD Secure Erase Tool", "Media Sanitization", "Instant Flash", "Auto Driver Installer" -> "Tool" [keypath = "Home"]
"Exit" -> "Save Changes and Exit" [keypath = "Enter,Enter"]
}

View File

@ -53,12 +53,12 @@ void loop()
{
if (analogRead(pwr_detect) > 1000)
{
power_status["pwr"] = "on";
power_status["pwr"] = true;
}
else
{
power_status["pwr"] = "off";
power_status["pwr"] = false;
}
serializeJson(power_status, host_serial);

254
my_state_diagram.svg Normal file
View File

@ -0,0 +1,254 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<!-- Generated by graphviz version 12.1.2 (0)
-->
<!-- Pages: 1 -->
<svg width="1856pt" height="543pt"
viewBox="0.00 0.00 1856.00 543.32" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<g id="graph0" class="graph" transform="scale(1 1) rotate(0) translate(4 539.32)">
<polygon fill="white" stroke="none" points="-4,4 -4,-539.32 1852,-539.32 1852,4 -4,4"/>
<text text-anchor="middle" x="924" y="-4.95" font-family="Times,serif" font-size="14.00">State Machine</text>
<!-- PoweredOff -->
<g id="node1" class="node">
<title>PoweredOff</title>
<path fill="white" stroke="black" d="M422.38,-349.07C422.38,-349.07 365.12,-349.07 365.12,-349.07 359.12,-349.07 353.12,-343.07 353.12,-337.07 353.12,-337.07 353.12,-325.07 353.12,-325.07 353.12,-319.07 359.12,-313.07 365.12,-313.07 365.12,-313.07 422.38,-313.07 422.38,-313.07 428.38,-313.07 434.38,-319.07 434.38,-325.07 434.38,-325.07 434.38,-337.07 434.38,-337.07 434.38,-343.07 428.38,-349.07 422.38,-349.07"/>
<text text-anchor="start" x="361.12" y="-324.89" font-family="Times,serif" font-size="14.00">PoweredOff</text>
</g>
<!-- POST -->
<g id="node2" class="node">
<title>POST</title>
<path fill="white" stroke="black" d="M676.88,-296.07C676.88,-296.07 646.88,-296.07 646.88,-296.07 640.88,-296.07 634.88,-290.07 634.88,-284.07 634.88,-284.07 634.88,-272.07 634.88,-272.07 634.88,-266.07 640.88,-260.07 646.88,-260.07 646.88,-260.07 676.88,-260.07 676.88,-260.07 682.88,-260.07 688.88,-266.07 688.88,-272.07 688.88,-272.07 688.88,-284.07 688.88,-284.07 688.88,-290.07 682.88,-296.07 676.88,-296.07"/>
<text text-anchor="start" x="642.88" y="-271.89" font-family="Times,serif" font-size="14.00">POST</text>
</g>
<!-- PoweredOff&#45;&gt;POST -->
<g id="edge1" class="edge">
<title>PoweredOff&#45;&gt;POST</title>
<path fill="none" stroke="black" d="M422.41,-312.63C433.95,-305.86 447.77,-298.86 461.25,-294.82 515.83,-278.45 582.3,-276.17 623.1,-276.65"/>
<polygon fill="black" stroke="black" points="622.82,-280.15 632.88,-276.84 622.95,-273.15 622.82,-280.15"/>
<text text-anchor="middle" x="502.88" y="-295.77" font-family="Times,serif" font-size="14.00">power_on</text>
</g>
<!-- POST&#45;&gt;PoweredOff -->
<g id="edge14" class="edge">
<title>POST&#45;&gt;PoweredOff</title>
<path fill="none" stroke="black" d="M634.73,-285.95C611.28,-292.8 575.83,-302.62 544.5,-309.07 511.9,-315.78 474.89,-321.24 445.82,-325.04"/>
<polygon fill="black" stroke="black" points="445.67,-321.53 436.2,-326.27 446.56,-328.47 445.67,-321.53"/>
<text text-anchor="middle" x="502.88" y="-323.63" font-family="Times,serif" font-size="14.00">hard_shutdown</text>
</g>
<!-- EnterBIOS -->
<g id="node3" class="node">
<title>EnterBIOS</title>
<path fill="white" stroke="black" d="M975.12,-325.07C975.12,-325.07 923.12,-325.07 923.12,-325.07 917.12,-325.07 911.12,-319.07 911.12,-313.07 911.12,-313.07 911.12,-301.07 911.12,-301.07 911.12,-295.07 917.12,-289.07 923.12,-289.07 923.12,-289.07 975.12,-289.07 975.12,-289.07 981.12,-289.07 987.12,-295.07 987.12,-301.07 987.12,-301.07 987.12,-313.07 987.12,-313.07 987.12,-319.07 981.12,-325.07 975.12,-325.07"/>
<text text-anchor="start" x="919.12" y="-300.89" font-family="Times,serif" font-size="14.00">EnterBIOS</text>
</g>
<!-- POST&#45;&gt;EnterBIOS -->
<g id="edge15" class="edge">
<title>POST&#45;&gt;EnterBIOS</title>
<path fill="none" stroke="black" d="M689.2,-280.75C737.01,-285.61 838.78,-295.95 899.52,-302.13"/>
<polygon fill="black" stroke="black" points="898.92,-305.58 909.22,-303.11 899.62,-298.62 898.92,-305.58"/>
<text text-anchor="middle" x="828.38" y="-300.24" font-family="Times,serif" font-size="14.00">enter_bios</text>
</g>
<!-- WaitingForOS -->
<g id="node5" class="node">
<title>WaitingForOS</title>
<path fill="white" stroke="black" d="M984.5,-144.07C984.5,-144.07 913.75,-144.07 913.75,-144.07 907.75,-144.07 901.75,-138.07 901.75,-132.07 901.75,-132.07 901.75,-120.07 901.75,-120.07 901.75,-114.07 907.75,-108.07 913.75,-108.07 913.75,-108.07 984.5,-108.07 984.5,-108.07 990.5,-108.07 996.5,-114.07 996.5,-120.07 996.5,-120.07 996.5,-132.07 996.5,-132.07 996.5,-138.07 990.5,-144.07 984.5,-144.07"/>
<text text-anchor="start" x="909.75" y="-119.89" font-family="Times,serif" font-size="14.00">WaitingForOS</text>
</g>
<!-- POST&#45;&gt;WaitingForOS -->
<g id="edge16" class="edge">
<title>POST&#45;&gt;WaitingForOS</title>
<path fill="none" stroke="black" d="M675.07,-259.57C693.94,-232.54 732.95,-182.74 779.25,-157.82 789.09,-152.52 845.24,-142.55 890.13,-135.19"/>
<polygon fill="black" stroke="black" points="890.47,-138.69 899.78,-133.63 889.34,-131.78 890.47,-138.69"/>
<text text-anchor="middle" x="828.38" y="-158.77" font-family="Times,serif" font-size="14.00">enter_os</text>
</g>
<!-- BootLoop -->
<g id="node11" class="node">
<title>BootLoop</title>
<path fill="white" stroke="black" d="M972.88,-417.07C972.88,-417.07 925.38,-417.07 925.38,-417.07 919.38,-417.07 913.38,-411.07 913.38,-405.07 913.38,-405.07 913.38,-393.07 913.38,-393.07 913.38,-387.07 919.38,-381.07 925.38,-381.07 925.38,-381.07 972.88,-381.07 972.88,-381.07 978.88,-381.07 984.88,-387.07 984.88,-393.07 984.88,-393.07 984.88,-405.07 984.88,-405.07 984.88,-411.07 978.88,-417.07 972.88,-417.07"/>
<text text-anchor="start" x="921.38" y="-392.89" font-family="Times,serif" font-size="14.00">BootLoop</text>
</g>
<!-- POST&#45;&gt;BootLoop -->
<g id="edge17" class="edge">
<title>POST&#45;&gt;BootLoop</title>
<path fill="none" stroke="black" d="M686.03,-296.45C708.6,-313.5 744.49,-338.37 779.25,-353.07 820.53,-370.52 834.34,-363.74 877.5,-375.82 885.53,-378.07 894.01,-380.66 902.2,-383.28"/>
<polygon fill="black" stroke="black" points="901.08,-386.6 911.67,-386.38 903.25,-379.95 901.08,-386.6"/>
<text text-anchor="middle" x="828.38" y="-376.77" font-family="Times,serif" font-size="14.00">unsuccessful_post</text>
</g>
<!-- BIOSSetup -->
<g id="node4" class="node">
<title>BIOSSetup</title>
<path fill="white" stroke="black" d="M1215.62,-325.07C1215.62,-325.07 1162.12,-325.07 1162.12,-325.07 1156.12,-325.07 1150.12,-319.07 1150.12,-313.07 1150.12,-313.07 1150.12,-301.07 1150.12,-301.07 1150.12,-295.07 1156.12,-289.07 1162.12,-289.07 1162.12,-289.07 1215.62,-289.07 1215.62,-289.07 1221.62,-289.07 1227.62,-295.07 1227.62,-301.07 1227.62,-301.07 1227.62,-313.07 1227.62,-313.07 1227.62,-319.07 1221.62,-325.07 1215.62,-325.07"/>
<text text-anchor="start" x="1158.12" y="-300.89" font-family="Times,serif" font-size="14.00">BIOSSetup</text>
</g>
<!-- EnterBIOS&#45;&gt;BIOSSetup -->
<g id="edge2" class="edge">
<title>EnterBIOS&#45;&gt;BIOSSetup</title>
<path fill="none" stroke="black" d="M987.53,-307.07C1028.32,-307.07 1093.74,-307.07 1138.66,-307.07"/>
<polygon fill="black" stroke="black" points="1138.38,-310.57 1148.38,-307.07 1138.38,-303.57 1138.38,-310.57"/>
<text text-anchor="middle" x="1065" y="-308.02" font-family="Times,serif" font-size="14.00">start_bios_setup</text>
</g>
<!-- BIOSSetup&#45;&gt;PoweredOff -->
<g id="edge3" class="edge">
<title>BIOSSetup&#45;&gt;PoweredOff</title>
<path fill="none" stroke="black" d="M1167.93,-325.54C1135.97,-353.74 1070.02,-406.31 1002.75,-426.07 897.77,-456.9 571.58,-377.59 445.35,-344.64"/>
<polygon fill="black" stroke="black" points="446.51,-341.32 435.94,-342.17 444.73,-348.1 446.51,-341.32"/>
<text text-anchor="middle" x="828.38" y="-430.51" font-family="Times,serif" font-size="14.00">hard_shutdown</text>
</g>
<!-- BIOSSetup&#45;&gt;POST -->
<g id="edge4" class="edge">
<title>BIOSSetup&#45;&gt;POST</title>
<path fill="none" stroke="black" d="M1149.64,-295.97C1112.49,-285.8 1054.3,-271.49 1002.75,-265.82 893.3,-253.77 762.96,-265.78 700.24,-273.19"/>
<polygon fill="black" stroke="black" points="699.99,-269.69 690.48,-274.37 700.83,-276.64 699.99,-269.69"/>
<text text-anchor="middle" x="949.12" y="-266.77" font-family="Times,serif" font-size="14.00">finished_bios_setup</text>
</g>
<!-- WaitingForOS&#45;&gt;PoweredOff -->
<g id="edge5" class="edge">
<title>WaitingForOS&#45;&gt;PoweredOff</title>
<path fill="none" stroke="black" d="M901.6,-125.18C867.31,-125.53 819.79,-128.14 779.25,-138.07 629.6,-174.72 592.58,-195.51 461.25,-276.07 457.16,-278.58 440.47,-292.38 424.84,-305.53"/>
<polygon fill="black" stroke="black" points="422.9,-302.59 417.51,-311.71 427.41,-307.94 422.9,-302.59"/>
<text text-anchor="middle" x="661.88" y="-216.91" font-family="Times,serif" font-size="14.00">hard_shutdown</text>
</g>
<!-- WaitingForHWInfo -->
<g id="node6" class="node">
<title>WaitingForHWInfo</title>
<path fill="white" stroke="black" d="M1238.5,-137.07C1238.5,-137.07 1139.25,-137.07 1139.25,-137.07 1133.25,-137.07 1127.25,-131.07 1127.25,-125.07 1127.25,-125.07 1127.25,-113.07 1127.25,-113.07 1127.25,-107.07 1133.25,-101.07 1139.25,-101.07 1139.25,-101.07 1238.5,-101.07 1238.5,-101.07 1244.5,-101.07 1250.5,-107.07 1250.5,-113.07 1250.5,-113.07 1250.5,-125.07 1250.5,-125.07 1250.5,-131.07 1244.5,-137.07 1238.5,-137.07"/>
<text text-anchor="start" x="1135.25" y="-112.89" font-family="Times,serif" font-size="14.00">WaitingForHWInfo</text>
</g>
<!-- WaitingForOS&#45;&gt;WaitingForHWInfo -->
<g id="edge6" class="edge">
<title>WaitingForOS&#45;&gt;WaitingForHWInfo</title>
<path fill="none" stroke="black" d="M996.81,-124.7C1030.66,-123.7 1077.07,-122.33 1115.68,-121.2"/>
<polygon fill="black" stroke="black" points="1115.46,-124.7 1125.35,-120.91 1115.25,-117.71 1115.46,-124.7"/>
<text text-anchor="middle" x="1065" y="-124.76" font-family="Times,serif" font-size="14.00">os_booted</text>
</g>
<!-- OCTypeDecision -->
<g id="node7" class="node">
<title>OCTypeDecision</title>
<path fill="white" stroke="black" d="M1478.75,-226.07C1478.75,-226.07 1392.25,-226.07 1392.25,-226.07 1386.25,-226.07 1380.25,-220.07 1380.25,-214.07 1380.25,-214.07 1380.25,-202.07 1380.25,-202.07 1380.25,-196.07 1386.25,-190.07 1392.25,-190.07 1392.25,-190.07 1478.75,-190.07 1478.75,-190.07 1484.75,-190.07 1490.75,-196.07 1490.75,-202.07 1490.75,-202.07 1490.75,-214.07 1490.75,-214.07 1490.75,-220.07 1484.75,-226.07 1478.75,-226.07"/>
<text text-anchor="start" x="1388.25" y="-201.89" font-family="Times,serif" font-size="14.00">OCTypeDecision</text>
</g>
<!-- WaitingForHWInfo&#45;&gt;OCTypeDecision -->
<g id="edge18" class="edge">
<title>WaitingForHWInfo&#45;&gt;OCTypeDecision</title>
<path fill="none" stroke="black" d="M1240.56,-137.51C1279.1,-151.53 1332.29,-170.88 1373.22,-185.77"/>
<polygon fill="black" stroke="black" points="1371.86,-189.01 1382.46,-189.14 1374.26,-182.43 1371.86,-189.01"/>
<text text-anchor="middle" x="1315.38" y="-182.72" font-family="Times,serif" font-size="14.00">hwinfo_available</text>
</g>
<!-- RoughMulticoreUndervolt -->
<g id="node8" class="node">
<title>RoughMulticoreUndervolt</title>
<path fill="white" stroke="black" d="M1834.5,-277.07C1834.5,-277.07 1697,-277.07 1697,-277.07 1691,-277.07 1685,-271.07 1685,-265.07 1685,-265.07 1685,-253.07 1685,-253.07 1685,-247.07 1691,-241.07 1697,-241.07 1697,-241.07 1834.5,-241.07 1834.5,-241.07 1840.5,-241.07 1846.5,-247.07 1846.5,-253.07 1846.5,-253.07 1846.5,-265.07 1846.5,-265.07 1846.5,-271.07 1840.5,-277.07 1834.5,-277.07"/>
<text text-anchor="start" x="1693" y="-252.89" font-family="Times,serif" font-size="14.00">RoughMulticoreUndervolt</text>
</g>
<!-- OCTypeDecision&#45;&gt;RoughMulticoreUndervolt -->
<g id="edge7" class="edge">
<title>OCTypeDecision&#45;&gt;RoughMulticoreUndervolt</title>
<path fill="none" stroke="black" d="M1491.03,-210.75C1537.67,-213.69 1606.43,-219.57 1665.5,-230.82 1675.22,-232.67 1685.36,-235.04 1695.29,-237.61"/>
<polygon fill="black" stroke="black" points="1694.36,-240.98 1704.92,-240.2 1696.17,-234.22 1694.36,-240.98"/>
<text text-anchor="middle" x="1587.12" y="-231.77" font-family="Times,serif" font-size="14.00">rough_multicore_undervolt</text>
</g>
<!-- PreciseMulticoreUndervolt -->
<g id="node9" class="node">
<title>PreciseMulticoreUndervolt</title>
<path fill="white" stroke="black" d="M1836,-178.07C1836,-178.07 1695.5,-178.07 1695.5,-178.07 1689.5,-178.07 1683.5,-172.07 1683.5,-166.07 1683.5,-166.07 1683.5,-154.07 1683.5,-154.07 1683.5,-148.07 1689.5,-142.07 1695.5,-142.07 1695.5,-142.07 1836,-142.07 1836,-142.07 1842,-142.07 1848,-148.07 1848,-154.07 1848,-154.07 1848,-166.07 1848,-166.07 1848,-172.07 1842,-178.07 1836,-178.07"/>
<text text-anchor="start" x="1691.5" y="-153.89" font-family="Times,serif" font-size="14.00">PreciseMulticoreUndervolt</text>
</g>
<!-- OCTypeDecision&#45;&gt;PreciseMulticoreUndervolt -->
<g id="edge8" class="edge">
<title>OCTypeDecision&#45;&gt;PreciseMulticoreUndervolt</title>
<path fill="none" stroke="black" d="M1490.87,-196.96C1496.9,-195.84 1502.95,-194.77 1508.75,-193.82 1562.72,-184.95 1623.38,-176.87 1672.11,-170.84"/>
<polygon fill="black" stroke="black" points="1672.27,-174.35 1681.77,-169.65 1671.42,-167.4 1672.27,-174.35"/>
<text text-anchor="middle" x="1587.12" y="-194.77" font-family="Times,serif" font-size="14.00">precise_multicore_undervolt</text>
</g>
<!-- SingleCoreTuning -->
<g id="node10" class="node">
<title>SingleCoreTuning</title>
<path fill="white" stroke="black" d="M1811.25,-468.07C1811.25,-468.07 1720.25,-468.07 1720.25,-468.07 1714.25,-468.07 1708.25,-462.07 1708.25,-456.07 1708.25,-456.07 1708.25,-444.07 1708.25,-444.07 1708.25,-438.07 1714.25,-432.07 1720.25,-432.07 1720.25,-432.07 1811.25,-432.07 1811.25,-432.07 1817.25,-432.07 1823.25,-438.07 1823.25,-444.07 1823.25,-444.07 1823.25,-456.07 1823.25,-456.07 1823.25,-462.07 1817.25,-468.07 1811.25,-468.07"/>
<text text-anchor="start" x="1716.25" y="-443.89" font-family="Times,serif" font-size="14.00">SingleCoreTuning</text>
</g>
<!-- OCTypeDecision&#45;&gt;SingleCoreTuning -->
<g id="edge9" class="edge">
<title>OCTypeDecision&#45;&gt;SingleCoreTuning</title>
<path fill="none" stroke="black" d="M1461.44,-226.46C1519.62,-269.35 1664.39,-376.08 1730.66,-424.94"/>
<polygon fill="black" stroke="black" points="1728.5,-427.69 1738.63,-430.81 1732.66,-422.06 1728.5,-427.69"/>
<text text-anchor="middle" x="1587.12" y="-372.74" font-family="Times,serif" font-size="14.00">single_core_tuning</text>
</g>
<!-- RoughMulticoreUndervolt&#45;&gt;PoweredOff -->
<g id="edge10" class="edge">
<title>RoughMulticoreUndervolt&#45;&gt;PoweredOff</title>
<path fill="none" stroke="black" d="M1757.07,-277.52C1743.54,-307.33 1712.4,-365.22 1665.5,-390.07 1612.58,-418.11 1186.67,-410.6 1127.25,-418.07 1071.25,-425.11 1058.71,-435.75 1002.75,-443.07 896.12,-457.02 868.74,-454.73 761.25,-458.07 627.56,-462.22 570.49,-511.26 461.25,-434.07 435.14,-415.62 416.77,-383.36 406.06,-359.85"/>
<polygon fill="black" stroke="black" points="409.33,-358.6 402.14,-350.81 402.91,-361.38 409.33,-358.6"/>
<text text-anchor="middle" x="1065" y="-441.28" font-family="Times,serif" font-size="14.00">hard_shutdown</text>
</g>
<!-- RoughMulticoreUndervolt&#45;&gt;POST -->
<g id="edge11" class="edge">
<title>RoughMulticoreUndervolt&#45;&gt;POST</title>
<path fill="none" stroke="black" d="M1684.66,-258.79C1545.83,-258.32 1251.46,-257.4 1002.75,-257.07 903.42,-256.94 878.19,-248.21 779.25,-257.07 752.61,-259.45 722.94,-264.85 700.23,-269.58"/>
<polygon fill="black" stroke="black" points="699.57,-266.14 690.52,-271.65 701.03,-272.98 699.57,-266.14"/>
<text text-anchor="middle" x="1188.88" y="-258.48" font-family="Times,serif" font-size="14.00">reboot</text>
</g>
<!-- PreciseMulticoreUndervolt&#45;&gt;PoweredOff -->
<g id="edge12" class="edge">
<title>PreciseMulticoreUndervolt&#45;&gt;PoweredOff</title>
<path fill="none" stroke="black" d="M1737.58,-141.75C1683.02,-106.8 1555.23,-34.07 1436.5,-34.07 827.38,-34.07 827.38,-34.07 827.38,-34.07 709.17,-34.07 662.94,4.26 562.5,-58.07 489.39,-103.44 495.26,-144.04 461.25,-223.07 449.06,-251.39 459.78,-264.04 443.25,-290.07 439.77,-295.56 435.32,-300.69 430.53,-305.34"/>
<polygon fill="black" stroke="black" points="428.54,-302.42 423.4,-311.69 433.19,-307.65 428.54,-302.42"/>
<text text-anchor="middle" x="1065" y="-35.02" font-family="Times,serif" font-size="14.00">hard_shutdown</text>
</g>
<!-- PreciseMulticoreUndervolt&#45;&gt;POST -->
<g id="edge13" class="edge">
<title>PreciseMulticoreUndervolt&#45;&gt;POST</title>
<path fill="none" stroke="black" d="M1683.38,-162.44C1584.97,-165.75 1414.35,-172.88 1268.5,-186.07 1050.15,-205.82 994.7,-208.5 779.25,-249.07 752.47,-254.11 722.65,-261.58 699.9,-267.67"/>
<polygon fill="black" stroke="black" points="699.22,-264.23 690.49,-270.23 701.06,-270.99 699.22,-264.23"/>
<text text-anchor="middle" x="1188.88" y="-199.62" font-family="Times,serif" font-size="14.00">reboot</text>
</g>
<!-- SingleCoreTuning&#45;&gt;PoweredOff -->
<g id="edge23" class="edge">
<title>SingleCoreTuning&#45;&gt;PoweredOff</title>
<path fill="none" stroke="black" d="M1712.63,-468.54C1648.51,-489.58 1535.91,-521.07 1436.5,-521.07 660.88,-521.07 660.88,-521.07 660.88,-521.07 568.96,-521.07 532.13,-525.58 461.25,-467.07 428,-439.62 410.06,-391.51 401.46,-360.48"/>
<polygon fill="black" stroke="black" points="404.89,-359.77 398.99,-350.97 398.11,-361.53 404.89,-359.77"/>
<text text-anchor="middle" x="1065" y="-522.02" font-family="Times,serif" font-size="14.00">hard_shutdown</text>
</g>
<!-- SingleCoreTuning&#45;&gt;POST -->
<g id="edge24" class="edge">
<title>SingleCoreTuning&#45;&gt;POST</title>
<path fill="none" stroke="black" d="M1707.81,-446.81C1555.28,-437.12 1125.54,-403.62 779.25,-317.07 752.25,-310.32 722.5,-300.3 699.84,-292.11"/>
<polygon fill="black" stroke="black" points="701.35,-288.94 690.75,-288.78 698.94,-295.51 701.35,-288.94"/>
<text text-anchor="middle" x="1188.88" y="-402.53" font-family="Times,serif" font-size="14.00">reboot</text>
</g>
<!-- BootLoop&#45;&gt;PoweredOff -->
<g id="edge19" class="edge">
<title>BootLoop&#45;&gt;PoweredOff</title>
<path fill="none" stroke="black" d="M912.98,-416.02C901.89,-420.54 889.42,-424.79 877.5,-427.07 786.56,-444.44 544.18,-450.23 461.25,-409.07 439.33,-398.19 421.77,-376.49 410.21,-358.73"/>
<polygon fill="black" stroke="black" points="413.45,-357.32 405.21,-350.65 407.5,-361 413.45,-357.32"/>
<text text-anchor="middle" x="661.88" y="-441.21" font-family="Times,serif" font-size="14.00">trigger_cmos_reset | hard_shutdown</text>
</g>
<!-- IdleWaitingForInput -->
<g id="node12" class="node">
<title>IdleWaitingForInput</title>
<path fill="darksalmon" stroke="red" d="M119,-279.07C119,-279.07 16,-279.07 16,-279.07 10,-279.07 4,-273.07 4,-267.07 4,-267.07 4,-255.07 4,-255.07 4,-249.07 10,-243.07 16,-243.07 16,-243.07 119,-243.07 119,-243.07 125,-243.07 131,-249.07 131,-255.07 131,-255.07 131,-267.07 131,-267.07 131,-273.07 125,-279.07 119,-279.07"/>
<path fill="none" stroke="red" d="M123,-283.07C123,-283.07 12,-283.07 12,-283.07 6,-283.07 0,-277.07 0,-271.07 0,-271.07 0,-251.07 0,-251.07 0,-245.07 6,-239.07 12,-239.07 12,-239.07 123,-239.07 123,-239.07 129,-239.07 135,-245.07 135,-251.07 135,-251.07 135,-271.07 135,-271.07 135,-277.07 129,-283.07 123,-283.07"/>
<text text-anchor="start" x="12" y="-254.89" font-family="Times,serif" font-size="14.00">IdleWaitingForInput</text>
</g>
<!-- IdleWaitingForInput&#45;&gt;PoweredOff -->
<g id="edge20" class="edge">
<title>IdleWaitingForInput&#45;&gt;PoweredOff</title>
<path fill="none" stroke="black" d="M135.29,-275.49C196.69,-288.74 286.38,-308.11 342.07,-320.13"/>
<polygon fill="black" stroke="black" points="341.09,-323.5 351.6,-322.19 342.56,-316.65 341.09,-323.5"/>
<text text-anchor="middle" x="239.62" y="-316.9" font-family="Times,serif" font-size="14.00">hard_shutdown | soft_shutdown</text>
</g>
<!-- IdleWaitingForInput&#45;&gt;POST -->
<g id="edge21" class="edge">
<title>IdleWaitingForInput&#45;&gt;POST</title>
<path fill="none" stroke="black" d="M135.3,-262.99C260.06,-266.57 524.71,-274.16 623.04,-276.98"/>
<polygon fill="black" stroke="black" points="622.85,-280.48 632.94,-277.27 623.05,-273.48 622.85,-280.48"/>
<text text-anchor="middle" x="393.75" y="-272.76" font-family="Times,serif" font-size="14.00">power_on | reboot</text>
</g>
<!-- IdleWaitingForInput&#45;&gt;WaitingForHWInfo -->
<g id="edge22" class="edge">
<title>IdleWaitingForInput&#45;&gt;WaitingForHWInfo</title>
<path fill="none" stroke="black" d="M89.75,-238.88C138.43,-190.54 263.81,-80.07 392.75,-80.07 392.75,-80.07 392.75,-80.07 950.12,-80.07 1006.27,-80.07 1068.91,-90.79 1115.79,-100.99"/>
<polygon fill="black" stroke="black" points="1114.75,-104.35 1125.27,-103.1 1116.27,-97.52 1114.75,-104.35"/>
<text text-anchor="middle" x="661.88" y="-81.02" font-family="Times,serif" font-size="14.00">begin_automation</text>
</g>
</g>
</svg>

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -1 +0,0 @@
{"video_device": {"friendly_name": "WARRKY USB 3.0", "format": "mjpeg", "resolution": "1920x1080", "fps": "60.000"}, "esp32_serial": "usb-1a86_USB_Single_Serial_585D015807-if00"}

28
profiles/hong.toml Normal file
View File

@ -0,0 +1,28 @@
[server]
esp32_serial = "usb-1a86_USB_Single_Serial_585D015807-if00"
[server.video_device]
friendly_name = "WARRKY USB 3.0"
format = "mjpeg"
resolution = "1920x1080"
fps = "60.000"
[client]
hostname = "10.20.30.48"
hwinfo_port = "60000"
[client.overclocking.common]
"ACPI SRAT L3 Cache As NUMA Domain" = "Enabled"
"Spread Spectrum" = "Disabled"
"PBO Limits" = "Motherboard"
"Precision Boost Overdrive Scalar" = "10X"
"Max CPU Boost Clock Override(+)" = "200"
"Auto Driver Installer" = "Disabled"
# "dGPU Only Mode" = "Enabled"
[client.overclocking.cpu]
[client.overclocking.memory]
"DRAM Profile Setting" = "XMP1-6000"
"DRAM Performance Mode" = "Aggressive"
"SOC/Uncore OC Voltage (VDD_SOC)" = "1.1"

View File

@ -1,12 +1,14 @@
import networkx as nx
import serial
from ipkvm.util.mkb import HIDKeyCode
#from ipkvm.util.mkb import HIDKeyCode
import json
import time
# Load the Graphviz file
graph = nx.nx_agraph.read_dot("bios-maps/asrock/b650e-riptide-wifi.gv")
print(type(graph))
print(graph)
print(graph.edges())
@ -21,7 +23,7 @@ print(graph.edges(data=True))
for edge_a, edge_b, data in graph.edges(data=True):
print(f"Edge: {edge_a} to {edge_b}, Attributes: {data}")
path = nx.shortest_path(graph, "exit", "oc_menu")
path = nx.shortest_path(graph, "Exit", "TDP to 105W")
for pair in nx.utils.pairwise(path):
print(pair)
@ -37,35 +39,36 @@ print("Edge path with data:", edge_path_with_data)
print("GENERATOR TEST")
for path in sorted(nx.all_simple_edge_paths(graph, "exit", "oc_menu")):
for path in sorted(nx.all_simple_edge_paths(graph, "Exit", "Tool")):
for edge in path:
print(edge)
#print(edge)
keys = graph.get_edge_data(edge[0], edge[1])[0]["keypath"].split(',')
print(keys)
#print(keys)
with serial.Serial('/dev/serial/by-id/usb-1a86_USB_Single_Serial_585D015807-if00', 115200, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE) as ser:
for key in keys:
test_json_a = {
"mouseX": 99999,
"mouseY": 99999,
"mouse_down": ["rbutton", "lbutton"],
"mouse_up": ["otherbutton"],
"key_down": [HIDKeyCode[key]],
"key_up": []
}
#
print(HIDKeyCode[key])
ser.write(json.dumps(test_json_a).encode())
test_json_a = {
"mouseX": 99999,
"mouseY": 99999,
"mouse_down": ["rbutton", "lbutton"],
"mouse_up": ["otherbutton"],
"key_down": [],
"key_up": [HIDKeyCode[key]]
}
#
print(HIDKeyCode[key])
ser.write(json.dumps(test_json_a).encode())
#time.sleep(0.1)
# with serial.Serial('/dev/serial/by-id/usb-1a86_USB_Single_Serial_585D015807-if00', 115200, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE) as ser:
for key in keys:
print(key)
#test_json_a = {
# "mouseX": 99999,
# "mouseY": 99999,
# "mouse_down": ["rbutton", "lbutton"],
# "mouse_up": ["otherbutton"],
# "key_down": [HIDKeyCode[key]],
# "key_up": []
#}
# #
#print(key)
##ser.write(json.dumps(test_json_a).encode())
#
#test_json_a = {
# "mouseX": 99999,
# "mouseY": 99999,
# "mouse_down": ["rbutton", "lbutton"],
# "mouse_up": ["otherbutton"],
# "key_down": [],
# "key_up": [HIDKeyCode[key]]
#}
# #
#print(key)
##ser.write(json.dumps(test_json_a).encode())
##time.sleep(0.1)

View File

@ -1,7 +1,7 @@
from os import name, listdir
from flask import Flask
from flask_socketio import SocketIO
import json
import tomlkit
import logging
@ -10,7 +10,14 @@ ui = SocketIO(app)
logger = app.logger
logger.setLevel(logging.INFO)
from ipkvm.util import video
def new_profile():
profile = tomlkit.document()
server = tomlkit.table()
video_device = tomlkit.table()
client = tomlkit.table()
device_list = video.create_device_list()
print(f"Detected {len(device_list)} video devices on your system.")
print("Please enter the number of your preferred video device.")
@ -18,6 +25,7 @@ def new_profile():
print(f"{i + 1}. {device.friendly_name}")
device = int(input("> ")) - 1
video_device["friendly_name"] = device_list[device].friendly_name
if len(device_list[device].video_formats) > 1:
print("Please enter your preferred video input format: ")
@ -25,10 +33,12 @@ def new_profile():
print(f"{i + 1}. {format}")
format = list(device_list[device].video_formats.keys())[int(input("> ")) - 1]
video_device["format"] = format
else:
format = next(iter(device_list[device].video_formats))
print(f"Video input format auto-detected as {format}!")
video_device["format"] = format
print("Please enter the number of your preferred video resolution.")
@ -36,6 +46,7 @@ def new_profile():
print(f"{i + 1}. {resolution}")
resolution = list(device_list[device].video_formats[format].keys())[int(input("> ")) - 1]
video_device["resolution"] = resolution
print("Please enter the number of your preferred video refresh rate.")
@ -43,6 +54,7 @@ def new_profile():
print(f"{i + 1}. {fps}")
fps = str(device_list[device].video_formats[format][resolution][int(input("> ")) - 1])
video_device["fps"] = fps
if name == "posix":
serial_devices = listdir("/dev/serial/by-id/")
@ -55,31 +67,63 @@ def new_profile():
for i, serial_device in enumerate(serial_devices):
print(f"{i + 1}. {serial_device}")
serial_device = serial_devices[int(input("> ")) - 1]
server["esp32_serial"] = serial_devices[int(input("> ")) - 1]
elif len(serial_devices) == 1:
print(f"ESP32 auto-detected as {serial_devices[0]}!")
serial_device = serial_devices[0]
server["esp32_serial"] = serial_devices[0]
else:
raise RuntimeError("No valid ESP32 devices connected!")
print("Please enter the hostname or IP address of your client.")
client["hostname"] = input("> ")
print("Please enter the port for RemoteHWInfo, if you have changed it from the default [60000].")
port = input("> ")
if port == "":
port = "60000"
client["hwinfo_port"] = port
print("Please enter your new profile name.")
profile_name = input("> ")
profile: dict[str, str | dict[str, str]] = {
"video_device": {
"friendly_name": device_list[device].friendly_name,
"format": format,
"resolution": resolution,
"fps": fps
},
"esp32_serial": serial_device
server["video_device"] = video_device
client["overclocking"] = {
"common": {},
"cpu": {},
"memory": {}
}
profile["server"] = server
profile["client"] = client
#profile: dict[str, dict[str, str | dict[str, str]] | dict[str, str | dict[str, dict[str, str]]]] = {
# "server": {
# "esp32_serial": serial_device,
# "video_device": {
# "friendly_name": device_list[device].friendly_name,
# "format": format,
# "resolution": resolution,
# "fps": fps
# }
# },
#
# "client": {
# "hostname": hostname,
# "hwinfo_port": port,
#
# "overclocking": {
# "common": {},
# "cpu": {},
# "memory": {}
# }
# }
#}
with open(f"profiles/{profile_name}.json", 'w') as file:
json.dump(profile, file)
with open(f"profiles/{profile_name}.toml", 'w') as file:
tomlkit.dump(profile, file)
return profile
@ -90,14 +134,14 @@ if len(listdir("profiles")) == 0:
elif len(listdir("profiles")) == 1:
print(f"Only one profile found, autoloading {listdir("profiles")[0]}...")
with open(f"profiles/{listdir("profiles")[0]}", 'r') as file:
profile = json.load(file)
print(profile)
profile = tomlkit.load(file)
from ipkvm.util import video
from ipkvm import feed
from ipkvm.util.mkb import Esp32Serial
from ipkvm.hwinfo import HWInfoMonitor
frame_buffer = feed.FrameBuffer()
esp32_serial = Esp32Serial()
monitor = HWInfoMonitor()
from ipkvm import routes, events

View File

@ -2,6 +2,10 @@ from ipkvm import ui
from ipkvm import esp32_serial
from ipkvm.util.mkb import HIDKeyCode, HIDMouseScanCodes, GPIO
import time
from ipkvm.util import graphs
from ipkvm import states
from ipkvm import profile
import tomlkit
def power_switch(delay: float):
msg = {
@ -16,41 +20,36 @@ def power_switch(delay: float):
@ui.on("power_on")
def handle_poweron():
if esp32_serial.power_status == "off":
power_switch(0.2)
states.model.power_on()
@ui.on("soft_power_off")
def handle_soft_poweroff():
if esp32_serial.power_status == "on":
power_switch(0.2)
states.model.soft_shutdown()
@ui.on("hard_power_off")
def handle_hard_poweroff():
if esp32_serial.power_status == "on":
power_switch(0.5)
states.model.hard_shutdown()
@ui.on("reboot_into_bios")
def handle_reboot_bios():
if esp32_serial.power_status == "on": # and OS state = offline
power_switch(5)
time.sleep(2)
power_switch(0.2)
else:
power_switch(0.2)
while time.time() - esp32_serial.bios_timer <= 5 or time.time() - esp32_serial.bios_timer >= 6:
print(time.time() - esp32_serial.bios_timer)
msg = {
"key_down": HIDKeyCode.Delete.value
states.model.reboot_into_bios()
@ui.on("clear_cmos")
def handle_clear_cmos():
msg = {
"cmos": GPIO.HIGH.value
}
esp32_serial.mkb_queue.put(msg)
time.sleep(0.1)
msg = {
"key_up": HIDKeyCode.Delete.value
esp32_serial.mkb_queue.put(msg)
time.sleep(0.2)
msg = {
"cmos": GPIO.LOW.value
}
esp32_serial.mkb_queue.put(msg)
time.sleep(0.1)
esp32_serial.mkb_queue.put(msg)
time.sleep(1)
power_switch(0.2)
spam_delete_until_bios()
@ui.on('key_down')
def handle_keydown(data: str):
@ -94,3 +93,11 @@ def handle_mouseup(data: int):
}
esp32_serial.mkb_queue.put(msg)
@ui.on("test_route")
def handle_test_route():
graphs.test_route()
@ui.on("get_current_profile")
def handle_current_profile():
return tomlkit.dumps(profile)

View File

@ -75,7 +75,7 @@ class FrameBuffer(threading.Thread):
device_list = video.create_device_list()
device_path = ""
for device in device_list:
if device.friendly_name == profile["video_device"]["friendly_name"]:
if device.friendly_name == profile["server"]["video_device"]["friendly_name"]:
device_path = device.path
if name == "posix":
@ -85,8 +85,8 @@ class FrameBuffer(threading.Thread):
raise RuntimeError("We're on something other than Linux, and that's not yet supported!")
device.set(cv2.CAP_PROP_FOURCC, cv2.VideoWriter_fourcc(*"YUYV"))
device.set(cv2.CAP_PROP_FRAME_WIDTH, int(profile["video_device"]["resolution"].split('x')[0]))
device.set(cv2.CAP_PROP_FRAME_HEIGHT, int(profile["video_device"]["resolution"].split('x')[1]))
device.set(cv2.CAP_PROP_FPS, float(profile["video_device"]["fps"]))
device.set(cv2.CAP_PROP_FRAME_WIDTH, int(profile["server"]["video_device"]["resolution"].split('x')[0]))
device.set(cv2.CAP_PROP_FRAME_HEIGHT, int(profile["server"]["video_device"]["resolution"].split('x')[1]))
device.set(cv2.CAP_PROP_FPS, float(profile["server"]["video_device"]["fps"]))
return device

77
webui/ipkvm/hwinfo.py Normal file
View File

@ -0,0 +1,77 @@
import json
import threading
import re
import requests
#from ipkvm import profile
import time
from rich import print
import pandas as pd
from ipkvm import ui
class HWInfoMonitor(threading.Thread):
def __init__(self):
super().__init__()
#self.request_url = f"http://{profile["client"]["hostname"]}:{profile["client"]["port"]}/json.json"
self.request_url = "http://10.20.30.48:60000/json.json"
self.dataframe = self.create_dataframe()
self.start()
def run(self):
while True:
self.create_dataframe()
time.sleep(0.25)
def create_dataframe(self):
while not self.is_hwinfo_alive():
time.sleep(1)
request = requests.get(self.request_url)
data = request.json()
cpu_list: list[str] = []
vid_list: list[str] = []
mhz_list: list[str] = []
ccd_list: list[str] = []
temp_list: list[str] = []
power_list: list[str] = []
for reading in data["hwinfo"]["readings"]:
label = reading["labelOriginal"]
match = re.match(r"(?P<core_ccd>Core[0-9]* \(CCD[0-9]\))|(?P<core_vid>Core [0-9]* VID)|(?P<core_mhz>Core [0-9]* T0 Effective Clock)|(?P<core_power>Core [0-9]* Power)", label)
if match:
if match.group("core_ccd"):
core_ccd = match.group("core_ccd").split(' ')
core_ccd[0] = core_ccd[0][:4] + ' ' + core_ccd[0][4:]
cpu_list.append(core_ccd[0])
ccd_list.append(core_ccd[1].strip('()'))
temp_list.append(round(reading["value"], 2))
elif match.group("core_vid"):
vid_list.append(reading["value"])
elif match.group("core_mhz"):
mhz_list.append(round(reading["value"], 2))
elif match.group("core_power"):
power_list.append(round(reading["value"], 2))
core_dataframe = pd.DataFrame({
"CCD": ccd_list,
"Clk": mhz_list,
"VID": vid_list,
"Power": power_list,
"Temp": temp_list
}, index=cpu_list)
ui.emit("update_core_info_table", core_dataframe.to_dict("index"))
def is_hwinfo_alive(self):
request = requests.get(self.request_url)
if request.status_code == 200 and len(request.json()) > 0:
return True
return False

170
webui/ipkvm/states.py Normal file
View File

@ -0,0 +1,170 @@
from enum import Enum
import time
from transitions.experimental.utils import with_model_definitions, add_transitions, transition
from transitions.extensions import GraphMachine
from ipkvm import esp32_serial
from ipkvm.util.mkb import GPIO, HIDKeyCode
import logging
logging.basicConfig(level=logging.DEBUG)
# Set transitions' log level to INFO; DEBUG messages will be omitted
logging.getLogger('transitions').setLevel(logging.DEBUG)
class State(Enum):
PoweredOff = "powered off"
EnterBIOS = "enter bios"
BIOSSetup = "bios setup"
WaitingForOS = "waiting for os"
OCTypeDecision = "next process decision"
RoughMulticoreUndervolt = "rough multicore undervolting"
PreciseMulticoreUndervolt = "precise multicore undervolting"
POST = "power on self test"
WaitingForHWInfo = "waiting for hwinfo"
BootLoop = "boot loop"
IdleWaitingForInput = "idle, waiting for input"
SingleCoreTuning = "single core tuning"
class Overclocking:
state: State = State.IdleWaitingForInput
# TRANSITION DEFINITIONS
@add_transitions(transition([State.PoweredOff, State.IdleWaitingForInput], State.POST, after="_power_on",
unless="client_powered"))
def power_on(self): ...
@add_transitions(transition(State.POST, State.WaitingForOS))
def enter_os(self): ...
@add_transitions(transition(State.WaitingForOS, State.WaitingForHWInfo))
def os_booted(self): ...
@add_transitions(transition(State.WaitingForHWInfo, State.OCTypeDecision))
def hwinfo_available(self): ...
@add_transitions(transition(State.POST, State.EnterBIOS, after="_enter_bios"))
def enter_bios(self): ...
@add_transitions(transition(State.EnterBIOS, State.BIOSSetup))
def start_bios_setup(self): ...
@add_transitions(transition(State.BIOSSetup, State.POST))
def finished_bios_setup(self): ...
@add_transitions(transition(State.IdleWaitingForInput, State.WaitingForHWInfo))
def begin_automation(self): ...
@add_transitions(transition(State.POST, State.BootLoop))
def unsuccessful_post(self): ...
@add_transitions(transition(State.BootLoop, State.PoweredOff))
def trigger_cmos_reset(self): ...
@add_transitions(transition([State.IdleWaitingForInput, State.RoughMulticoreUndervolt,
State.PreciseMulticoreUndervolt, State.SingleCoreTuning], State.POST))
def reboot(self): ...
@add_transitions(transition([State.BIOSSetup, State.IdleWaitingForInput, State.BootLoop, State.POST,
State.WaitingForOS, State.RoughMulticoreUndervolt,
State.PreciseMulticoreUndervolt, State.SingleCoreTuning],
State.PoweredOff, after="_hard_shutdown", conditions="client_powered"))
def hard_shutdown(self): ...
@add_transitions(transition(State.IdleWaitingForInput, State.PoweredOff,
after="_soft_shutdown", conditions="client_powered"))
def soft_shutdown(self): ...
@add_transitions(transition(State.OCTypeDecision, State.RoughMulticoreUndervolt))
def rough_multicore_undervolt(self): ...
@add_transitions(transition(State.OCTypeDecision, State.PreciseMulticoreUndervolt))
def precise_multicore_undervolt(self): ...
@add_transitions(transition(State.OCTypeDecision, State.SingleCoreTuning))
def single_core_tuning(self): ...
# PROPERTIES GO HERE
@property
def client_powered(self):
return esp32_serial.power_status
# UTILITY FUNCTIONS GO HERE
def _power_switch(self, delay: float):
msg = {
"pwr": GPIO.HIGH.value
}
esp32_serial.mkb_queue.put(msg)
time.sleep(delay)
msg = {
"pwr": GPIO.LOW.value
}
esp32_serial.mkb_queue.put(msg)
# FUNCTIONS TRIGGERED BY STATE CHANGES
def _power_on(self):
self._power_switch(0.2)
# Unknown code definition, but this is the first consistent one indicating POST has started.
while esp32_serial.last_post_code != "FC":
pass
def _hard_shutdown(self):
self._power_switch(5)
while self.client_powered:
pass
def _soft_shutdown(self):
self._power_switch(0.2)
while self.client_powered:
pass
def _enter_bios(self):
# Wait until the POST has progressed far enough for USB devices to be loaded and options to be imminent
esp32_serial.notify_code = "45"
esp32_serial.active_notification_request.set()
esp32_serial.post_code_notify.wait()
esp32_serial.post_code_notify.clear()
# Spam delete until the BIOS is loaded
esp32_serial.notify_code = "Ab"
esp32_serial.active_notification_request.set()
while not esp32_serial.post_code_notify.is_set():
msg = {
"key_down": HIDKeyCode.Delete.value
}
esp32_serial.mkb_queue.put(msg)
time.sleep(0.1)
msg = {
"key_up": HIDKeyCode.Delete.value
}
esp32_serial.mkb_queue.put(msg)
time.sleep(0.1)
esp32_serial.post_code_notify.clear()
# Wait a few seconds for the BIOS to become responsive
time.sleep(5)
# OTHER FUNCTIONS GO HERE
def reboot_into_bios(self):
if self.client_powered:
if self.state is State.IdleWaitingForInput:
self.soft_shutdown()
else:
self.hard_shutdown()
self.power_on()
self.enter_bios()
@with_model_definitions
class MyMachine(GraphMachine):
pass
model = Overclocking()
machine = MyMachine(model, states=State, initial=model.state)
machine.get_graph().draw('my_state_diagram.svg', prog='dot')
print(model.client_powered)
print(model.state)

View File

@ -0,0 +1,344 @@
/* BASICS */
.CodeMirror {
/* Set height, width, borders, and global font properties here */
font-family: monospace;
height: 100%;
color: black;
direction: ltr;
}
/* PADDING */
.CodeMirror-lines {
padding: 4px 0; /* Vertical padding around content */
}
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
padding: 0 4px; /* Horizontal padding of content */
}
.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
background-color: white; /* The little square between H and V scrollbars */
}
/* GUTTER */
.CodeMirror-gutters {
border-right: 1px solid #ddd;
background-color: #f7f7f7;
white-space: nowrap;
}
.CodeMirror-linenumbers {}
.CodeMirror-linenumber {
padding: 0 3px 0 5px;
min-width: 20px;
text-align: right;
color: #999;
white-space: nowrap;
}
.CodeMirror-guttermarker { color: black; }
.CodeMirror-guttermarker-subtle { color: #999; }
/* CURSOR */
.CodeMirror-cursor {
border-left: 1px solid black;
border-right: none;
width: 0;
}
/* Shown when moving in bi-directional text */
.CodeMirror div.CodeMirror-secondarycursor {
border-left: 1px solid silver;
}
.cm-fat-cursor .CodeMirror-cursor {
width: auto;
border: 0 !important;
background: #7e7;
}
.cm-fat-cursor div.CodeMirror-cursors {
z-index: 1;
}
.cm-fat-cursor .CodeMirror-line::selection,
.cm-fat-cursor .CodeMirror-line > span::selection,
.cm-fat-cursor .CodeMirror-line > span > span::selection { background: transparent; }
.cm-fat-cursor .CodeMirror-line::-moz-selection,
.cm-fat-cursor .CodeMirror-line > span::-moz-selection,
.cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { background: transparent; }
.cm-fat-cursor { caret-color: transparent; }
@-moz-keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
@-webkit-keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
@keyframes blink {
0% {}
50% { background-color: transparent; }
100% {}
}
/* Can style cursor different in overwrite (non-insert) mode */
.CodeMirror-overwrite .CodeMirror-cursor {}
.cm-tab { display: inline-block; text-decoration: inherit; }
.CodeMirror-rulers {
position: absolute;
left: 0; right: 0; top: -50px; bottom: 0;
overflow: hidden;
}
.CodeMirror-ruler {
border-left: 1px solid #ccc;
top: 0; bottom: 0;
position: absolute;
}
/* DEFAULT THEME */
.cm-s-default .cm-header {color: blue;}
.cm-s-default .cm-quote {color: #090;}
.cm-negative {color: #d44;}
.cm-positive {color: #292;}
.cm-header, .cm-strong {font-weight: bold;}
.cm-em {font-style: italic;}
.cm-link {text-decoration: underline;}
.cm-strikethrough {text-decoration: line-through;}
.cm-s-default .cm-keyword {color: #708;}
.cm-s-default .cm-atom {color: #219;}
.cm-s-default .cm-number {color: #164;}
.cm-s-default .cm-def {color: #00f;}
.cm-s-default .cm-variable,
.cm-s-default .cm-punctuation,
.cm-s-default .cm-property,
.cm-s-default .cm-operator {}
.cm-s-default .cm-variable-2 {color: #05a;}
.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
.cm-s-default .cm-comment {color: #a50;}
.cm-s-default .cm-string {color: #a11;}
.cm-s-default .cm-string-2 {color: #f50;}
.cm-s-default .cm-meta {color: #555;}
.cm-s-default .cm-qualifier {color: #555;}
.cm-s-default .cm-builtin {color: #30a;}
.cm-s-default .cm-bracket {color: #997;}
.cm-s-default .cm-tag {color: #170;}
.cm-s-default .cm-attribute {color: #00c;}
.cm-s-default .cm-hr {color: #999;}
.cm-s-default .cm-link {color: #00c;}
.cm-s-default .cm-error {color: #f00;}
.cm-invalidchar {color: #f00;}
.CodeMirror-composing { border-bottom: 2px solid; }
/* Default styles for common addons */
div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
.CodeMirror-activeline-background {background: #e8f2ff;}
/* STOP */
/* The rest of this file contains styles related to the mechanics of
the editor. You probably shouldn't touch them. */
.CodeMirror {
position: relative;
overflow: hidden;
background: white;
}
.CodeMirror-scroll {
overflow: scroll !important; /* Things will break if this is overridden */
/* 50px is the magic margin used to hide the element's real scrollbars */
/* See overflow: hidden in .CodeMirror */
margin-bottom: -50px; margin-right: -50px;
padding-bottom: 50px;
height: 100%;
outline: none; /* Prevent dragging from highlighting the element */
position: relative;
z-index: 0;
}
.CodeMirror-sizer {
position: relative;
border-right: 50px solid transparent;
}
/* The fake, visible scrollbars. Used to force redraw during scrolling
before actual scrolling happens, thus preventing shaking and
flickering artifacts. */
.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
position: absolute;
z-index: 6;
display: none;
outline: none;
}
.CodeMirror-vscrollbar {
right: 0; top: 0;
overflow-x: hidden;
overflow-y: scroll;
}
.CodeMirror-hscrollbar {
bottom: 0; left: 0;
overflow-y: hidden;
overflow-x: scroll;
}
.CodeMirror-scrollbar-filler {
right: 0; bottom: 0;
}
.CodeMirror-gutter-filler {
left: 0; bottom: 0;
}
.CodeMirror-gutters {
position: absolute; left: 0; top: 0;
min-height: 100%;
z-index: 3;
}
.CodeMirror-gutter {
white-space: normal;
height: 100%;
display: inline-block;
vertical-align: top;
margin-bottom: -50px;
}
.CodeMirror-gutter-wrapper {
position: absolute;
z-index: 4;
background: none !important;
border: none !important;
}
.CodeMirror-gutter-background {
position: absolute;
top: 0; bottom: 0;
z-index: 4;
}
.CodeMirror-gutter-elt {
position: absolute;
cursor: default;
z-index: 4;
}
.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
.CodeMirror-lines {
cursor: text;
min-height: 1px; /* prevents collapsing before first draw */
}
.CodeMirror pre.CodeMirror-line,
.CodeMirror pre.CodeMirror-line-like {
/* Reset some styles that the rest of the page might have set */
-moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
border-width: 0;
background: transparent;
font-family: inherit;
font-size: inherit;
margin: 0;
white-space: pre;
word-wrap: normal;
line-height: inherit;
color: inherit;
z-index: 2;
position: relative;
overflow: visible;
-webkit-tap-highlight-color: transparent;
-webkit-font-variant-ligatures: contextual;
font-variant-ligatures: contextual;
}
.CodeMirror-wrap pre.CodeMirror-line,
.CodeMirror-wrap pre.CodeMirror-line-like {
word-wrap: break-word;
white-space: pre-wrap;
word-break: normal;
}
.CodeMirror-linebackground {
position: absolute;
left: 0; right: 0; top: 0; bottom: 0;
z-index: 0;
}
.CodeMirror-linewidget {
position: relative;
z-index: 2;
padding: 0.1px; /* Force widget margins to stay inside of the container */
}
.CodeMirror-widget {}
.CodeMirror-rtl pre { direction: rtl; }
.CodeMirror-code {
outline: none;
}
/* Force content-box sizing for the elements where we expect it */
.CodeMirror-scroll,
.CodeMirror-sizer,
.CodeMirror-gutter,
.CodeMirror-gutters,
.CodeMirror-linenumber {
-moz-box-sizing: content-box;
box-sizing: content-box;
}
.CodeMirror-measure {
position: absolute;
width: 100%;
height: 0;
overflow: hidden;
visibility: hidden;
}
.CodeMirror-cursor {
position: absolute;
pointer-events: none;
}
.CodeMirror-measure pre { position: static; }
div.CodeMirror-cursors {
visibility: hidden;
position: relative;
z-index: 3;
}
div.CodeMirror-dragcursors {
visibility: visible;
}
.CodeMirror-focused div.CodeMirror-cursors {
visibility: visible;
}
.CodeMirror-selected { background: #d9d9d9; }
.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
.CodeMirror-crosshair { cursor: crosshair; }
.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
.cm-searching {
background-color: #ffa;
background-color: rgba(255, 255, 0, .4);
}
/* Used to force a border model for a node */
.cm-force-border { padding-right: .1px; }
@media print {
/* Hide the cursor when printing */
.CodeMirror div.CodeMirror-cursors {
visibility: hidden;
}
}
/* See issue #2901 */
.cm-tab-wrap-hack:after { content: ''; }
/* Help users use markselection to safely style text background */
span.CodeMirror-selectedtext { background: none; }

View File

@ -1,8 +1,71 @@
.full-screen {
max-width: 100vw;
max-height: 100vh;
overflow: hidden;
}
.stream-container {
margin: 0 auto;
border: 20px;
}
.stream-view {
width: 100%;
height: auto;
}
.column-flex-container {
display: flex;
flex-direction: column;
overflow: hidden;
}
.row-flex-container {
display: flex;
flex-direction: row;
overflow: hidden;
}
.left-third {
flex-basis: 34%;
flex-grow: 1;
}
.right-third {
flex-basis: 66%;
}
.segment-container {
background-color: rgb(36, 30, 30);
border: 3px solid rgb(153, 153, 153);
width: 300px;
height: 188px;
margin-left: auto;
}
.post-log-container {
border: 1px solid #ccc;
overflow: auto;
flex-grow: 1;
min-height: 1em;
max-height: 100%;
flex-basis: 0;
white-space: pre-wrap;
}
/* god bless for this https://codsen.com/articles/styling-react-codemirror */
.cm-editor {
/* our container wrapper for Codemirror instance */
flex: 1; /* expand to the maximum */
height: 100%;
position: relative; /* needed for child component .cm-scroller */
}
.cm-scroller {
position: absolute !important;
top: 0;
right: 0;
bottom: 0;
left: 0;
overflow: auto;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -2,9 +2,11 @@ var last_mouse_update = Date.now()
var socket = io();
let streamview;
function mkbhandler_load()
{
const streamview = document.getElementById('streamview');
streamview = document.getElementById('streamview');
streamview.addEventListener("mouseenter", enable_listener);
streamview.addEventListener("mouseleave", disable_listener);
@ -80,4 +82,12 @@ function disable_listener()
document.removeEventListener('contextmenu', prevent_right_click);
}
function update_post_log(data)
{
document.getElementById("post-log-container").innerText += `\n ${data}`;
document.getElementById("post-log-container").scrollTop = document.getElementById("post-log-container").scrollHeight;
}
socket.on("update_post_log", update_post_log);
window.addEventListener("load", mkbhandler_load);

View File

@ -0,0 +1,14 @@
function codemirror_load()
{
const code_div = document.getElementById('codemirror');
var code_mirror = CodeMirror(code_div, {
lineNumbers: true
})
socket.emit("get_current_profile", (data) => {
code_mirror.setValue(data)
});
}
window.addEventListener("load", codemirror_load);

View File

@ -0,0 +1,48 @@
let container;
let hot;
function table_load() {
container = document.getElementById("stats-table");
}
function create_table(data) {
let row_headers = []
let col_headers = []
Object.keys(data).forEach((key, index) => {
row_headers.push(key)
Object.keys(data[key]).forEach((value, subIndex) => {
col_headers.push(value)
});
});
hot = new Handsontable(container, {
rowHeaders: row_headers,
rowHeaderWidth: 60,
colHeaders: col_headers,
height: 'auto',
autoWrapRow: true,
autoWrapCol: true,
licenseKey: 'non-commercial-and-evaluation' // for non-commercial use only
});
}
function update_core_info_table(data) {
if (hot) {
hot.batch(() => {
Object.keys(data).forEach((key, index) => {
Object.keys(data[key]).forEach((value, subIndex) => {
hot.setDataAtCell(index, subIndex, data[key][value])
});
});
});
}
else {
create_table(data)
}
}
socket.on("update_core_info_table", update_core_info_table);
window.addEventListener("load", table_load);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,73 @@
<!doctype html>
<title>CodeMirror: TOML Mode</title>
<meta charset="utf-8"/>
<link rel=stylesheet href="../../doc/docs.css">
<link rel="stylesheet" href="../../lib/codemirror.css">
<script src="../../lib/codemirror.js"></script>
<script src="toml.js"></script>
<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
<div id=nav>
<a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
<ul>
<li><a href="../../index.html">Home</a>
<li><a href="../../doc/manual.html">Manual</a>
<li><a href="https://github.com/codemirror/codemirror5">Code</a>
</ul>
<ul>
<li><a href="../index.html">Language modes</a>
<li><a class=active href="#">TOML Mode</a>
</ul>
</div>
<article>
<h2>TOML Mode</h2>
<form><textarea id="code" name="code">
# This is a TOML document. Boom.
title = "TOML Example"
[owner]
name = "Tom Preston-Werner"
organization = "GitHub"
bio = "GitHub Cofounder &amp; CEO\nLikes tater tots and beer."
dob = 1979-05-27T07:32:00Z # First class dates? Why not?
[database]
server = "192.168.1.1"
ports = [ 8001, 8001, 8002 ]
connection_max = 5000
enabled = true
[servers]
# You can indent as you please. Tabs or spaces. TOML don't care.
[servers.alpha]
ip = "10.0.0.1"
dc = "eqdc10"
[servers.beta]
ip = "10.0.0.2"
dc = "eqdc10"
[clients]
data = [ ["gamma", "delta"], [1, 2] ]
# Line breaks are OK when inside arrays
hosts = [
"alpha",
"omega"
]
</textarea></form>
<script>
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
mode: {name: "toml"},
lineNumbers: true
});
</script>
<h3>The TOML Mode</h3>
<p> Created by Forbes Lindesay.</p>
<p><strong>MIME type defined:</strong> <code>text/x-toml</code>.</p>
</article>

View File

@ -0,0 +1,88 @@
// CodeMirror, copyright (c) by Marijn Haverbeke and others
// Distributed under an MIT license: https://codemirror.net/5/LICENSE
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
mod(require("../../lib/codemirror"));
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
CodeMirror.defineMode("toml", function () {
return {
startState: function () {
return {
inString: false,
stringType: "",
lhs: true,
inArray: 0
};
},
token: function (stream, state) {
//check for state changes
if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) {
state.stringType = stream.peek();
stream.next(); // Skip quote
state.inString = true; // Update state
}
if (stream.sol() && state.inArray === 0) {
state.lhs = true;
}
//return state
if (state.inString) {
while (state.inString && !stream.eol()) {
if (stream.peek() === state.stringType) {
stream.next(); // Skip quote
state.inString = false; // Clear flag
} else if (stream.peek() === '\\') {
stream.next();
stream.next();
} else {
stream.match(/^.[^\\\"\']*/);
}
}
return state.lhs ? "property string" : "string"; // Token style
} else if (state.inArray && stream.peek() === ']') {
stream.next();
state.inArray--;
return 'bracket';
} else if (state.lhs && stream.peek() === '[' && stream.skipTo(']')) {
stream.next();//skip closing ]
// array of objects has an extra open & close []
if (stream.peek() === ']') stream.next();
return "atom";
} else if (stream.peek() === "#") {
stream.skipToEnd();
return "comment";
} else if (stream.eatSpace()) {
return null;
} else if (state.lhs && stream.eatWhile(function (c) { return c != '=' && c != ' '; })) {
return "property";
} else if (state.lhs && stream.peek() === "=") {
stream.next();
state.lhs = false;
return null;
} else if (!state.lhs && stream.match(/^\d\d\d\d[\d\-\:\.T]*Z/)) {
return 'atom'; //date
} else if (!state.lhs && (stream.match('true') || stream.match('false'))) {
return 'atom';
} else if (!state.lhs && stream.peek() === '[') {
state.inArray++;
stream.next();
return 'bracket';
} else if (!state.lhs && stream.match(/^\-?\d+(?:\.\d+)?/)) {
return 'number';
} else if (!stream.eatSpace()) {
stream.next();
}
return null;
}
};
});
CodeMirror.defineMIME('text/x-toml', 'toml');
});

File diff suppressed because one or more lines are too long

View File

@ -1,30 +1,76 @@
<!DOCTYPE html>
<link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
<script src="{{ url_for('static', filename='js/vendor/socketio/socket.io.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/vendor/SegmentDisplay/segment-display.js') }}"></script>
<script src="{{ url_for('static', filename='js/mkb_handler.js') }}"></script>
<script src="{{ url_for('static', filename='js/seven_segment.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/codemirror.css') }}">
<script src="{{ url_for('static', filename='js/vendor/codemirror/codemirror.js') }}"></script>
<script src="{{ url_for('static', filename='js/vendor/codemirror/toml/toml.js') }}"></script>
<script src="{{ url_for('static', filename='js/my-codemirror.js') }}"></script>
<link rel="stylesheet" href="{{ url_for('static', filename='css/vendor/handsontable/handsontable.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='css/vendor/handsontable/ht-theme-main.min.css') }}">
<script src="{{ url_for('static', filename='js/vendor/handsontable/handsontable.full.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/table.js') }}"></script>
<html>
<head>
<title>IP KVM & OC Tuner</title>
</head>
<body>
<div id="streamview" class="stream-container">
<img src="/video_feed" class="stream-view" />
<head>
<title>IP KVM & OC Tuner</title>
</head>
<body>
<div class="row-flex-container full-screen">
<div class="column-flex-container left-third">
<div class="menubar">
<!-- <div class="dropdown">
<button type="button">Load profile...</button>
<div class="dropdown-options">
<p>Test1</p>
<p>Test2</p>
</div>
</div> -->
<select id="countrySelect" name="countrySelect">
<option disabled selected>Load profile...</option>
<option>USA</option>
<option>Germany</option>
<option>France</option>
</select>
<button type="button" onclick="socket.emit(`save_profile`);">Save</button>
<button type="button" onclick="socket.emit(`save_new_profile`);">Save as</button>
</div>
<div class="cm-editor">
<div id="codemirror" class="cm-scroller"></div>
</div>
<div id="stats-table" class="ht-theme-main"></div>
</div>
<button type="button" onclick="socket.emit(`power_on`);">Power on</button>
<button type="button" onclick="socket.emit(`soft_power_off`);">Soft power off</button>
<button type="button" onclick="socket.emit(`hard_power_off`);">Hard power off</button>
<button type="button" onclick="socket.emit(`reboot`);">Reboot</button>
<button type="button" onclick="socket.emit(`reboot_into_bios`);">Reboot into BIOS</button>
<button type="button" onclick="socket.emit(`clear_cmos`);">Clear CMOS</button>
<div id="displayView" class="topic" style="background-color: rgb(36, 30, 30); border: 3px solid rgb(153, 153, 153); width: 300px; height: 188px;">
<div style="padding:20px">
<canvas id="display" width="260" height="140">
Your browser is unfortunately not supported.
</canvas>
<div class="right-third">
<div class="row-flex-container">
<button type="button" onclick="socket.emit(`power_on`);">Power on</button>
<button type="button" onclick="socket.emit(`soft_power_off`);">Soft power off</button>
<button type="button" onclick="socket.emit(`hard_power_off`);">Hard power off</button>
<button type="button" onclick="socket.emit(`reboot`);">Reboot</button>
<button type="button" onclick="socket.emit(`reboot_into_bios`);">Reboot into BIOS</button>
<button type="button" onclick="socket.emit(`clear_cmos`);">Clear CMOS</button>
<button type="button" onclick="socket.emit(`test_route`);">Test Route</button>
</div>
<div id="streamview" class="stream-container">
<img src="/video_feed" class="stream-view" />
</div>
<div class="row-flex-container right-third">
<div id="post-log-container" class="post-log-container"></div>
<div id="displayView" class="topic segment-container">
<div style="padding:20px">
<canvas id="display" width="260" height="140">
Your browser is unfortunately not supported.
</canvas>
</div>
</div>
</div>
</div>
</div>
</body>
</div>
</body>
</html>

View File

@ -0,0 +1,75 @@
import networkx as nx
from networkx import Graph
from typing import Any
from ipkvm import esp32_serial
from ipkvm.util.mkb import ASCII2JS
import time
import tomlkit
# Type checker lunacy!
type MultiDiGraph = Graph[Any]
visited_edges: list[set[str | int]] = []
with open("OC/test_oc_profile.toml") as file:
settings = tomlkit.parse(file.read())
key_delay = 0.1
def traverse_path(graph: MultiDiGraph, node_a: str, node_b: str, visited_edges: list[set[str | int]]):
path = nx.shortest_path(graph, node_a, node_b)
path_edges = list(zip(path[:-1], path[1:]))
edge_path= [(u, v, graph[u][v]) for u, v in path_edges]
for step in edge_path:
if "initial_keypath" in step[2][0] and step[2][0]["visited"] == "false":
keys = step[2][0]["initial_keypath"].split(',')
# Type checker is simply wrong! This is the correct usage!
graph.edges[step[0], step[1], 0]["visited"] = "true" # type: ignore
else:
keys = step[2][0]["keypath"].split(',')
for key in keys:
time.sleep(key_delay)
esp32_serial.ez_press_key(key)
def apply_setting(graph: MultiDiGraph, setting_node: str, new_value: str):
if graph.nodes[setting_node]["option_type"] == "list":
possible_values = graph.nodes[setting_node]["options"].split(',')
key = graph.nodes[setting_node]["traversal_key"]
time.sleep(key_delay)
esp32_serial.ez_press_key("Enter")
for value in possible_values:
time.sleep(key_delay)
if value == new_value:
esp32_serial.ez_press_key("Enter")
break
else:
esp32_serial.ez_press_key(key)
elif graph.nodes[setting_node]["option_type"] == "field":
for key in new_value:
time.sleep(key_delay)
esp32_serial.ez_press_key(ASCII2JS[key])
time.sleep(key_delay)
esp32_serial.ez_press_key("Enter")
print(f"Changed {setting_node} from {graph.nodes[setting_node]["value"]} to {new_value}!")
graph.nodes[setting_node]["value"] = new_value
def test_route():
graph: MultiDiGraph = nx.nx_agraph.read_dot("bios-maps/asrock/b650e-riptide-wifi.gv")
current_node = "Main"
for category in settings:
for setting_node in settings[category]:
if graph.nodes[setting_node]["value"] != settings[category][setting_node]:
traverse_path(graph, current_node, setting_node, visited_edges)
current_node = setting_node
apply_setting(graph, setting_node, settings[category][setting_node])

View File

@ -11,6 +11,280 @@ from collections.abc import Mapping
# python can't use NUMBERS as enum keys?!
PoweredUpCodeDef = {
1: "System is entering S1 sleep state",
2: "System is entering S2 sleep state",
3: "System is entering S3 sleep state",
4: "System is entering S4 sleep state",
5: "System is entering S5 sleep state",
16: "System is waking up from the S1 sleep state",
32: "System is waking up from the S2 sleep state",
48: "System is waking up from the S3 sleep state",
64: "System is waking up from the S4 sleep state",
170: "System has transitioned into ACPI mode. Interrupt controller is in APIC mode",
172: "System has transitioned into ACPI mode. Interrupt controller is in APIC mode",
255: "Indicates a failure has occurred"
}
POSTTextDef = {
0: "Not used",
1: "Power on. Reset type detection (soft/hard)",
2: "AP initialization before microcode loading",
3: "System Agent initialization before microcode loading",
4: "PCH initialization before microcode loading",
5: "OEM initialization before microcode loading",
6: "Microcode loading",
7: "AP initialization after microcode loading",
8: "System Agent initialization after microcode loading",
9: "PCH initialization after microcode loading",
10: "OEM initialization after microcode loading",
11: "Cache initialization",
12: "Reserved for future AMI SEC error codes",
13: "Reserved for future AMI SEC error codes",
14: "Microcode not found",
15: "Microcode not loaded",
16: "PEI Core is started",
17: "Pre-memory CPU initialization is started",
18: "Pre-memory CPU initialization (CPU module specific)",
19: "Pre-memory CPU initialization (CPU module specific)",
20: "Pre-memory CPU initialization (CPU module specific)",
21: "Pre-memory System Agent initialization is started",
22: "Pre-Memory System Agent initialization (System Agent module specific)",
23: "Pre-Memory System Agent initialization (System Agent module specific)",
24: "Pre-Memory System Agent initialization (System Agent module specific)",
25: "Pre-memory PCH initialization is started",
26: "Pre-memory PCH initialization (PCH module specific)",
27: "Pre-memory PCH initialization (PCH module specific)",
28: "Pre-memory PCH initialization (PCH module specific)",
29: "OEM pre-memory initialization codes",
30: "OEM pre-memory initialization codes",
31: "OEM pre-memory initialization codes",
32: "OEM pre-memory initialization codes",
33: "OEM pre-memory initialization codes",
34: "OEM pre-memory initialization codes",
35: "OEM pre-memory initialization codes",
36: "OEM pre-memory initialization codes",
37: "OEM pre-memory initialization codes",
38: "OEM pre-memory initialization codes",
39: "OEM pre-memory initialization codes",
40: "OEM pre-memory initialization codes",
41: "OEM pre-memory initialization codes",
42: "OEM pre-memory initialization codes",
43: "Memory initialization. Serial Presence Detect (SPD) data reading",
44: "Memory initialization. Memory presence detection",
45: "Memory initialization. Programming memory timing information",
46: "Memory initialization. Confi guring memory",
47: "Memory initialization (other)",
48: "Reserved for ASL",
49: "Memory Installed",
50: "CPU post-memory initialization is started",
51: "CPU post-memory initialization. Cache initialization",
52: "CPU post-memory initialization. Application Processor(s) (AP) initialization",
53: "CPU post-memory initialization. Boot Strap Processor (BSP) selection",
54: "CPU post-memory initialization. System Management Mode (SMM) initialization",
55: "Post-Memory System Agent initialization is started",
56: "Post-Memory System Agent initialization (System Agent module specific)",
57: "Post-Memory System Agent initialization (System Agent module specific)",
58: "Post-Memory System Agent initialization (System Agent module specific)",
59: "Post-Memory PCH initialization is started",
60: "Post-Memory PCH initialization (PCH module specific)",
61: "Post-Memory PCH initialization (PCH module specific)",
62: "Post-Memory PCH initialization (PCH module specific)",
63: "OEM post memory initialization codes",
64: "OEM post memory initialization codes",
65: "OEM post memory initialization codes",
66: "OEM post memory initialization codes",
67: "OEM post memory initialization codes",
68: "OEM post memory initialization codes",
69: "OEM post memory initialization codes",
70: "OEM post memory initialization codes",
71: "OEM post memory initialization codes",
72: "OEM post memory initialization codes",
73: "OEM post memory initialization codes",
74: "OEM post memory initialization codes",
75: "OEM post memory initialization codes",
76: "OEM post memory initialization codes",
77: "OEM post memory initialization codes",
78: "OEM post memory initialization codes",
79: "DXE IPL is started",
80: "Memory initialization error. Invalid memory type or incompatible memory speed",
81: "Memory initialization error. SPD reading has failed",
82: "Memory initialization error. Invalid memory size or memory modules do not match",
83: "Memory initialization error. No usable memory detected",
84: "Unspecified memory initialization error",
85: "Memory not installed",
86: "Invalid CPU type or Speed",
87: "CPU mismatch",
88: "CPU self test failed or possible CPU cache error",
89: "CPU micro-code is not found or micro-code update is failed",
90: "Internal CPU error",
91: "reset PPI is not available",
92: "Reserved for future AMI error codes",
93: "Reserved for future AMI error codes",
94: "Reserved for future AMI error codes",
95: "Reserved for future AMI error codes",
96: "DXE Core is started",
97: "NVRAM initialization",
98: "Installation of the PCH Runtime Services",
99: "CPU DXE initialization is started",
100: "CPU DXE initialization (CPU module specific)",
101: "CPU DXE initialization (CPU module specific)",
102: "CPU DXE initialization (CPU module specific)",
103: "CPU DXE initialization (CPU module specific)",
104: "PCI host bridge initialization",
105: "System Agent DXE initialization is started",
106: "System Agent DXE SMM initialization is started",
107: "System Agent DXE initialization (System Agent module specific)",
108: "System Agent DXE initialization (System Agent module specific)",
109: "System Agent DXE initialization (System Agent module specific)",
110: "System Agent DXE initialization (System Agent module specific)",
111: "System Agent DXE initialization (System Agent module specific)",
112: "PCH DXE initialization is started",
113: "PCH DXE SMM initialization is started",
114: "PCH devices initialization",
115: "PCH DXE Initialization (PCH module specific)",
116: "PCH DXE Initialization (PCH module specific)",
117: "PCH DXE Initialization (PCH module specific)",
118: "PCH DXE Initialization (PCH module specific)",
119: "PCH DXE Initialization (PCH module specific)",
120: "ACPI module initialization",
121: "CSM initialization",
122: "Reserved for future AMI DXE codes",
123: "Reserved for future AMI DXE codes",
124: "Reserved for future AMI DXE codes",
125: "Reserved for future AMI DXE codes",
126: "Reserved for future AMI DXE codes",
127: "Reserved for future AMI DXE codes",
128: "OEM DXE initialization codes",
129: "OEM DXE initialization codes",
130: "OEM DXE initialization codes",
131: "OEM DXE initialization codes",
132: "OEM DXE initialization codes",
133: "OEM DXE initialization codes",
134: "OEM DXE initialization codes",
135: "OEM DXE initialization codes",
136: "OEM DXE initialization codes",
137: "OEM DXE initialization codes",
138: "OEM DXE initialization codes",
139: "OEM DXE initialization codes",
140: "OEM DXE initialization codes",
141: "OEM DXE initialization codes",
142: "OEM DXE initialization codes",
143: "OEM DXE initialization codes",
144: "Boot Device Selection (BDS) phase is started",
145: "Driver connecting is started",
146: "PCI Bus initialization is started",
147: "PCI Bus Hot Plug Controller Initialization",
148: "PCI Bus Enumeration 32",
149: "PCI Bus Request Resources",
150: "PCI Bus Assign Resources",
151: "Console Output devices connect",
152: "Console input devices connect",
153: "Super IO Initialization",
154: "USB initialization is started",
155: "USB Reset",
156: "USB Detect",
157: "USB Enable",
158: "Reserved for future AMI codes",
159: "Reserved for future AMI codes",
160: "IDE initialization is started",
161: "IDE Reset",
162: "IDE Detect",
163: "IDE Enable",
164: "SCSI initialization is started",
165: "SCSI Reset",
166: "SCSI Detect",
167: "SCSI Enable",
168: "Setup Verifying Password",
169: "Start of Setup",
170: "Reserved for ASL",
171: "Setup Input Wait",
172: "Reserved for ASL",
173: "Ready To Boot event",
174: "Legacy Boot event",
175: "Exit Boot Services event",
176: "Runtime Set Virtual Address MAP Begin",
177: "Runtime Set Virtual Address MAP End",
178: "Legacy Option ROM Initialization",
179: "System Reset",
180: "USB hot plug",
181: "PCI bus hot plug",
182: "Clean-up of NVRAM",
183: "Confi guration Reset (reset of NVRAM settings)",
184: "Reserved for future AMI codes",
185: "Reserved for future AMI codes",
186: "Reserved for future AMI codes",
187: "Reserved for future AMI codes",
188: "Reserved for future AMI codes",
189: "Reserved for future AMI codes",
190: "Reserved for future AMI codes",
191: "Reserved for future AMI codes",
192: "OEM BDS initialization codes",
193: "OEM BDS initialization codes",
194: "OEM BDS initialization codes",
195: "OEM BDS initialization codes",
196: "OEM BDS initialization codes",
197: "OEM BDS initialization codes",
198: "OEM BDS initialization codes",
199: "OEM BDS initialization codes",
200: "OEM BDS initialization codes",
201: "OEM BDS initialization codes",
202: "OEM BDS initialization codes",
203: "OEM BDS initialization codes",
204: "OEM BDS initialization codes",
205: "OEM BDS initialization codes",
206: "OEM BDS initialization codes",
207: "OEM BDS initialization codes",
208: "CPU initialization error",
209: "System Agent initialization error",
210: "PCH initialization error",
211: "Some of the Architectural Protocols are not available",
212: "PCI resource allocation error. Out of Resources",
213: "No Space for Legacy Option ROM",
214: "No Console Output Devices are found",
215: "No Console Input Devices are found",
216: "Invalid password",
217: "Error loading Boot Option (LoadImage returned error)",
218: "Boot Option is failed (StartImage returned error)",
219: "Flash update is failed",
220: "Reset protocol is not available",
221: "Reserved for future AMI progress codes",
222: "Reserved for future AMI progress codes",
223: "Reserved for future AMI progress codes",
224: "S3 Resume is stared (S3 Resume PPI is called by the DXE IPL)",
225: "S3 Boot Script execution",
226: "Video repost",
227: "OS S3 wake vector call",
228: "Reserved for future AMI progress codes",
229: "Reserved for future AMI progress codes",
230: "Reserved for future AMI progress codes",
231: "Reserved for future AMI progress codes",
232: "S3 Resume Failed",
233: "S3 Resume PPI not Found",
234: "S3 Resume Boot Script Error",
235: "S3 OS Wake Error",
236: "Reserved for future AMI error codes 31",
237: "Reserved for future AMI error codes 31",
238: "Reserved for future AMI error codes 31",
239: "Reserved for future AMI error codes 31",
240: "Recovery condition triggered by firmware (Auto recovery)",
241: "Recovery condition triggered by user (Forced recovery)",
242: "Recovery process started",
243: "Recovery firmware image is found",
244: "Recovery firmware image is loaded",
245: "Reserved for future AMI progress codes",
246: "Reserved for future AMI progress codes",
247: "Reserved for future AMI progress codes",
248: "Recovery PPI is not available",
249: "Recovery capsule is not found",
250: "Invalid recovery capsule",
251: "Reserved for future AMI error codes",
252: "Reserved for future AMI error codes",
253: "Reserved for future AMI error codes",
254: "Reserved for future AMI error codes",
255: "Indicates a failure has occurred"
}
POSTHex7Segment = {
0: "00",
1: "01",
@ -278,6 +552,21 @@ HIDMouseScanCodes = {
4: 16
}
ASCII2JS= {
"1": "Digit1",
"2": "Digit2",
"3": "Digit3",
"4": "Digit4",
"5": "Digit5",
"6": "Digit6",
"7": "Digit7",
"8": "Digit8",
"9": "Digit9",
"0": "Digit0",
".": "Period"
}
class GPIO(IntEnum):
LOW = 0
HIGH = 1
@ -422,8 +711,11 @@ class Esp32Serial(threading.Thread):
self.mkb_queue: Queue[Mapping[str, int | str | Mapping[str, int]]] = Queue()
self.change_serial_device = threading.Event()
self.device = self.get_device()
self.bios_timer = time.time()
self.power_status = None
self._power_status = False
self._last_post_code = "00"
self.notify_code: str
self.active_notification_request = threading.Event()
self.post_code_notify = threading.Event()
self.start()
@ -443,16 +735,18 @@ class Esp32Serial(threading.Thread):
line = json.loads(ser.readline().decode().strip())
if "pwr" in line:
self.power_status = line["pwr"]
self._power_status = line["pwr"]
elif "post_code" in line:
# This code is what presents when you are in BIOS, but also... Other times.
# In another part of the script, we'll check to see if it's hung around for a few
# seconds. If so, we are in BIOS.
if POSTHex7Segment[line["post_code"]] != "Ab":
self.bios_timer = time.time()
self._last_post_code = POSTHex7Segment[line["post_code"]]
ui.emit("update_seven_segment", POSTHex7Segment[line["post_code"]])
ui.emit("update_post_log", f"{POSTTextDef[line["post_code"]]}: {POSTHex7Segment[line["post_code"]]}")
if self.active_notification_request.is_set():
if self._last_post_code == self.notify_code:
self.post_code_notify.set()
self.active_notification_request.clear()
except json.JSONDecodeError:
continue
@ -465,8 +759,29 @@ class Esp32Serial(threading.Thread):
def get_device(self):
if name == "posix":
return serial.Serial(f"/dev/serial/by-id/{profile["esp32_serial"]}", 115200, bytesize=serial.EIGHTBITS,
return serial.Serial(f"/dev/serial/by-id/{profile["server"]["esp32_serial"]}", 115200, bytesize=serial.EIGHTBITS,
parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE)
else:
raise RuntimeError("Your OS is unsupported!")
def ez_press_key(self, key: str):
msg = msg = {
"key_down": HIDKeyCode[key].value
}
self.mkb_queue.put(msg)
msg = msg = {
"key_up": HIDKeyCode[key].value
}
self.mkb_queue.put(msg)
@property
def power_status(self):
return self._power_status
@property
def last_post_code(self):
return self._last_post_code

View File

@ -8,7 +8,6 @@ import av
import av.container
import cv2
from ipkvm import logger
from ipkvm import profile
@dataclasses.dataclass
class VideoDevice:

View File

@ -1,4 +1,5 @@
from ipkvm import app, ui
from ipkvm import app, ui, states
if __name__ == '__main__':
ui.run(app, host='0.0.0.0', port=5000)
#pass

47
webui/state_test.py Normal file
View File

@ -0,0 +1,47 @@
from enum import Enum
from transitions.experimental.utils import with_model_definitions, event, add_transitions, transition
from transitions import Machine
class State(Enum):
A = "A"
B = "B"
C = "C"
class Model:
state: State = State.A
@add_transitions(transition(source=State.B, dest=State.A))
def foo(self): ...
@add_transitions(transition(source=State.C, dest=State.A))
def fod(self): ...
@add_transitions(transition(source=State.A, dest=State.B))
def fud(self): ...
bar = event(
{"source": State.B, "dest": State.A, "conditions": lambda: False},
transition(source=State.B, dest=State.C)
)
@with_model_definitions # don't forget to define your model with this decorator!
class MyMachine(Machine):
pass
model = Model()
machine = MyMachine(model, states=State, initial=model.state)
print(model.state)
model.fud()
print(model.state)
model.bar()
print(model.state)
assert model.state == State.C
model.fod()
print(model.state)
assert model.state == State.A