From 7a3c6c1690e714bfd8d730771c95fe2e928f188d Mon Sep 17 00:00:00 2001 From: BuGu <62454025+Z2Z-GuGu@users.noreply.github.com> Date: Thu, 20 Mar 2025 16:40:33 +0800 Subject: [PATCH] Add production testing version restrictions --- .../sg2002/kvm_system/main/include/config.h | 1 + .../kvm_system/main/lib/oled_ui/oled_ui.cpp | 12 ++++++ .../kvm_system/main/lib/oled_ui/oled_ui.h | 1 + .../main/lib/system_init/system_init.cpp | 41 +++++++++++++++++++ .../main/lib/system_init/system_init.h | 2 +- support/sg2002/kvm_system/main/src/main.cpp | 16 ++++---- 6 files changed, 65 insertions(+), 8 deletions(-) diff --git a/support/sg2002/kvm_system/main/include/config.h b/support/sg2002/kvm_system/main/include/config.h index 0c7d5dc..1944123 100644 --- a/support/sg2002/kvm_system/main/include/config.h +++ b/support/sg2002/kvm_system/main/include/config.h @@ -97,6 +97,7 @@ typedef struct { uint8_t oled_sleep_param = 0; uint8_t oled_sleep_state = 0; // 0:wakeup; 1:sleep; uint64_t oled_sleep_start = 0; + uint64_t ue_patch_state = 0; } kvm_oled_state_t; #endif // CONFIG_H_ diff --git a/support/sg2002/kvm_system/main/lib/oled_ui/oled_ui.cpp b/support/sg2002/kvm_system/main/lib/oled_ui/oled_ui.cpp index 5987d37..115bcf7 100644 --- a/support/sg2002/kvm_system/main/lib/oled_ui/oled_ui.cpp +++ b/support/sg2002/kvm_system/main/lib/oled_ui/oled_ui.cpp @@ -505,3 +505,15 @@ void oled_auto_sleep(void) } } } + +void kvm_show_UE(void) +{ + if(kvm_hw_ver != 2){ + OLED_ShowString(0, 0, "HDMI: UE", 16); + } else { + OLED_Revolve(); + OLED_ShowString(0, 0, "HDMI: UE", 16); + // OLED_ShowString_AlignRight(AlignRightEND_P, 3, " FPS", 4); + // kvm_init_pcie_ui(); + } +} \ No newline at end of file diff --git a/support/sg2002/kvm_system/main/lib/oled_ui/oled_ui.h b/support/sg2002/kvm_system/main/lib/oled_ui/oled_ui.h index 329873e..5b82104 100644 --- a/support/sg2002/kvm_system/main/lib/oled_ui/oled_ui.h +++ b/support/sg2002/kvm_system/main/lib/oled_ui/oled_ui.h @@ -7,5 +7,6 @@ void kvm_main_ui_disp(uint8_t first_disp, uint8_t subpage_changed); void kvm_wifi_config_ui_disp(uint8_t first_disp, uint8_t subpage_changed); void oled_auto_sleep_time_update(void); void oled_auto_sleep(void); +void kvm_show_UE(void); #endif // OLED_UI_H_ \ No newline at end of file diff --git a/support/sg2002/kvm_system/main/lib/system_init/system_init.cpp b/support/sg2002/kvm_system/main/lib/system_init/system_init.cpp index 9b17d51..bcb5c6d 100644 --- a/support/sg2002/kvm_system/main/lib/system_init/system_init.cpp +++ b/support/sg2002/kvm_system/main/lib/system_init/system_init.cpp @@ -7,6 +7,47 @@ using namespace maix::sys; extern kvm_sys_state_t kvm_sys_state; extern kvm_oled_state_t kvm_oled_state; +uint8_t get_hdmi_version() +{ + FILE *fp; + uint8_t RW_Data[2]; + system("/kvmapp/system/init.d/S15kvmhwd get_hdmi_version"); + if(access("/etc/kvm/hdmi_version", F_OK) == 0){ + fp = fopen("/etc/kvm/hdmi_version", "r"); + fread(RW_Data, sizeof(char), 2, fp); + fclose(fp); + if(RW_Data[0] == 'u'){ + // 6911uxc + if(RW_Data[1] == 'e'){ + return 2; + } else if(RW_Data[1] == 'x') { + return 1; + } else { + return 1; + } + } else { + // 6911c + return 0; + } + } else { + return 0; + } +} + +void test_ue_detecte() +{ + if (access("/tmp/S49kvmtest", F_OK) == 0){ + printf("ue patch test\n"); + if(get_hdmi_version() == 2){ + printf("ue_patch_state = 1;\n"); + kvm_oled_state.ue_patch_state = 1; + } else { + printf("ue_patch_state = 0;\n"); + kvm_oled_state.ue_patch_state = 0; + } + } +} + void new_app_init(void) { // Update the necessary scripts diff --git a/support/sg2002/kvm_system/main/lib/system_init/system_init.h b/support/sg2002/kvm_system/main/lib/system_init/system_init.h index 9f84f17..bb9c397 100644 --- a/support/sg2002/kvm_system/main/lib/system_init/system_init.h +++ b/support/sg2002/kvm_system/main/lib/system_init/system_init.h @@ -2,8 +2,8 @@ #define SYSTEM_INIT_H_ #include "config.h" -void init_upadte(void); void new_img_init(void); void new_app_init(void); +void test_ue_detecte(); #endif // SYSTEM_INIT_H_ diff --git a/support/sg2002/kvm_system/main/src/main.cpp b/support/sg2002/kvm_system/main/src/main.cpp index 474b800..0e3145a 100644 --- a/support/sg2002/kvm_system/main/src/main.cpp +++ b/support/sg2002/kvm_system/main/src/main.cpp @@ -7,13 +7,6 @@ using namespace maix::peripheral; kvm_sys_state_t kvm_sys_state; kvm_oled_state_t kvm_oled_state; -/* -init.d: -/etc/init.d/S00kmod -/etc/init.d/S01fs - -*/ - void build_recovery(void) { uint8_t need_recovery = 0; @@ -33,6 +26,13 @@ void* thread_oled_handle(void * arg) OLED_ColorTurn(0); //0正常显示 1 反色显示 OLED_DisplayTurn(0); //0正常显示 1 屏幕翻转显示 OLED_Clear(); + if(kvm_oled_state.ue_patch_state == 1){ + kvm_show_UE(); + while(kvm_sys_state.oled_thread_running){ + time::sleep_ms(100); + } + OLED_Clear(); + } while(kvm_sys_state.oled_thread_running) { @@ -196,6 +196,8 @@ int main(int argc, char* argv[]) new_app_init(); } + test_ue_detecte(); + system("sync"); OLED_state = oled_exist();