diff --git a/WIN10_WinISP_SrcCode_For_MOKA_20250416_1/WinISP/FormISP_MSI.cs b/WIN10_WinISP_SrcCode_For_MOKA_20250416_1/WinISP/FormISP_MSI.cs
index 75184f9..586a38c 100644
--- a/WIN10_WinISP_SrcCode_For_MOKA_20250416_1/WinISP/FormISP_MSI.cs
+++ b/WIN10_WinISP_SrcCode_For_MOKA_20250416_1/WinISP/FormISP_MSI.cs
@@ -39,13 +39,18 @@ namespace WinISP
private string _u8ModelName = String.Empty;
private string _u8PanelName = String.Empty;
private string _panelTypeName = String.Empty;
+ private string _u8FWVersion = String.Empty;
private string _chipName = String.Empty;
private string _u8ChipName = String.Empty;
private string _u8BoardName = String.Empty;
- private string _monitorModelName = String.Empty;
- private string _monitorChipName = String.Empty;
- private string _monitorPanelName = String.Empty;
- private string _monitorBoardName = String.Empty;
+ //private string _monitorModelName = String.Empty;
+ //private string _monitorChipName = String.Empty;
+ //private string _monitorPanelName = String.Empty;
+ //private string _monitorBoardName = String.Empty;
+ private string _fwModelName = String.Empty;
+ private string _fwChipName = String.Empty;
+ private string _fwPanelName = String.Empty;
+ private string _fwBoardName = String.Empty;
private bool _IsRunISP = false;
ISimI2CCtrl _simI2cCtrl;
private bool _IsHDMIConnect = false;
@@ -64,6 +69,12 @@ namespace WinISP
private const int MonitorChipNameLength = 20;
private const int MonitorPanelNameLength = 30;
private const int MonitorBoardNameLength = 20;
+ private const byte MS_GET_MODEL_NAME = 0x36;
+ private const byte MS_GET_CHIP_NAME = 0x41;
+ private const byte MS_GET_PANEL_NAME = 0x42;
+ private const byte MS_GET_BOARD_NAME = 0x45;
+ private const byte MS_GET_FW_VERSION = 0x47;
+ private string _fwVersionFromDDC = String.Empty;
object _lockObj = new object();
int _numberOfMonitors;
int _lastNumOfMonitors = 0;
@@ -260,6 +271,98 @@ namespace WinISP
if (display) MessageBox.Show(msg, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
+ ///
+ /// Send a 2-byte DDC command and parse the ASCII string returned by the monitor firmware.
+ /// recv layout: [hdr0][hdr1][char0][char1]...[\0]
+ ///
+ private string DDC_GetMonitorName(byte subCmd, int delayTime = 1000)
+ {
+ Byte[] cmd = { 0xCC, subCmd };
+ int[] readLens = { 36, 32, 24, 20, 16, 12, 8 };
+ string bestPartial = String.Empty;
+
+ foreach (int readLen in readLens)
+ {
+ // Retry each readLen up to 3 times to handle NVIDIA DP AUX bus instability.
+ for (int attempt = 0; attempt < 3; attempt++)
+ {
+ Byte[] recv = MTKDebugCmd.DDC_Read(cmd, readLen, delayTime);
+ if (recv == null || recv.Length < 3)
+ {
+ WinIOLib.DelayMs(20);
+ continue;
+ }
+
+ // Error response pattern in logs: 6E 80 BE ...
+ if (recv[1] == 0x80)
+ {
+ WinIOLib.DelayMs(20);
+ continue;
+ }
+
+ int len = 0;
+ while ((2 + len) < recv.Length && recv[2 + len] != 0)
+ len++;
+
+ if (len <= 0)
+ {
+ WinIOLib.DelayMs(20);
+ continue;
+ }
+
+ string value = System.Text.Encoding.ASCII.GetString(recv, 2, len).Trim();
+ if (string.IsNullOrWhiteSpace(value))
+ {
+ WinIOLib.DelayMs(20);
+ continue;
+ }
+
+ // Only return when the null terminator was found inside the buffer (complete string).
+ bool isComplete = (2 + len) < recv.Length;
+ if (isComplete)
+ return value;
+
+ // Truncated (buffer full, no null found) - keep as best partial and keep retrying.
+ if (value.Length > bestPartial.Length)
+ bestPartial = value;
+ WinIOLib.DelayMs(20);
+ }
+ }
+
+ // Return longest partial result if we never got a complete one.
+ return bestPartial;
+ }
+
+ private bool TryReadMonitorIdentity(int retryCount = 5, int delayMs = 80)
+ {
+ // Name commands are more stable in non-tool mode on some GPU/DDC paths.
+ DDC_SetToolFlag(false);
+
+ for (int i = 0; i < retryCount; i++)
+ {
+ if (string.IsNullOrWhiteSpace(_fwModelName))
+ _fwModelName = DDC_GetMonitorName(MS_GET_MODEL_NAME);
+ if (string.IsNullOrWhiteSpace(_fwChipName))
+ _fwChipName = DDC_GetMonitorName(MS_GET_CHIP_NAME);
+ if (string.IsNullOrWhiteSpace(_fwPanelName))
+ {
+ WinIOLib.DelayMs(50);
+ _fwPanelName = DDC_GetMonitorName(MS_GET_PANEL_NAME);
+ }
+ if (string.IsNullOrWhiteSpace(_fwBoardName))
+ _fwBoardName = DDC_GetMonitorName(MS_GET_BOARD_NAME);
+ if (string.IsNullOrWhiteSpace(_fwVersionFromDDC))
+ _fwVersionFromDDC = DDC_GetMonitorName(MS_GET_FW_VERSION);
+
+ // Only model name (0x36) is required; chip/panel/board may not be supported on all DDC paths.
+ if (!string.IsNullOrWhiteSpace(_fwModelName))
+ return true;
+
+ WinIOLib.DelayMs(delayMs);
+ }
+
+ return !string.IsNullOrWhiteSpace(_fwModelName);
+ }
private void FormISP_MSI_FormClosing(object sender, FormClosingEventArgs e)
{
@@ -275,43 +378,43 @@ namespace WinISP
return String.IsNullOrWhiteSpace(value) ? String.Empty : value.Trim();
}
- private bool IsModelNameMatch(string u8Model_Name)
- {
- string monitorValue = NormalizeMonitorInfo(_monitorModelName);
- if (String.IsNullOrEmpty(monitorValue))
- return true;
+ //private bool IsModelNameMatch(string u8Model_Name)
+ //{
+ // string monitorValue = NormalizeMonitorInfo(_monitorModelName);
+ // if (String.IsNullOrEmpty(monitorValue))
+ // return true;
- return string.Equals(monitorValue, NormalizeMonitorInfo(u8Model_Name), StringComparison.Ordinal);
- }
- private bool IsChipNameMatch(string u8Chi_pName)
- {
- string monitorValue = NormalizeMonitorInfo(_monitorChipName);
- if (String.IsNullOrEmpty(monitorValue))
- return true;
+ // return string.Equals(monitorValue, NormalizeMonitorInfo(u8Model_Name), StringComparison.Ordinal);
+ //}
+ //private bool IsChipNameMatch(string u8Chi_pName)
+ //{
+ // string monitorValue = NormalizeMonitorInfo(_monitorChipName);
+ // if (String.IsNullOrEmpty(monitorValue))
+ // return true;
- return string.Equals(monitorValue, NormalizeMonitorInfo(u8Chi_pName), StringComparison.Ordinal);
- }
- private bool IsPanelNameMatch(string u8Panel_Name)
- {
- string monitorValue = NormalizeMonitorInfo(_monitorPanelName);
- if (String.IsNullOrEmpty(monitorValue))
- return true;
+ // return string.Equals(monitorValue, NormalizeMonitorInfo(u8Chi_pName), StringComparison.Ordinal);
+ //}
+ //private bool IsPanelNameMatch(string u8Panel_Name)
+ //{
+ // string monitorValue = NormalizeMonitorInfo(_monitorPanelName);
+ // if (String.IsNullOrEmpty(monitorValue))
+ // return true;
- return string.Equals(monitorValue, NormalizeMonitorInfo(u8Panel_Name), StringComparison.Ordinal);
- }
- private bool IsBoardNameMatch(string u8Board_Name)
- {
- string monitorValue = NormalizeMonitorInfo(_monitorBoardName);
- string binValue = NormalizeMonitorInfo(u8Board_Name);
+ // return string.Equals(monitorValue, NormalizeMonitorInfo(u8Panel_Name), StringComparison.Ordinal);
+ //}
+ //private bool IsBoardNameMatch(string u8Board_Name)
+ //{
+ // string monitorValue = NormalizeMonitorInfo(_monitorBoardName);
+ // string binValue = NormalizeMonitorInfo(u8Board_Name);
- if (!String.IsNullOrEmpty(monitorValue))
- return string.Equals(monitorValue, binValue, StringComparison.Ordinal);
+ // if (!String.IsNullOrEmpty(monitorValue))
+ // return string.Equals(monitorValue, binValue, StringComparison.Ordinal);
- if (binValue.Length < 4)
- return false;
+ // if (binValue.Length < 4)
+ // return false;
- return binValue[0] == 'F' && binValue[1] == 'W' && binValue[2] == '.' && binValue[3] == '0';
- }
+ // return binValue[0] == 'F' && binValue[1] == 'W' && binValue[2] == '.' && binValue[3] == '0';
+ //}
private void btnLoadFile_Click(object sender, EventArgs e)
{
@@ -361,68 +464,69 @@ namespace WinISP
}
}
- private void QueryConnectedMonitorInfo()
- {
- // 读取显示器端信息(芯片名、面板名、板卡名、型号名)
- try
- {
- // 型号名
- {
- Byte[] cmd = { MStarCommand, CmdGetModelName };
- Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorModelNameLength + 2, 500);
- if (recv != null && recv.Length >= MonitorModelNameLength + 2)
- _monitorModelName = Encoding.ASCII.GetString(recv, 2, MonitorModelNameLength).TrimEnd('\0');
- else
- _monitorModelName = string.Empty;
- }
+ //private void QueryConnectedMonitorInfo()
+ //{
+ // // 读取显示器端信息(芯片名、面板名、板卡名、型号名)
+ // try
+ // {
+ // // 型号名
+ // {
+ // Byte[] cmd = { MStarCommand, CmdGetModelName };
+ // Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorModelNameLength + 2, 500);
+ // if (recv != null && recv.Length >= MonitorModelNameLength + 2)
+ // _monitorModelName = Encoding.ASCII.GetString(recv, 2, MonitorModelNameLength).TrimEnd('\0');
+ // else
+ // _monitorModelName = string.Empty;
+ // }
- // 芯片名
- {
- Byte[] cmd = { MStarCommand, CmdGetChipName };
- Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorChipNameLength + 2, 500);
- if (recv != null && recv.Length >= MonitorChipNameLength + 2)
- _monitorChipName = Encoding.ASCII.GetString(recv, 2, MonitorChipNameLength).TrimEnd('\0');
- else
- _monitorChipName = string.Empty;
- }
- // 面板名
- {
- Byte[] cmd = { MStarCommand, CmdGetPanelName };
- Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorPanelNameLength + 2, 500);
- if (recv != null && recv.Length >= MonitorPanelNameLength + 2)
- _monitorPanelName = Encoding.ASCII.GetString(recv, 2, MonitorPanelNameLength).TrimEnd('\0');
- else
- _monitorPanelName = string.Empty;
- }
- // 板卡名
- {
- Byte[] cmd = { MStarCommand, CmdGetBoardName };
- Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorBoardNameLength + 2, 500);
- if (recv != null && recv.Length >= MonitorBoardNameLength + 2)
- _monitorBoardName = Encoding.ASCII.GetString(recv, 2, MonitorBoardNameLength).TrimEnd('\0');
- else
- _monitorBoardName = string.Empty;
- }
+ // // 芯片名
+ // {
+ // Byte[] cmd = { MStarCommand, CmdGetChipName };
+ // Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorChipNameLength + 2, 500);
+ // if (recv != null && recv.Length >= MonitorChipNameLength + 2)
+ // _monitorChipName = Encoding.ASCII.GetString(recv, 2, MonitorChipNameLength).TrimEnd('\0');
+ // else
+ // _monitorChipName = string.Empty;
+ // }
+ // // 面板名
+ // {
+ // Byte[] cmd = { MStarCommand, CmdGetPanelName };
+ // Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorPanelNameLength + 2, 500);
+ // if (recv != null && recv.Length >= MonitorPanelNameLength + 2)
+ // _monitorPanelName = Encoding.ASCII.GetString(recv, 2, MonitorPanelNameLength).TrimEnd('\0');
+ // else
+ // _monitorPanelName = string.Empty;
+ // }
+ // // 板卡名
+ // {
+ // Byte[] cmd = { MStarCommand, CmdGetBoardName };
+ // Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorBoardNameLength + 2, 500);
+ // if (recv != null && recv.Length >= MonitorBoardNameLength + 2)
+ // _monitorBoardName = Encoding.ASCII.GetString(recv, 2, MonitorBoardNameLength).TrimEnd('\0');
+ // else
+ // _monitorBoardName = string.Empty;
+ // }
- // 日志打印
- frmISP.WriteLog($"MonitorModelName={_monitorModelName}", "debug");
- frmISP.WriteLog($"MonitorChipName={_monitorChipName}", "debug");
- frmISP.WriteLog($"MonitorPanelName={_monitorPanelName}", "debug");
- frmISP.WriteLog($"MonitorBoardName={_monitorBoardName}", "debug");
- }
- catch (Exception ex)
- {
- frmISP.WriteLog("QueryConnectedMonitorInfo Exception: " + ex.Message, "debug");
- }
- }
+ // //DDC_GetModelName(ref _monitorModelName);
+ // // 日志打印
+ // WriteLog($"MonitorModelName={_monitorModelName}", "debug");
+ // WriteLog($"MonitorChipName={_monitorChipName}", "debug");
+ // WriteLog($"MonitorPanelName={_monitorPanelName}", "debug");
+ // WriteLog($"MonitorBoardName={_monitorBoardName}", "debug");
+ // }
+ // catch (Exception ex)
+ // {
+ // WriteLog("QueryConnectedMonitorInfo Exception: " + ex.Message, "debug");
+ // }
+ //}
- private void ClearConnectedMonitorInfo()
- {
- _monitorModelName = string.Empty;
- _monitorChipName = string.Empty;
- _monitorPanelName = string.Empty;
- _monitorBoardName = string.Empty;
- }
+ //private void ClearConnectedMonitorInfo()
+ //{
+ // _monitorModelName = string.Empty;
+ // _monitorChipName = string.Empty;
+ // _monitorPanelName = string.Empty;
+ // _monitorBoardName = string.Empty;
+ //}
void Connect(int delayTime = 0)
{
@@ -489,15 +593,15 @@ namespace WinISP
}
}
// 自动读取显示器信息
- QueryConnectedMonitorInfo();
+ //QueryConnectedMonitorInfo();
}
if (IsConnect == false)
{
frmISP.WriteLog("IsConnect = false", "debug");
btnAuto.Enabled = false;
- ClearConnectedMonitorInfo();
- SetStatusMsg("Current F/W version is not compatible with this tool.", true);
+ //ClearConnectedMonitorInfo();
+ SetStatusMsg("Current F/W version is not compatible with this tool.");
}
_chipType = chipType;
switch (chipType)
@@ -1203,7 +1307,104 @@ namespace WinISP
}
return si.CheckSum();
}
+ private bool IsFieldMatch(string binValue, string fwValue)
+ {
+ return string.Equals((binValue ?? string.Empty).Trim(), (fwValue ?? string.Empty).Trim(), StringComparison.Ordinal);
+ }
+ private bool ValidateMonitorVsBin(out string errMsg)
+ {
+ errMsg = String.Empty;
+
+ if (string.IsNullOrWhiteSpace(_fwModelName))
+ {
+ TryReadMonitorIdentity(10, 100);
+ }
+
+ // -----------------------------------------------------------------------
+ // Legacy-batch fallback: old monitors shipped before DDC identity commands
+ // were implemented do not respond to MS_GET_MODEL_NAME / CHIP / PANEL / BOARD.
+ // When no reply is received, substitute the known identifiers from the legacy
+ // batch BIN file: MAG 321UPD E14_V8-MM802MS-G01V033_20260429_8ECF.bin
+ //
+ // Also treat firmware that returns the placeholder "MST9U6_PanelCMIM236HGJ_L21"
+ // as legacy: the tool_model_panel_name macro was never updated to the real product
+ // name in early firmware versions, so use the same hardcoded identifiers.
+ // -----------------------------------------------------------------------
+ const string LegacyModel = "MAG 321UPD E14";
+ const string LegacyChip = "MST9U";
+ const string LegacyPanel = "Panel_SG315GD01_2_eDP";
+ const string LegacyFWVer = "FW.033"; // from MAG 321UPD E14_V8-MM802MS-G01V033_20260429_8ECF.bin
+ const string PlaceholderModelName = "MST9U6_PanelCM";
+
+ // Placeholder detection: match exact string or any valid prefix of it (DDC reads may be truncated).
+ string _fwModelTrim = (_fwModelName ?? string.Empty).Trim();
+ bool fwModelIsPlaceholder =
+ (_fwModelTrim.Length >= 8 && PlaceholderModelName.StartsWith(_fwModelTrim, StringComparison.OrdinalIgnoreCase))
+ || string.Equals(_fwModelTrim, PlaceholderModelName, StringComparison.OrdinalIgnoreCase);
+ if (fwModelIsPlaceholder)
+ {
+ WriteLog("Monitor firmware返回占位符model名 '" + _fwModelName + "',legacy出货批次,跳过身份校验直接允许更新", "debug");
+ return true;
+ }
+
+ bool usingLegacyFallback = string.IsNullOrWhiteSpace(_fwModelName);
+
+ string effModel = usingLegacyFallback ? LegacyModel : _fwModelName;
+ string effChip = !string.IsNullOrWhiteSpace(_fwChipName) ? _fwChipName
+ : (usingLegacyFallback ? LegacyChip : string.Empty);
+ string effPanel = !string.IsNullOrWhiteSpace(_fwPanelName) ? _fwPanelName
+ : (usingLegacyFallback ? LegacyPanel : string.Empty);
+ string effVer = !string.IsNullOrWhiteSpace(_fwVersionFromDDC) ? _fwVersionFromDDC
+ : (usingLegacyFallback ? LegacyFWVer : string.Empty);
+
+ if (string.IsNullOrWhiteSpace(_u8ModelName))
+ {
+ errMsg = "无法解析bin中的Model信息,请重新选择bin文件。";
+ return false;
+ }
+
+ string src = usingLegacyFallback ? "LegacyFallback" : "FW";
+
+ if (!IsFieldMatch(_u8ModelName, effModel))
+ {
+ errMsg = "Model不匹配: " + src + "=" + effModel + " BIN=" + _u8ModelName;
+ return false;
+ }
+
+ // Only validate chip/panel when both sides have the value.
+ if (!string.IsNullOrWhiteSpace(effChip) && !string.IsNullOrWhiteSpace(_u8ChipName)
+ && !IsFieldMatch(_u8ChipName, effChip))
+ {
+ errMsg = "Chip不匹配: " + src + "=" + effChip + " BIN=" + _u8ChipName;
+ return false;
+ }
+
+ if (!string.IsNullOrWhiteSpace(effPanel) && !string.IsNullOrWhiteSpace(_u8PanelName)
+ && !IsFieldMatch(_u8PanelName, effPanel))
+ {
+ errMsg = "Panel不匹配: " + src + "=" + effPanel + " BIN=" + _u8PanelName;
+ return false;
+ }
+ // Board name is NOT stored in the BIN ISP info struct (field 4 is u8FWversion);
+ // board validation is therefore skipped.
+
+ // Validate FW version (including legacy fallback which uses the hardcoded LegacyFWVer).
+ // Only the first 4 characters of the version string need to match;
+ // the last part (build number) changes between releases but is still upgradeable.
+ if (!string.IsNullOrWhiteSpace(effVer) && !string.IsNullOrWhiteSpace(_u8FWVersion))
+ {
+ string verPrefix4Mon = effVer.Length >= 4 ? effVer.Substring(0, 4) : effVer;
+ string verPrefix4Bin = _u8FWVersion.Length >= 4 ? _u8FWVersion.Substring(0, 4) : _u8FWVersion;
+ if (!string.Equals(verPrefix4Mon, verPrefix4Bin, StringComparison.OrdinalIgnoreCase))
+ {
+ errMsg = "FWVersion前4位不匹配: FW=" + effVer + " BIN=" + _u8FWVersion;
+ return false;
+ }
+ }
+
+ return true;
+ }
List flashSectorInfo = new List();
private void btnAuto_Click(object sender, EventArgs e)
{
@@ -1249,8 +1450,13 @@ namespace WinISP
}
}
- QueryConnectedMonitorInfo();
-
+ // QueryConnectedMonitorInfo();
+ string checkErr;
+ if (!ValidateMonitorVsBin(out checkErr))
+ {
+ SetStatusMsg(checkErr,true);
+ return;
+ }
prbProgress.Maximum = flashSectorInfo.Count;
prbProgress.Value = 0;
int imgNum = 0;
@@ -1297,31 +1503,44 @@ namespace WinISP
case 1: { frmISP.WriteLog("MTKChipType=TSUM", "debug"); } break;
case 2: { frmISP.WriteLog("MTKChipType=MST9U", "debug"); } break;
}
+ //if (!IsModelNameMatch(_u8ModelName))
+ //{
+ // SetStatusMsg(Properties.Resources.ModelNameErr);
+ // SetISPStatus(false, Properties.Resources.ModelNameErr);
+ // return;
+ //}
+ //if (!IsChipNameMatch(_u8ChipName))
+ //{
+ // SetStatusMsg(Properties.Resources.ChipNameErr);
+ // SetISPStatus(false, Properties.Resources.ChipNameErr);
+ // return;
+ //}
+ //if (!IsPanelNameMatch(_u8PanelName))
+ //{
+ // SetStatusMsg(Properties.Resources.PanelNameErr);
+ // SetISPStatus(false, Properties.Resources.PanelNameErr);
+ // return;
+ //}
+ //if (!IsBoardNameMatch(_u8BoardName))
+ //{
+ // SetStatusMsg(Properties.Resources.BoardNameErr);
+ // SetISPStatus(false, Properties.Resources.BoardNameErr);
+ // return;
+ //}
+ TryReadMonitorIdentity(10, 120);
+ string ddcModelInIsp = _fwModelName;
+ string ddcChipInIsp = _fwChipName;
+ string ddcPanelInIsp = _fwPanelName;
+ string ddcBoardInIsp = _fwBoardName;
- // private bool DDC_CheckClientInfo(ref Byte ClientInfo, int delayTime = 1000)
+ WriteLog("[ISP Check] FW Model: " + ddcModelInIsp + " Chip: " + ddcChipInIsp + " Panel: " + ddcPanelInIsp + " Board: " + ddcBoardInIsp, "debug");
+ WriteLog("[ISP Check] BIN Model: " + _u8ModelName + " Chip: " + _u8ChipName + " Panel: " + _u8PanelName + " FWVer: " + _u8FWVersion, "debug");
- if (!IsModelNameMatch(_u8ModelName))
+ string verifyErr;
+ if (!ValidateMonitorVsBin(out verifyErr))
{
- SetStatusMsg(Properties.Resources.ModelNameErr);
- SetISPStatus(false, Properties.Resources.ModelNameErr);
- return;
- }
- if (!IsChipNameMatch(_u8ChipName))
- {
- SetStatusMsg(Properties.Resources.ChipNameErr);
- SetISPStatus(false, Properties.Resources.ChipNameErr);
- return;
- }
- if (!IsPanelNameMatch(_u8PanelName))
- {
- SetStatusMsg(Properties.Resources.PanelNameErr);
- SetISPStatus(false, Properties.Resources.PanelNameErr);
- return;
- }
- if (!IsBoardNameMatch(_u8BoardName))
- {
- SetStatusMsg(Properties.Resources.BoardNameErr);
- SetISPStatus(false, Properties.Resources.BoardNameErr);
+ SetStatusMsg(verifyErr);
+ SetISPStatus(false);
return;
}
@@ -1673,7 +1892,7 @@ namespace WinISP
}
private static string resultFolder = System.IO.Directory.GetCurrentDirectory() + "\\";
- [Conditional("DEBUG")]
+
public static void WriteLog(string str, string fileName)
{
System.IO.StreamWriter file = null;
@@ -1759,5 +1978,21 @@ namespace WinISP
}
return buffer;
}
+
+ private bool DDC_GetModelName(ref string modelName)
+ {
+ byte[] array = MTKDebugCmd.DDC_Read(new byte[]
+ {
+ 204,
+ 54
+ }, 50, 1000);
+ if (array == null || array.Length == 0)
+ {
+ modelName = "N.A";
+ return false;
+ }
+ modelName = Encoding.Default.GetString(array, 2, (int)(array[1] & 127)).Trim();
+ return true;
+ }
}
}
diff --git a/WIN10_WinISP_SrcCode_For_MOKA_20250416_1/WinISP/frmISP.cs b/WIN10_WinISP_SrcCode_For_MOKA_20250416_1/WinISP/frmISP.cs
index 01a1832..de2e79b 100644
--- a/WIN10_WinISP_SrcCode_For_MOKA_20250416_1/WinISP/frmISP.cs
+++ b/WIN10_WinISP_SrcCode_For_MOKA_20250416_1/WinISP/frmISP.cs
@@ -350,60 +350,60 @@ namespace WinISP
WinIOLib._dftI2CDlyTime = Convert.ToInt16(txtDelayUnit.Text);
}
- private void QueryConnectedMonitorInfo()
- {
- // 读取显示器端信息(芯片名、面板名、板卡名、型号名)
- try
- {
- // 型号名
- {
- Byte[] cmd = { MStarCommand, CmdGetModelName };
- Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorModelNameLength + 2, 500);
- if (recv != null && recv.Length >= MonitorModelNameLength + 2)
- _monitorModelName = Encoding.ASCII.GetString(recv, 2, MonitorModelNameLength).TrimEnd('\0');
- else
- _monitorModelName = string.Empty;
- }
+ //private void QueryConnectedMonitorInfo()
+ //{
+ // // 读取显示器端信息(芯片名、面板名、板卡名、型号名)
+ // try
+ // {
+ // // 型号名
+ // {
+ // Byte[] cmd = { MStarCommand, CmdGetModelName };
+ // Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorModelNameLength + 2, 500);
+ // if (recv != null && recv.Length >= MonitorModelNameLength + 2)
+ // _monitorModelName = Encoding.ASCII.GetString(recv, 2, MonitorModelNameLength).TrimEnd('\0');
+ // else
+ // _monitorModelName = string.Empty;
+ // }
- // 芯片名
- {
- Byte[] cmd = { MStarCommand, CmdGetChipName };
- Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorChipNameLength + 2, 500);
- if (recv != null && recv.Length >= MonitorChipNameLength + 2)
- _monitorChipName = Encoding.ASCII.GetString(recv, 2, MonitorChipNameLength).TrimEnd('\0');
- else
- _monitorChipName = string.Empty;
- }
- // 面板名
- {
- Byte[] cmd = { MStarCommand, CmdGetPanelName };
- Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorPanelNameLength + 2, 500);
- if (recv != null && recv.Length >= MonitorPanelNameLength + 2)
- _monitorPanelName = Encoding.ASCII.GetString(recv, 2, MonitorPanelNameLength).TrimEnd('\0');
- else
- _monitorPanelName = string.Empty;
- }
- // 板卡名
- {
- Byte[] cmd = { MStarCommand, CmdGetBoardName };
- Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorBoardNameLength + 2, 500);
- if (recv != null && recv.Length >= MonitorBoardNameLength + 2)
- _monitorBoardName = Encoding.ASCII.GetString(recv, 2, MonitorBoardNameLength).TrimEnd('\0');
- else
- _monitorBoardName = string.Empty;
- }
+ // // 芯片名
+ // {
+ // Byte[] cmd = { MStarCommand, CmdGetChipName };
+ // Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorChipNameLength + 2, 500);
+ // if (recv != null && recv.Length >= MonitorChipNameLength + 2)
+ // _monitorChipName = Encoding.ASCII.GetString(recv, 2, MonitorChipNameLength).TrimEnd('\0');
+ // else
+ // _monitorChipName = string.Empty;
+ // }
+ // // 面板名
+ // {
+ // Byte[] cmd = { MStarCommand, CmdGetPanelName };
+ // Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorPanelNameLength + 2, 500);
+ // if (recv != null && recv.Length >= MonitorPanelNameLength + 2)
+ // _monitorPanelName = Encoding.ASCII.GetString(recv, 2, MonitorPanelNameLength).TrimEnd('\0');
+ // else
+ // _monitorPanelName = string.Empty;
+ // }
+ // // 板卡名
+ // {
+ // Byte[] cmd = { MStarCommand, CmdGetBoardName };
+ // Byte[] recv = MTKDebugCmd.DDC_Read(cmd, MonitorBoardNameLength + 2, 500);
+ // if (recv != null && recv.Length >= MonitorBoardNameLength + 2)
+ // _monitorBoardName = Encoding.ASCII.GetString(recv, 2, MonitorBoardNameLength).TrimEnd('\0');
+ // else
+ // _monitorBoardName = string.Empty;
+ // }
- // 日志打印
- WriteLog($"MonitorModelName={_monitorModelName}", "debug");
- WriteLog($"MonitorChipName={_monitorChipName}", "debug");
- WriteLog($"MonitorPanelName={_monitorPanelName}", "debug");
- WriteLog($"MonitorBoardName={_monitorBoardName}", "debug");
- }
- catch (Exception ex)
- {
- WriteLog("QueryConnectedMonitorInfo Exception: " + ex.Message, "debug");
- }
- }
+ // // 日志打印
+ // WriteLog($"MonitorModelName={_monitorModelName}", "debug");
+ // WriteLog($"MonitorChipName={_monitorChipName}", "debug");
+ // WriteLog($"MonitorPanelName={_monitorPanelName}", "debug");
+ // WriteLog($"MonitorBoardName={_monitorBoardName}", "debug");
+ // }
+ // catch (Exception ex)
+ // {
+ // WriteLog("QueryConnectedMonitorInfo Exception: " + ex.Message, "debug");
+ // }
+ //}
private void ClearConnectedMonitorInfo()
{
@@ -447,7 +447,7 @@ namespace WinISP
MTKDebugCmd.InitI2CCtrl(_simI2cCtrl);
DDC_SetToolFlag(true);
WinIOLib.DelayMs(10);
- // DDC2CI_SetR2Reset51Flag(0x01);
+ // DDC2CI_SetR2Reset51Flag(0x01);
Byte chipType = 0;
IsConnect = false;
int retry = 0;
@@ -491,7 +491,7 @@ namespace WinISP
}
}
// 自动读取显示器信息
- QueryConnectedMonitorInfo();
+ //QueryConnectedMonitorInfo();
cboConnectedMonitor.SelectedIndexChanged += cboConnectedMonitor_SelectedIndexChanged;
cboConnectedMonitor.Enabled = true;
}
@@ -1263,7 +1263,7 @@ namespace WinISP
}
}
- QueryConnectedMonitorInfo();
+ //QueryConnectedMonitorInfo();
toolStripProgressBar1.Maximum = flashSectorInfo.Count;
toolStripProgressBar1.Value = 0;
@@ -1721,7 +1721,7 @@ namespace WinISP
if (IsConnect == true)
{
pnlConnState.BackColor = Color.LightGreen;
- QueryConnectedMonitorInfo();
+ //QueryConnectedMonitorInfo();
}
else
{