AnsweredAssumed Answered

Beginner Question: How to read EDID with ADL

Question asked by syncro on Jan 25, 2012
Latest reply on Feb 18, 2014 by thesunnycrow

Hi,

 

i am c# beginner and also have no experience with ADL, so i hope this question is not too silly.

 

I tried to extend the ADL C# Sample ( Sample-Managed ) with the ADL Function ADL_Display_EdidData_Get. Therefore I also  implemented ADLDisplayEDIDData struct, which is in the ADL.cs and looks like:

 

[StructLayout(LayoutKind.Sequential)]

    internal struct ADLDisplayEDIDData

    {

        internal int Size;

        internal int Flag;

        internal int EDIDSize;

        internal int BlockIndex;

        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = (int)ADL.ADL_MAX_PATH)]

        internal string EDIDData;

        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]

        internal int[] Reserved;

    }

 

In Program.cs i tried this:

 

if(null != ADL.ADL_Display_EdidData_Get){  

 

    ADLDisplayEDIDData EDIDData = new ADLDisplayEDIDData();

   

    IntPtr EDIDBuffer = IntPtr.Zero;

    int sizee = Marshal.SizeOf(EDIDData);

    EDIDBuffer = Marshal.AllocCoTaskMem((int)sizee);

    Marshal.StructureToPtr(EDIDData, EDIDBuffer, false);

      

    ADLRet = ADL.ADL_Display_EdidData_Get(0, 5, ref EDIDBuffer);

   

    Console.WriteLine("ADLRet: "+ADLRet);

    if (ADL.ADL_SUCCESS == ADLRet)

    {

        Console.WriteLine("success");

    }

    else

    {

        Console.WriteLine("no success");

    }

}

 

ADLRet is always -3, which means:

 

#define ADL_ERR_INVALID_PARAM   -3
One of the parameter passed is invalid. 

 

so i guess either the green part is wrong or something in the ADLDisplayEDIDData struct is incorrect. I append the visual studio 2010 project to this post. Would be very nice, if one can help me out.

Attachments

Outcomes