增加灵活比较
This commit is contained in:
@@ -42,6 +42,10 @@ namespace WinISP
|
|||||||
private string _chipName = String.Empty;
|
private string _chipName = String.Empty;
|
||||||
private string _u8ChipName = String.Empty;
|
private string _u8ChipName = String.Empty;
|
||||||
private string _u8BoardName = 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 bool _IsRunISP = false;
|
private bool _IsRunISP = false;
|
||||||
ISimI2CCtrl _simI2cCtrl;
|
ISimI2CCtrl _simI2cCtrl;
|
||||||
private bool _IsHDMIConnect = false;
|
private bool _IsHDMIConnect = false;
|
||||||
@@ -51,6 +55,15 @@ namespace WinISP
|
|||||||
private Byte _clientType = 0;
|
private Byte _clientType = 0;
|
||||||
private const int WM_DEVICECHANGE = 0x219;
|
private const int WM_DEVICECHANGE = 0x219;
|
||||||
private const int DBT_DEVNODES_CHANGED = 0x07;
|
private const int DBT_DEVNODES_CHANGED = 0x07;
|
||||||
|
private const byte MStarCommand = 0xCC;
|
||||||
|
private const byte CmdGetModelName = 0x36;
|
||||||
|
private const byte CmdGetChipName = 0x41;
|
||||||
|
private const byte CmdGetPanelName = 0x42;
|
||||||
|
private const byte CmdGetBoardName = 0x45;
|
||||||
|
private const int MonitorModelNameLength = 20;
|
||||||
|
private const int MonitorChipNameLength = 20;
|
||||||
|
private const int MonitorPanelNameLength = 30;
|
||||||
|
private const int MonitorBoardNameLength = 20;
|
||||||
object _lockObj = new object();
|
object _lockObj = new object();
|
||||||
int _numberOfMonitors;
|
int _numberOfMonitors;
|
||||||
int _lastNumOfMonitors = 0;
|
int _lastNumOfMonitors = 0;
|
||||||
@@ -257,30 +270,47 @@ namespace WinISP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断u8ModelName和MODEL_NAME_STRING是否一致
|
private static string NormalizeMonitorInfo(string value)
|
||||||
|
{
|
||||||
|
return String.IsNullOrWhiteSpace(value) ? String.Empty : value.Trim();
|
||||||
|
}
|
||||||
|
|
||||||
private bool IsModelNameMatch(string u8Model_Name)
|
private bool IsModelNameMatch(string u8Model_Name)
|
||||||
{
|
{
|
||||||
const string MODEL_NAME_STRING = "MAG 321UPD E14";
|
string monitorValue = NormalizeMonitorInfo(_monitorModelName);
|
||||||
return string.Equals(MODEL_NAME_STRING, u8Model_Name, StringComparison.Ordinal);
|
if (String.IsNullOrEmpty(monitorValue))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return string.Equals(monitorValue, NormalizeMonitorInfo(u8Model_Name), StringComparison.Ordinal);
|
||||||
}
|
}
|
||||||
private bool IsChipNameMatch(string u8Chi_pName)
|
private bool IsChipNameMatch(string u8Chi_pName)
|
||||||
{
|
{
|
||||||
const string ChipName_STRING = "MST9U";
|
string monitorValue = NormalizeMonitorInfo(_monitorChipName);
|
||||||
return string.Equals(ChipName_STRING, u8Chi_pName, StringComparison.Ordinal);
|
if (String.IsNullOrEmpty(monitorValue))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return string.Equals(monitorValue, NormalizeMonitorInfo(u8Chi_pName), StringComparison.Ordinal);
|
||||||
}
|
}
|
||||||
private bool IsPanelNameMatch(string u8Panel_Name)
|
private bool IsPanelNameMatch(string u8Panel_Name)
|
||||||
{
|
{
|
||||||
const string PanelName_STRING = "Panel_SG315GD01_2_eDP";
|
string monitorValue = NormalizeMonitorInfo(_monitorPanelName);
|
||||||
return string.Equals(PanelName_STRING, u8Panel_Name, StringComparison.Ordinal);
|
if (String.IsNullOrEmpty(monitorValue))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return string.Equals(monitorValue, NormalizeMonitorInfo(u8Panel_Name), StringComparison.Ordinal);
|
||||||
}
|
}
|
||||||
private bool IsBoardNameMatch(string u8Board_Name)
|
private bool IsBoardNameMatch(string u8Board_Name)
|
||||||
{
|
{
|
||||||
const string BoardName_STRING = "FW.010";
|
string monitorValue = NormalizeMonitorInfo(_monitorBoardName);
|
||||||
if (u8Board_Name[0] == 'F' && u8Board_Name[1] == 'W' && u8Board_Name[2] == '.' && u8Board_Name[3] == '0')
|
string binValue = NormalizeMonitorInfo(u8Board_Name);
|
||||||
{
|
|
||||||
return true;
|
if (!String.IsNullOrEmpty(monitorValue))
|
||||||
}
|
return string.Equals(monitorValue, binValue, StringComparison.Ordinal);
|
||||||
|
|
||||||
|
if (binValue.Length < 4)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
return binValue[0] == 'F' && binValue[1] == 'W' && binValue[2] == '.' && binValue[3] == '0';
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnLoadFile_Click(object sender, EventArgs e)
|
private void btnLoadFile_Click(object sender, EventArgs e)
|
||||||
@@ -331,6 +361,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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 芯片名
|
||||||
|
{
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearConnectedMonitorInfo()
|
||||||
|
{
|
||||||
|
_monitorModelName = string.Empty;
|
||||||
|
_monitorChipName = string.Empty;
|
||||||
|
_monitorPanelName = string.Empty;
|
||||||
|
_monitorBoardName = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
void Connect(int delayTime = 0)
|
void Connect(int delayTime = 0)
|
||||||
{
|
{
|
||||||
SetStatusMsg("Connect MTK Monitor...");
|
SetStatusMsg("Connect MTK Monitor...");
|
||||||
@@ -395,12 +488,15 @@ namespace WinISP
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 自动读取显示器信息
|
||||||
|
QueryConnectedMonitorInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsConnect == false)
|
if (IsConnect == false)
|
||||||
{
|
{
|
||||||
frmISP.WriteLog("IsConnect = false", "debug");
|
frmISP.WriteLog("IsConnect = false", "debug");
|
||||||
btnAuto.Enabled = false;
|
btnAuto.Enabled = false;
|
||||||
|
ClearConnectedMonitorInfo();
|
||||||
SetStatusMsg("Current F/W version is not compatible with this tool.", true);
|
SetStatusMsg("Current F/W version is not compatible with this tool.", true);
|
||||||
}
|
}
|
||||||
_chipType = chipType;
|
_chipType = chipType;
|
||||||
@@ -1153,6 +1249,8 @@ namespace WinISP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QueryConnectedMonitorInfo();
|
||||||
|
|
||||||
prbProgress.Maximum = flashSectorInfo.Count;
|
prbProgress.Maximum = flashSectorInfo.Count;
|
||||||
prbProgress.Value = 0;
|
prbProgress.Value = 0;
|
||||||
int imgNum = 0;
|
int imgNum = 0;
|
||||||
|
|||||||
@@ -39,6 +39,10 @@ namespace WinISP
|
|||||||
private string _chipName = String.Empty;
|
private string _chipName = String.Empty;
|
||||||
private string _u8ChipName = String.Empty;
|
private string _u8ChipName = String.Empty;
|
||||||
private string _u8BoardName = 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 bool _IsRunISP = false;
|
private bool _IsRunISP = false;
|
||||||
ISimI2CCtrl _simI2cCtrl;
|
ISimI2CCtrl _simI2cCtrl;
|
||||||
private bool _IsHDMIConnect = false;
|
private bool _IsHDMIConnect = false;
|
||||||
@@ -48,6 +52,15 @@ namespace WinISP
|
|||||||
private Byte _clientType = 0;
|
private Byte _clientType = 0;
|
||||||
private const int WM_DEVICECHANGE = 0x219;
|
private const int WM_DEVICECHANGE = 0x219;
|
||||||
private const int DBT_DEVNODES_CHANGED = 0x07;
|
private const int DBT_DEVNODES_CHANGED = 0x07;
|
||||||
|
private const byte MStarCommand = 0xCC;
|
||||||
|
private const byte CmdGetModelName = 0x36;
|
||||||
|
private const byte CmdGetChipName = 0x41;
|
||||||
|
private const byte CmdGetPanelName = 0x42;
|
||||||
|
private const byte CmdGetBoardName = 0x45;
|
||||||
|
private const int MonitorModelNameLength = 20;
|
||||||
|
private const int MonitorChipNameLength = 20;
|
||||||
|
private const int MonitorPanelNameLength = 30;
|
||||||
|
private const int MonitorBoardNameLength = 20;
|
||||||
object _lockObj = new object();
|
object _lockObj = new object();
|
||||||
int _numberOfMonitors;
|
int _numberOfMonitors;
|
||||||
int _lastNumOfMonitors = 0;
|
int _lastNumOfMonitors = 0;
|
||||||
@@ -243,30 +256,47 @@ namespace WinISP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判断u8ModelName和MODEL_NAME_STRING是否一致
|
private static string NormalizeMonitorInfo(string value)
|
||||||
|
{
|
||||||
|
return String.IsNullOrWhiteSpace(value) ? String.Empty : value.Trim();
|
||||||
|
}
|
||||||
|
|
||||||
private bool IsModelNameMatch(string u8Model_Name)
|
private bool IsModelNameMatch(string u8Model_Name)
|
||||||
{
|
{
|
||||||
const string MODEL_NAME_STRING = "MAG 321UPD E14";
|
string monitorValue = NormalizeMonitorInfo(_monitorModelName);
|
||||||
return string.Equals(MODEL_NAME_STRING, u8Model_Name, StringComparison.Ordinal);
|
if (String.IsNullOrEmpty(monitorValue))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return string.Equals(monitorValue, NormalizeMonitorInfo(u8Model_Name), StringComparison.Ordinal);
|
||||||
}
|
}
|
||||||
private bool IsChipNameMatch(string u8Chi_pName)
|
private bool IsChipNameMatch(string u8Chi_pName)
|
||||||
{
|
{
|
||||||
const string ChipName_STRING = "MST9U";
|
string monitorValue = NormalizeMonitorInfo(_monitorChipName);
|
||||||
return string.Equals(ChipName_STRING, u8Chi_pName, StringComparison.Ordinal);
|
if (String.IsNullOrEmpty(monitorValue))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return string.Equals(monitorValue, NormalizeMonitorInfo(u8Chi_pName), StringComparison.Ordinal);
|
||||||
}
|
}
|
||||||
private bool IsPanelNameMatch(string u8Panel_Name)
|
private bool IsPanelNameMatch(string u8Panel_Name)
|
||||||
{
|
{
|
||||||
const string PanelName_STRING = "Panel_SG315GD01_2_eDP";
|
string monitorValue = NormalizeMonitorInfo(_monitorPanelName);
|
||||||
return string.Equals(PanelName_STRING, u8Panel_Name, StringComparison.Ordinal);
|
if (String.IsNullOrEmpty(monitorValue))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return string.Equals(monitorValue, NormalizeMonitorInfo(u8Panel_Name), StringComparison.Ordinal);
|
||||||
}
|
}
|
||||||
private bool IsBoardNameMatch(string u8Board_Name)
|
private bool IsBoardNameMatch(string u8Board_Name)
|
||||||
{
|
{
|
||||||
const string BoardName_STRING = "FW.010";
|
string monitorValue = NormalizeMonitorInfo(_monitorBoardName);
|
||||||
if (u8Board_Name[0] == 'F' && u8Board_Name[1] == 'W'&& u8Board_Name[2] == '.' && u8Board_Name[3] == '0')
|
string binValue = NormalizeMonitorInfo(u8Board_Name);
|
||||||
{
|
|
||||||
return true;
|
if (!String.IsNullOrEmpty(monitorValue))
|
||||||
}
|
return string.Equals(monitorValue, binValue, StringComparison.Ordinal);
|
||||||
|
|
||||||
|
if (binValue.Length < 4)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
return binValue[0] == 'F' && binValue[1] == 'W' && binValue[2] == '.' && binValue[3] == '0';
|
||||||
}
|
}
|
||||||
private void btnOpenBin_Click(object sender, EventArgs e)
|
private void btnOpenBin_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@@ -320,6 +350,69 @@ namespace WinISP
|
|||||||
WinIOLib._dftI2CDlyTime = Convert.ToInt16(txtDelayUnit.Text);
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 芯片名
|
||||||
|
{
|
||||||
|
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");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ClearConnectedMonitorInfo()
|
||||||
|
{
|
||||||
|
_monitorModelName = string.Empty;
|
||||||
|
_monitorChipName = string.Empty;
|
||||||
|
_monitorPanelName = string.Empty;
|
||||||
|
_monitorBoardName = string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
void Connect(int delayTime = 0)
|
void Connect(int delayTime = 0)
|
||||||
{
|
{
|
||||||
SetStatusMsg("Connect MTK Monitor...");
|
SetStatusMsg("Connect MTK Monitor...");
|
||||||
@@ -397,6 +490,8 @@ namespace WinISP
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 自动读取显示器信息
|
||||||
|
QueryConnectedMonitorInfo();
|
||||||
cboConnectedMonitor.SelectedIndexChanged += cboConnectedMonitor_SelectedIndexChanged;
|
cboConnectedMonitor.SelectedIndexChanged += cboConnectedMonitor_SelectedIndexChanged;
|
||||||
cboConnectedMonitor.Enabled = true;
|
cboConnectedMonitor.Enabled = true;
|
||||||
}
|
}
|
||||||
@@ -407,6 +502,7 @@ namespace WinISP
|
|||||||
cboConnectedMonitor.Enabled = false;
|
cboConnectedMonitor.Enabled = false;
|
||||||
btnRunDPISP.Enabled = false;
|
btnRunDPISP.Enabled = false;
|
||||||
pnlConnState.BackColor = Color.Red;
|
pnlConnState.BackColor = Color.Red;
|
||||||
|
ClearConnectedMonitorInfo();
|
||||||
SetStatusMsg("Current F/W version is not compatible with this tool.", true);
|
SetStatusMsg("Current F/W version is not compatible with this tool.", true);
|
||||||
}
|
}
|
||||||
_chipType = chipType;
|
_chipType = chipType;
|
||||||
@@ -1167,6 +1263,8 @@ namespace WinISP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QueryConnectedMonitorInfo();
|
||||||
|
|
||||||
toolStripProgressBar1.Maximum = flashSectorInfo.Count;
|
toolStripProgressBar1.Maximum = flashSectorInfo.Count;
|
||||||
toolStripProgressBar1.Value = 0;
|
toolStripProgressBar1.Value = 0;
|
||||||
int imgNum = 0;
|
int imgNum = 0;
|
||||||
@@ -1623,11 +1721,13 @@ namespace WinISP
|
|||||||
if (IsConnect == true)
|
if (IsConnect == true)
|
||||||
{
|
{
|
||||||
pnlConnState.BackColor = Color.LightGreen;
|
pnlConnState.BackColor = Color.LightGreen;
|
||||||
|
QueryConnectedMonitorInfo();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pnlConnState.BackColor = Color.Red;
|
pnlConnState.BackColor = Color.Red;
|
||||||
_chipType = 0;
|
_chipType = 0;
|
||||||
|
ClearConnectedMonitorInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
_chipType = chipType;
|
_chipType = chipType;
|
||||||
|
|||||||
Reference in New Issue
Block a user