From 6042411a012e63f41756549fff184e5ddca45a8c Mon Sep 17 00:00:00 2001 From: chenjiangqun Date: Tue, 30 Jun 2026 18:56:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=8C=87=E4=BB=A4=E6=89=93?= =?UTF-8?q?=E5=8D=B0=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WinISP/BaseClass/GraphicCardI2CCtrl.cs | 29 +++++++++---------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/WIN10_WinISP_SrcCode_For_MOKA_20250416_1/WinISP/BaseClass/GraphicCardI2CCtrl.cs b/WIN10_WinISP_SrcCode_For_MOKA_20250416_1/WinISP/BaseClass/GraphicCardI2CCtrl.cs index 8f18f6f..6ea107e 100644 --- a/WIN10_WinISP_SrcCode_For_MOKA_20250416_1/WinISP/BaseClass/GraphicCardI2CCtrl.cs +++ b/WIN10_WinISP_SrcCode_For_MOKA_20250416_1/WinISP/BaseClass/GraphicCardI2CCtrl.cs @@ -248,33 +248,30 @@ namespace WinISP.BaseClass { throw new NotImplementedException(); } - + public bool WriteData(byte[] data) { Byte slvAddr = data[0]; Byte[] wrBuf = new Byte[data.Length - 1]; Array.Copy(data, 1, wrBuf, 0, wrBuf.Length); - const Byte maxWrLen = 16; - int idx = 0; - unsafe - { - fixed (Byte* pArr = wrBuf) - { - return DDCWrite(pGraphicCardCtrl, slvAddr, (uint)(wrBuf.Length), wrBuf); - } - } + + bool ret = DDCWrite(pGraphicCardCtrl, slvAddr, (uint)wrBuf.Length, wrBuf); + frmISP.WriteLog($"[DDCWrite] card={GraphicCardType} slv=0x{slvAddr:X2} len={wrBuf.Length} ret={ret}", ret ? "debug" : "error"); + return ret; } public bool ReadData(byte[] data, byte[] wrCmds = null) { - uint revlen = (uint)data.Length; - unsafe + if (wrCmds == null || wrCmds.Length == 0) { - fixed (Byte* pArr = data) - { - return DDCRead(pGraphicCardCtrl, wrCmds[0], revlen, data); - } + frmISP.WriteLog($"[DDCRead] card={GraphicCardType} wrCmds is NULL/empty!", "error"); + return false; } + uint revlen = (uint)data.Length; + bool ret = DDCRead(pGraphicCardCtrl, wrCmds[0], revlen, data); + frmISP.WriteLog($"[DDCRead] card={GraphicCardType} slv=0x{wrCmds[0]:X2} rdLen={revlen} ret={ret} " + + $"first4={(data.Length >= 4 ? BitConverter.ToString(data, 0, 4) : "n/a")}", ret ? "debug" : "error"); + return ret; } public bool Init()