Merge branch 'development'
authorLars Op den Kamp <lars@opdenkamp.eu>
Mon, 11 Jun 2012 13:30:12 +0000 (15:30 +0200)
committerLars Op den Kamp <lars@opdenkamp.eu>
Mon, 11 Jun 2012 13:30:12 +0000 (15:30 +0200)
56 files changed:
ChangeLog
README
configure.ac
debian/changelog
debian/source/format
debian/source/format.hardy [deleted file]
include/cec.h
include/cecloader.h
include/cectypes.h
project/cec-config.rc
project/libcec.rc
project/libcec.vcxproj
project/libcec.vcxproj.filters
project/testclient.rc
src/CecSharpTester/Properties/AssemblyInfo.cs
src/LibCecSharp/AssemblyInfo.cpp
src/LibCecSharp/CecSharpTypes.h
src/LibCecSharp/LibCecSharp.cpp
src/cec-config-gui/CecConfigGUI.cs
src/cec-config-gui/Properties/AssemblyInfo.cs
src/lib/CECClient.cpp
src/lib/CECClient.h
src/lib/CECProcessor.cpp
src/lib/CECProcessor.h
src/lib/CECTypeUtils.h [new file with mode: 0644]
src/lib/LibCEC.cpp
src/lib/Makefile.am
src/lib/adapter/USBCECAdapterCommands.cpp
src/lib/adapter/USBCECAdapterCommands.h
src/lib/adapter/USBCECAdapterCommunication.cpp
src/lib/adapter/USBCECAdapterCommunication.h
src/lib/adapter/USBCECAdapterMessageQueue.cpp
src/lib/devices/CECAudioSystem.cpp
src/lib/devices/CECBusDevice.cpp
src/lib/devices/CECPlaybackDevice.cpp
src/lib/implementations/CECCommandHandler.cpp
src/lib/implementations/CECCommandHandler.h
src/lib/implementations/RLCommandHandler.cpp
src/lib/implementations/SLCommandHandler.cpp
src/lib/implementations/VLCommandHandler.cpp
src/lib/implementations/VLCommandHandler.h
src/lib/platform/adl/adl-edid.cpp [new file with mode: 0644]
src/lib/platform/adl/adl-edid.h [new file with mode: 0644]
src/lib/platform/adl/adl_defines.h [new file with mode: 0644]
src/lib/platform/adl/adl_sdk.h [new file with mode: 0644]
src/lib/platform/adl/adl_structures.h [new file with mode: 0644]
src/lib/platform/nvidia/nv-edid.cpp [new file with mode: 0644]
src/lib/platform/nvidia/nv-edid.h [new file with mode: 0644]
src/lib/platform/posix/os-edid.cpp [new file with mode: 0644]
src/lib/platform/posix/serversocket.cpp [new file with mode: 0644]
src/lib/platform/sockets/serversocket.h [new file with mode: 0644]
src/lib/platform/sockets/tcp.h
src/lib/platform/util/edid.h [new file with mode: 0644]
src/lib/platform/util/util.h [new file with mode: 0644]
src/lib/platform/windows/os-edid.cpp [new file with mode: 0644]
src/testclient/main.cpp

index c227eda49377f829a7b8e037dc419f2068c6660d..3d69d4f3cd1d3f0b7f2075574dfe411cb8dbde92 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,47 @@
+libcec (1.7.1-1) unstable; urgency=low
+
+  * changed/added:
+    * added physical address detection via ADL for AMD graphics cards
+    * attempt to get the edid from nvidia's graphics card driver on linux via
+      /proc/acpi/video/NGFX/HDMI/EDID
+    * attempt to get the PA from the registry on windows if we fail to get the
+      physical address from the display driver
+    * changed the order in CCECClient::SetPhysicalAddress() so it first checks
+      whether a PA override is set in libcec_configuration.iPhysicalAddress,
+      then checks whether the address can be detected, and if both failed it'll
+      use the HDMI port + base device setting
+    * cec-client: only active the source when reconnecting if libcec was the
+      active source before closing the connection
+    * platform: added tcp server sockets for posix
+
+  * interface changes:
+    * libcec_configuration.bAutodetectAddress is now read-only, and will be set
+      to 1 by libCEC if the PA was autodetected
+    * LibCecSharp: don't use an int but a CecUserControlCode in a CecKeypress
+
+  * fixed:
+    * don't unregister clients in CLibCEC when disconnecting, but only in
+      CCECProcessor. fixes reconnect after close
+    * MSGCODE_TIMEOUT_ERROR is a response to a transmission
+    * retry 'activate source' every 10 seconds if it failed
+    * don't respond with a poll from the broadcast address when receiving
+      in CSLCommandHandler::HandleDeviceVendorId(), but use the primary LA of
+      the client as source instead
+    * hold a lock when changing the ackmask in
+      CUSBCECAdapterCommunication::Open
+    * don't respond with a feature abort to opcode play messages. bugzid: 873
+    * get the vendor id of the TV before allocating logical addresses, so we
+      can determine if the TV supports the requested device type directly
+    * TransmitImageViewOn() and TransmitActiveSource() always returned true,
+      even if sending the command failed, so the retry for failed source
+      activations was never triggered
+    * open libcec.so.1 instead of libcec.so in cecloader.h. credits @coling.
+      github issue #30.
+    * fixed missing firmware version and build date in cec-client -l /
+      GetDeviceInformation()
+
+ -- Pulse-Eight Packaging <packaging@pulse-eight.com>  Sun, 10 Jun 2012 13:39:00 +0100
+
 libcec (1.6.1-5) unstable; urgency=low
 
   * synced /debian directory with the one in precise (with a couple of changes)
diff --git a/README b/README
index a0ced0aa5408766a4dde602faba5e46d81ca32aa..7825aef61e6976ae9adef3c9b859008337cd5f08 100644 (file)
--- a/README
+++ b/README
@@ -20,7 +20,7 @@ To compile libCEC on Linux, you'll need the following dependencies:
 
 To compile, execute the following commands:
 # autoreconf -vif
-# ./configure --prefix=/usr
+# ./configure
 # make
 # sudo make install
 
@@ -36,7 +36,7 @@ To compile libCEC on OS-X, you'll need the following dependencies:
 
 To compile, execute the following commands (TODO: please verify):
 # autoreconf -vif
-# ./configure --prefix=/usr
+# ./configure
 # make
 # sudo make install
 
index b8d6031a1871832ede4f21f90b1c06b3acff8e62..ba40f03f9443def488fb922592c5ce9e97123da4 100644 (file)
@@ -1,4 +1,4 @@
-AC_INIT([libcec], 1:6:0)
+AC_INIT([libcec], 1:7:0)
 AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
 
 AC_PROG_CXX
index 0c8443b10356aa4ddae15fa4c62cdf5ce28c5561..3d69d4f3cd1d3f0b7f2075574dfe411cb8dbde92 100644 (file)
@@ -1,8 +1,46 @@
-libcec (1.6.1-6) unstable; urgency=low
+libcec (1.7.1-1) unstable; urgency=low
 
-  * updated debian/control to replace libcec (<< 1.6)
+  * changed/added:
+    * added physical address detection via ADL for AMD graphics cards
+    * attempt to get the edid from nvidia's graphics card driver on linux via
+      /proc/acpi/video/NGFX/HDMI/EDID
+    * attempt to get the PA from the registry on windows if we fail to get the
+      physical address from the display driver
+    * changed the order in CCECClient::SetPhysicalAddress() so it first checks
+      whether a PA override is set in libcec_configuration.iPhysicalAddress,
+      then checks whether the address can be detected, and if both failed it'll
+      use the HDMI port + base device setting
+    * cec-client: only active the source when reconnecting if libcec was the
+      active source before closing the connection
+    * platform: added tcp server sockets for posix
+
+  * interface changes:
+    * libcec_configuration.bAutodetectAddress is now read-only, and will be set
+      to 1 by libCEC if the PA was autodetected
+    * LibCecSharp: don't use an int but a CecUserControlCode in a CecKeypress
 
- -- Pulse-Eight Packaging <packaging@pulse-eight.com>  Sat, 26 May 2012 11:22:00 +0100
+  * fixed:
+    * don't unregister clients in CLibCEC when disconnecting, but only in
+      CCECProcessor. fixes reconnect after close
+    * MSGCODE_TIMEOUT_ERROR is a response to a transmission
+    * retry 'activate source' every 10 seconds if it failed
+    * don't respond with a poll from the broadcast address when receiving
+      in CSLCommandHandler::HandleDeviceVendorId(), but use the primary LA of
+      the client as source instead
+    * hold a lock when changing the ackmask in
+      CUSBCECAdapterCommunication::Open
+    * don't respond with a feature abort to opcode play messages. bugzid: 873
+    * get the vendor id of the TV before allocating logical addresses, so we
+      can determine if the TV supports the requested device type directly
+    * TransmitImageViewOn() and TransmitActiveSource() always returned true,
+      even if sending the command failed, so the retry for failed source
+      activations was never triggered
+    * open libcec.so.1 instead of libcec.so in cecloader.h. credits @coling.
+      github issue #30.
+    * fixed missing firmware version and build date in cec-client -l /
+      GetDeviceInformation()
+
+ -- Pulse-Eight Packaging <packaging@pulse-eight.com>  Sun, 10 Jun 2012 13:39:00 +0100
 
 libcec (1.6.1-5) unstable; urgency=low
 
index 163aaf8d82b6c54f23c45f32895dbdfdcc27b047..d3827e75a5cadb9fe4a27e1cb9b6d192e7323120 100644 (file)
@@ -1 +1 @@
-3.0 (quilt)
+1.0
diff --git a/debian/source/format.hardy b/debian/source/format.hardy
deleted file mode 100644 (file)
index d3827e7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-1.0
index abfde74b7e6a9807de2eb59c4eeb51eb7a7c4ded..8b335c1c32043f45c1d83cddada755674ac4faa2 100644 (file)
@@ -36,7 +36,7 @@
 
 #include "cectypes.h"
 
-#define LIBCEC_VERSION_CURRENT CEC_SERVER_VERSION_1_6_3
+#define LIBCEC_VERSION_CURRENT CEC_SERVER_VERSION_1_7_0
 
 namespace CEC
 {
index 5d4361d6199034c31b24732f52fe01c7fa137a8c..7a7dce6cf583d70c340e7f1fc9f5d0bcd5c9a595 100644 (file)
@@ -159,15 +159,11 @@ CEC::ICECAdapter *LibCecInit(const char *strDeviceName, CEC::cec_device_type_lis
 #if defined(__APPLE__)
     g_libCEC = dlopen(strLib ? strLib : "libcec.dylib", RTLD_LAZY);
 #else
-    g_libCEC = dlopen(strLib ? strLib : "libcec.so", RTLD_LAZY);
+    g_libCEC = dlopen(strLib ? strLib : "libcec.so." CEC_LIB_VERSION_MAJOR_STR, RTLD_LAZY);
 #endif
     if (!g_libCEC)
     {
-#if defined(__APPLE__)
-      cout << "cannot find " << (strLib ? strLib : "libcec.dylib") << dlerror() << endl;
-#else
-      cout << "cannot find " << (strLib ? strLib : "libcec.so") << dlerror() << endl;
-#endif
+      cout << dlerror() << endl;
       return NULL;
     }
   }
@@ -196,15 +192,11 @@ CEC::ICECAdapter *LibCecInitialise(CEC::libcec_configuration *configuration, con
 #if defined(__APPLE__)
     g_libCEC = dlopen(strLib ? strLib : "libcec.dylib", RTLD_LAZY);
 #else
-    g_libCEC = dlopen(strLib ? strLib : "libcec.so", RTLD_LAZY);
+    g_libCEC = dlopen(strLib ? strLib : "libcec.so." CEC_LIB_VERSION_MAJOR_STR, RTLD_LAZY);
 #endif
     if (!g_libCEC)
     {
-#if defined(__APPLE__)
-      cout << "cannot find " << (strLib ? strLib : "libcec.dylib") << dlerror() << endl;
-#else
-      cout << "cannot find " << (strLib ? strLib : "libcec.so") << dlerror() << endl;
-#endif
+      cout << dlerror() << endl;
       return NULL;
     }
   }
@@ -246,15 +238,11 @@ bool LibCecBootloader(const char *strLib = NULL)
 #if defined(__APPLE__)
     g_libCEC = dlopen(strLib ? strLib : "libcec.dylib", RTLD_LAZY);
 #else
-    g_libCEC = dlopen(strLib ? strLib : "libcec.so", RTLD_LAZY);
+    g_libCEC = dlopen(strLib ? strLib : "libcec.so." CEC_LIB_VERSION_MAJOR_STR, RTLD_LAZY);
 #endif
     if (!g_libCEC)
     {
-#if defined(__APPLE__)
-      cout << "cannot find " << (strLib ? strLib : "libcec.dylib") << dlerror() << endl;
-#else
-      cout << "cannot find " << (strLib ? strLib : "libcec.so") << dlerror() << endl;
-#endif
+      cout << dlerror() << endl;
       return NULL;
     }
   }
index 77b9927d3dca42823779cd844c95339cee2bfb29..b5ae1eca5dce16f6f9e191355155eb8bc88cc9c4 100644 (file)
@@ -97,7 +97,7 @@ namespace CEC {
 #define CEC_DEFAULT_SETTING_SEND_INACTIVE_SOURCE      1
 #define CEC_DEFAULT_SETTING_POWER_OFF_DEVICES_STANDBY 1
 #define CEC_DEFAULT_DEVICE_LANGUAGE                   "eng"
-#define CEC_DEFAULT_SETTING_AUTODETECT_ADDRESS        1
+#define CEC_DEFAULT_SETTING_AUTODETECT_ADDRESS        0
 #define CEC_DEFAULT_SETTING_GET_SETTINGS_FROM_ROM     0
 
 #define CEC_DEFAULT_TRANSMIT_RETRY_WAIT 500
@@ -112,7 +112,8 @@ namespace CEC {
 
 #define CEC_MIN_LIB_VERSION          1
 #define CEC_LIB_VERSION_MAJOR        1
-#define CEC_LIB_VERSION_MINOR        6
+#define CEC_LIB_VERSION_MAJOR_STR    "1"
+#define CEC_LIB_VERSION_MINOR        7
 
 typedef enum cec_abort_reason
 {
@@ -1191,7 +1192,8 @@ typedef enum cec_client_version
   CEC_CLIENT_VERSION_1_6_0   = 0x1600,
   CEC_CLIENT_VERSION_1_6_1   = 0x1601,
   CEC_CLIENT_VERSION_1_6_2   = 0x1602,
-  CEC_CLIENT_VERSION_1_6_3   = 0x1603
+  CEC_CLIENT_VERSION_1_6_3   = 0x1603,
+  CEC_CLIENT_VERSION_1_7_0   = 0x1700
 } cec_client_version;
 
 typedef enum cec_server_version
@@ -1204,7 +1206,8 @@ typedef enum cec_server_version
   CEC_SERVER_VERSION_1_6_0   = 0x1600,
   CEC_SERVER_VERSION_1_6_1   = 0x1601,
   CEC_SERVER_VERSION_1_6_2   = 0x1602,
-  CEC_SERVER_VERSION_1_6_3   = 0x1603
+  CEC_SERVER_VERSION_1_6_3   = 0x1603,
+  CEC_SERVER_VERSION_1_7_0   = 0x1700
 } cec_server_version;
 
 typedef struct libcec_configuration
@@ -1212,7 +1215,7 @@ typedef struct libcec_configuration
   uint32_t              clientVersion;        /*!< the version of the client that is connecting */
   char                  strDeviceName[13];    /*!< how to name the device on the CEC bus */
   cec_device_type_list  deviceTypes;          /*!< the CEC device types to emulate */
-  uint8_t               bAutodetectAddress;   /*!< try to autodetect the physical address when 1 */
+  uint8_t               bAutodetectAddress;   /*!< (read only) set to 1 by libCEC when the physical address was autodetected */
   uint16_t              iPhysicalAddress;     /*!< the physical address of the CEC adapter. only used when bAutodetectAddress = 0 or when the adapter doesn't support autodetection */
   cec_logical_address   baseDevice;           /*!< the logical address of the device to which the adapter is connected. only used when iPhysicalAddress = 0 and bAutodetectAddress = 0 or when the adapter doesn't support autodetection */
   uint8_t               iHDMIPort;            /*!< the HDMI port to which the adapter is connected. only used when iPhysicalAddress = 0 and bAutodetectAddress = 0 or when the adapter doesn't support autodetection */
@@ -1233,12 +1236,12 @@ typedef struct libcec_configuration
   void *                callbackParam;        /*!< the object to pass along with a call of the callback methods. NULL to ignore */
   ICECCallbacks *       callbacks;            /*!< the callback methods to use. set this to NULL when not using callbacks */
 
-  cec_logical_addresses logicalAddresses;     /*!< the current logical addresses. read-only. added in 1.5.3 */
-  uint16_t              iFirmwareVersion;     /*!< the firmware version of the adapter. added in 1.6.0 */
+  cec_logical_addresses logicalAddresses;     /*!< (read-only) the current logical addresses. added in 1.5.3 */
+  uint16_t              iFirmwareVersion;     /*!< (read-only) the firmware version of the adapter. added in 1.6.0 */
   uint8_t               bPowerOffDevicesOnStandby; /*!< put devices in standby when the PC/player is put in standby. added in 1.6.0 */
   uint8_t               bShutdownOnStandby;   /*!< shutdown this PC when the TV is switched off. only used when bPowerOffOnStandby = 0. added in 1.6.0 */
   char                  strDeviceLanguage[3]; /*!< the menu language used by the client. 3 character ISO 639-2 country code. see http://http://www.loc.gov/standards/iso639-2/ added in 1.6.2 */
-  uint32_t              iFirmwareBuildDate;   /*!< the build date of the firmware, in seconds since epoch. if not available, this value will be set to 0. added in 1.6.2 */
+  uint32_t              iFirmwareBuildDate;   /*!< (read-only) the build date of the firmware, in seconds since epoch. if not available, this value will be set to 0. added in 1.6.2 */
   uint8_t               bMonitorOnly;         /*!< won't allocate a CCECClient when starting the connection when set (same as monitor mode). added in 1.6.3 */
 
 #ifdef __cplusplus
@@ -1293,7 +1296,7 @@ typedef struct libcec_configuration
     tvVendor =              (uint64_t)CEC_VENDOR_UNKNOWN;
     clientVersion =         (uint32_t)CEC_CLIENT_VERSION_PRE_1_5;
     serverVersion =         (uint32_t)CEC_SERVER_VERSION_PRE_1_5;
-    bAutodetectAddress =              CEC_DEFAULT_SETTING_AUTODETECT_ADDRESS;
+    bAutodetectAddress =              0;
     bGetSettingsFromROM =             CEC_DEFAULT_SETTING_GET_SETTINGS_FROM_ROM;
     bUseTVMenuLanguage =              CEC_DEFAULT_SETTING_USE_TV_MENU_LANGUAGE;
     bActivateSource =                 CEC_DEFAULT_SETTING_ACTIVATE_SOURCE;
index 5548b060a7a77045ce168f178ad6f3aa648a2416..1e6cff7860b4564c57ca5c3a1128c9e2fa38dc93 100644 (file)
Binary files a/project/cec-config.rc and b/project/cec-config.rc differ
index 74148fe458305d777749c7cf3353686d1ba0c9fe..b7645d5ae3a47fa076183d2726832d92e101a154 100644 (file)
Binary files a/project/libcec.rc and b/project/libcec.rc differ
index a5beb9f418d79981a6a547bcbdc4aed91ae3f652..29fb6892af9b2963537946a91d05f99193639b79 100644 (file)
@@ -32,6 +32,7 @@
     <ClInclude Include="..\src\lib\CECClient.h" />
     <ClInclude Include="..\src\lib\CECInputBuffer.h" />
     <ClInclude Include="..\src\lib\CECProcessor.h" />
+    <ClInclude Include="..\src\lib\CECTypeUtils.h" />
     <ClInclude Include="..\src\lib\devices\CECAudioSystem.h" />
     <ClInclude Include="..\src\lib\devices\CECBusDevice.h" />
     <ClInclude Include="..\src\lib\devices\CECDeviceMap.h" />
     <ClInclude Include="..\src\lib\implementations\SLCommandHandler.h" />
     <ClInclude Include="..\src\lib\implementations\VLCommandHandler.h" />
     <ClInclude Include="..\src\lib\LibCEC.h" />
+    <ClInclude Include="..\src\lib\platform\adl\adl-edid.h" />
+    <ClInclude Include="..\src\lib\platform\adl\adl_defines.h" />
+    <ClInclude Include="..\src\lib\platform\adl\adl_sdk.h" />
+    <ClInclude Include="..\src\lib\platform\adl\adl_structures.h" />
+    <ClInclude Include="..\src\lib\platform\nvidia\nv-edid.h" />
     <ClInclude Include="..\src\lib\platform\os.h" />
     <ClInclude Include="..\src\lib\platform\sockets\serialport.h" />
     <ClInclude Include="..\src\lib\platform\sockets\socket.h" />
     <ClInclude Include="..\src\lib\platform\threads\threads.h" />
     <ClInclude Include="..\src\lib\platform\util\baudrate.h" />
     <ClInclude Include="..\src\lib\platform\util\buffer.h" />
+    <ClInclude Include="..\src\lib\platform\util\edid.h" />
     <ClInclude Include="..\src\lib\platform\util\StdString.h" />
     <ClInclude Include="..\src\lib\platform\util\timeutils.h" />
+    <ClInclude Include="..\src\lib\platform\windows\dlfcn-win32.h" />
     <ClInclude Include="..\src\lib\platform\windows\os-socket.h" />
     <ClInclude Include="..\src\lib\platform\windows\os-threads.h" />
     <ClInclude Include="..\src\lib\platform\windows\os-types.h" />
     <ClCompile Include="..\src\lib\LibCEC.cpp" />
     <ClCompile Include="..\src\lib\LibCECC.cpp" />
     <ClCompile Include="..\src\lib\LibCECDll.cpp" />
+    <ClCompile Include="..\src\lib\platform\adl\adl-edid.cpp" />
+    <ClCompile Include="..\src\lib\platform\nvidia\nv-edid.cpp" />
+    <ClCompile Include="..\src\lib\platform\windows\dlfcn-win32.cpp" />
+    <ClCompile Include="..\src\lib\platform\windows\os-edid.cpp" />
     <ClCompile Include="..\src\lib\platform\windows\os-threads.cpp" />
     <ClCompile Include="..\src\lib\platform\windows\serialport.cpp" />
   </ItemGroup>
index f1205a5e2bc7657be680bad501a4538a683e3522..58d0dbbfa321031d88bfb9093586fa5c0953d2b1 100644 (file)
     <Filter Include="platform\windows">
       <UniqueIdentifier>{65c4a590-4577-40e4-91ad-339e20b99ebe}</UniqueIdentifier>
     </Filter>
+    <Filter Include="platform\adl">
+      <UniqueIdentifier>{4fbd02e2-5671-4132-9b37-964c17fb3b0d}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="platform\nvidia">
+      <UniqueIdentifier>{685e2589-204d-4f9a-a637-a7ba1b61c669}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   <ItemGroup>
     <ClInclude Include="..\src\lib\CECProcessor.h" />
     <ClInclude Include="..\src\lib\devices\CECDeviceMap.h">
       <Filter>devices</Filter>
     </ClInclude>
+    <ClInclude Include="..\src\lib\CECTypeUtils.h" />
+    <ClInclude Include="..\src\lib\platform\util\edid.h">
+      <Filter>platform\util</Filter>
+    </ClInclude>
+    <ClInclude Include="..\src\lib\platform\adl\adl_defines.h">
+      <Filter>platform\adl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\src\lib\platform\adl\adl_sdk.h">
+      <Filter>platform\adl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\src\lib\platform\adl\adl_structures.h">
+      <Filter>platform\adl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\src\lib\platform\adl\adl-edid.h">
+      <Filter>platform\adl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\src\lib\platform\windows\dlfcn-win32.h">
+      <Filter>platform\windows</Filter>
+    </ClInclude>
+    <ClInclude Include="..\src\lib\platform\nvidia\nv-edid.h">
+      <Filter>platform\nvidia</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\src\lib\CECProcessor.cpp" />
     <ClCompile Include="..\src\lib\devices\CECDeviceMap.cpp">
       <Filter>devices</Filter>
     </ClCompile>
+    <ClCompile Include="..\src\lib\platform\windows\os-edid.cpp">
+      <Filter>platform\windows</Filter>
+    </ClCompile>
+    <ClCompile Include="..\src\lib\platform\adl\adl-edid.cpp">
+      <Filter>platform\adl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\src\lib\platform\windows\dlfcn-win32.cpp">
+      <Filter>platform\windows</Filter>
+    </ClCompile>
+    <ClCompile Include="..\src\lib\platform\nvidia\nv-edid.cpp">
+      <Filter>platform\nvidia</Filter>
+    </ClCompile>
   </ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="libcec.rc" />
index a2f7026c06cc3e320a8c60d870bb6f30248776cf..e6d2bb14c8ac71a6bb7e7ecb0433f54ab51a26e3 100644 (file)
Binary files a/project/testclient.rc and b/project/testclient.rc differ
index e66603c574716680f5525b2c8551fa2f590bd560..e633261e09d35421cf000b8bd848377c9d26c643 100644 (file)
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.6.3.0")]
-[assembly: AssemblyFileVersion("1.6.3.0")]
+[assembly: AssemblyVersion("1.7.0.0")]
+[assembly: AssemblyFileVersion("1.7.0.0")]
index 6c7d86d403ea3bc5da6460b04208f1a062c42c78..1d5f769befdbc9ab62a4de1c8ad15ad9a9cb5e09 100644 (file)
@@ -13,7 +13,7 @@ using namespace System::Security::Permissions;
 [assembly:AssemblyTrademarkAttribute("")];
 [assembly:AssemblyCultureAttribute("")];
 
-[assembly:AssemblyVersionAttribute("1.6.3.0")];
+[assembly:AssemblyVersionAttribute("1.7.0.0")];
 
 [assembly:ComVisible(false)];
 [assembly:CLSCompliantAttribute(true)];
index 43aaff935ca0b75e8bfe0b8cc78523820cdf3831..9be7ab5b87b64285b63e5bde5290a3e51f86e4ba 100644 (file)
@@ -247,6 +247,7 @@ namespace CecSharp
                F5                          = 0x75,
                Data                        = 0x76,
                Max                         = 0x76,
+               SamsungReturn               = 0x91,
                Unknown
        };
 
@@ -356,7 +357,8 @@ namespace CecSharp
                Version1_6_0  = 0x1600,
                Version1_6_1  = 0x1601,
     Version1_6_2  = 0x1602,
-    Version1_6_3  = 0x1603
+    Version1_6_3  = 0x1603,
+    Version1_7_0  = 0x1700
        };
 
        public enum class CecServerVersion
@@ -369,7 +371,8 @@ namespace CecSharp
                Version1_6_0  = 0x1600,
                Version1_6_1  = 0x1601,
     Version1_6_2  = 0x1602,
-    Version1_6_3  = 0x1603
+    Version1_6_3  = 0x1603,
+    Version1_7_0  = 0x1700
        };
 
        public ref class CecAdapter
@@ -510,7 +513,7 @@ namespace CecSharp
        public ref class CecKeypress
        {
        public:
-               CecKeypress(int iKeycode, unsigned int iDuration)
+               CecKeypress(CecUserControlCode iKeycode, unsigned int iDuration)
                {
                        Keycode  = iKeycode;
                        Duration = iDuration;
@@ -519,14 +522,14 @@ namespace CecSharp
 
                CecKeypress(void)
                {
-                       Keycode  = 0;
+                       Keycode  = CecUserControlCode::Unknown;
                        Duration = 0;
                        Empty    = true;
                }
 
-               property bool         Empty;
-               property int          Keycode;
-               property unsigned int Duration;
+               property bool               Empty;
+               property CecUserControlCode Keycode;
+               property unsigned int       Duration;
        };
 
        public ref class CecLogMessage
@@ -837,7 +840,7 @@ namespace CecSharp
                {
                        int iReturn(0);
                        if (m_bHasCallbacks)
-                               iReturn = m_callbacks->ReceiveKeypress(gcnew CecKeypress(key.keycode, key.duration));
+                               iReturn = m_callbacks->ReceiveKeypress(gcnew CecKeypress((CecUserControlCode)key.keycode, key.duration));
                        return iReturn;
                }
 
index 97329b3e9cd773e8dd531528c3c815dc24588261..7f0667a84066d92245f91ba1827c7aa263aabcdc 100644 (file)
@@ -235,7 +235,7 @@ namespace CecSharp
                        cec_keypress key;
                        if (m_libCec->GetNextKeypress(&key))
                        {
-                               return gcnew CecKeypress(key.keycode, key.duration);
+                               return gcnew CecKeypress((CecUserControlCode)key.keycode, key.duration);
                        }
 
                        return gcnew CecKeypress();
index 8fb066f2e9349915ad260c15d55306ea78792218..848ad60c7b978d02a71dbd9abae158a75ba1fec2 100644 (file)
@@ -180,85 +180,85 @@ namespace CecConfigGui
     private void LoadButtonConfiguration()
     {
       //TODO load the real configuration
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Select", (new CecKeypress { Keycode = 0x00 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Up", (new CecKeypress { Keycode = 0x01 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Down", (new CecKeypress { Keycode = 0x02 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Left", (new CecKeypress { Keycode = 0x03 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Right", (new CecKeypress { Keycode = 0x04 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Right+Up", (new CecKeypress { Keycode = 0x05 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Right+Down", (new CecKeypress { Keycode = 0x06 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Left+Up", (new CecKeypress { Keycode = 0x07 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Left+Down", (new CecKeypress { Keycode = 0x08 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Root menu", (new CecKeypress { Keycode = 0x09 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Setup menu", (new CecKeypress { Keycode = 0x0A }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Contents menu", (new CecKeypress { Keycode = 0x0B }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Favourite menu", (new CecKeypress { Keycode = 0x0C }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Exit", (new CecKeypress { Keycode = 0x0D }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("0", (new CecKeypress { Keycode = 0x20 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("1", (new CecKeypress { Keycode = 0x21 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("2", (new CecKeypress { Keycode = 0x22 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("3", (new CecKeypress { Keycode = 0x23 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("4", (new CecKeypress { Keycode = 0x24 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("5", (new CecKeypress { Keycode = 0x25 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("6", (new CecKeypress { Keycode = 0x26 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("7", (new CecKeypress { Keycode = 0x27 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("8", (new CecKeypress { Keycode = 0x28 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("9", (new CecKeypress { Keycode = 0x29 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem(".", (new CecKeypress { Keycode = 0x2A }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Enter", (new CecKeypress { Keycode = 0x2B }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Clear", (new CecKeypress { Keycode = 0x2C }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Next favourite", (new CecKeypress { Keycode = 0x2F }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Channel up", (new CecKeypress { Keycode = 0x30 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Channel down", (new CecKeypress { Keycode = 0x31 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Previous channel", (new CecKeypress { Keycode = 0x32 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Sound select", (new CecKeypress { Keycode = 0x33 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Input select", (new CecKeypress { Keycode = 0x34 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Display information", (new CecKeypress { Keycode = 0x35 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Help", (new CecKeypress { Keycode = 0x36 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Page up", (new CecKeypress { Keycode = 0x37 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Page down", (new CecKeypress { Keycode = 0x38 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Power", (new CecKeypress { Keycode = 0x40 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Volume up", (new CecKeypress { Keycode = 0x41 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Volume down", (new CecKeypress { Keycode = 0x42 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Mute", (new CecKeypress { Keycode = 0x43 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Play", (new CecKeypress { Keycode = 0x44 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Stop", (new CecKeypress { Keycode = 0x45 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Pause", (new CecKeypress { Keycode = 0x46 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Record", (new CecKeypress { Keycode = 0x47 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Rewind", (new CecKeypress { Keycode = 0x48 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Fast forward", (new CecKeypress { Keycode = 0x49 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Eject", (new CecKeypress { Keycode = 0x4A }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Forward", (new CecKeypress { Keycode = 0x4B }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Backward", (new CecKeypress { Keycode = 0x4C }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Stop record", (new CecKeypress { Keycode = 0x4D }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Pause record", (new CecKeypress { Keycode = 0x4E }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Angle", (new CecKeypress { Keycode = 0x50 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Sub picture", (new CecKeypress { Keycode = 0x51 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Video on demand", (new CecKeypress { Keycode = 0x52 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Electronic program guide", (new CecKeypress { Keycode = 0x53 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Timer programming", (new CecKeypress { Keycode = 0x54 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Initial configuration", (new CecKeypress { Keycode = 0x55 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Play (function)", (new CecKeypress { Keycode = 0x60 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Pause play (function)", (new CecKeypress { Keycode = 0x61 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Record (function)", (new CecKeypress { Keycode = 0x62 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Pause record (function)", (new CecKeypress { Keycode = 0x63 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Stop (function)", (new CecKeypress { Keycode = 0x64 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Mute (function)", (new CecKeypress { Keycode = 0x65 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Restore volume", (new CecKeypress { Keycode = 0x66 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Tune", (new CecKeypress { Keycode = 0x67 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Select media", (new CecKeypress { Keycode = 0x68 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Select AV input", (new CecKeypress { Keycode = 0x69 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Select audio input", (new CecKeypress { Keycode = 0x6A }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Power toggle", (new CecKeypress { Keycode = 0x6B }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Power off", (new CecKeypress { Keycode = 0x6C }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Power on", (new CecKeypress { Keycode = 0x6D }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F1 (blue)", (new CecKeypress { Keycode = 0x71 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F2 (red)", (new CecKeypress { Keycode = 0x72 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F3 (green)", (new CecKeypress { Keycode = 0x73 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F4 (yellow)", (new CecKeypress { Keycode = 0x74 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F5", (new CecKeypress { Keycode = 0x75 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Data", (new CecKeypress { Keycode = 0x76 }), string.Empty));
-      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("(Samsung) Return", (new CecKeypress { Keycode = 0x91 }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Select", (new CecKeypress { Keycode = CecUserControlCode.Select }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Up", (new CecKeypress { Keycode = CecUserControlCode.Up }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Down", (new CecKeypress { Keycode = CecUserControlCode.Down }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Left", (new CecKeypress { Keycode = CecUserControlCode.Left }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Right", (new CecKeypress { Keycode = CecUserControlCode.Right }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Right+Up", (new CecKeypress { Keycode = CecUserControlCode.RightUp }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Right+Down", (new CecKeypress { Keycode = CecUserControlCode.RightDown }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Left+Up", (new CecKeypress { Keycode = CecUserControlCode.LeftUp }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Left+Down", (new CecKeypress { Keycode = CecUserControlCode.LeftDown }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Root menu", (new CecKeypress { Keycode = CecUserControlCode.RootMenu }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Setup menu", (new CecKeypress { Keycode = CecUserControlCode.SetupMenu }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Contents menu", (new CecKeypress { Keycode = CecUserControlCode.ContentsMenu }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Favourite menu", (new CecKeypress { Keycode = CecUserControlCode.FavoriteMenu }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Exit", (new CecKeypress { Keycode = CecUserControlCode.Exit }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("0", (new CecKeypress { Keycode = CecUserControlCode.Number0 }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("1", (new CecKeypress { Keycode = CecUserControlCode.Number1 }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("2", (new CecKeypress { Keycode = CecUserControlCode.Number2 }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("3", (new CecKeypress { Keycode = CecUserControlCode.Number3 }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("4", (new CecKeypress { Keycode = CecUserControlCode.Number4 }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("5", (new CecKeypress { Keycode = CecUserControlCode.Number5 }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("6", (new CecKeypress { Keycode = CecUserControlCode.Number6 }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("7", (new CecKeypress { Keycode = CecUserControlCode.Number7 }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("8", (new CecKeypress { Keycode = CecUserControlCode.Number8 }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("9", (new CecKeypress { Keycode = CecUserControlCode.Number9 }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem(".", (new CecKeypress { Keycode = CecUserControlCode.Dot }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Enter", (new CecKeypress { Keycode = CecUserControlCode.Enter }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Clear", (new CecKeypress { Keycode = CecUserControlCode.Clear }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Next favourite", (new CecKeypress { Keycode = CecUserControlCode.NextFavorite }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Channel up", (new CecKeypress { Keycode = CecUserControlCode.ChannelUp }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Channel down", (new CecKeypress { Keycode = CecUserControlCode.ChannelDown }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Previous channel", (new CecKeypress { Keycode = CecUserControlCode.PreviousChannel }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Sound select", (new CecKeypress { Keycode = CecUserControlCode.SoundSelect }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Input select", (new CecKeypress { Keycode = CecUserControlCode.InputSelect }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Display information", (new CecKeypress { Keycode = CecUserControlCode.DisplayInformation }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Help", (new CecKeypress { Keycode = CecUserControlCode.Help }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Page up", (new CecKeypress { Keycode = CecUserControlCode.PageUp }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Page down", (new CecKeypress { Keycode = CecUserControlCode.PageDown }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Power", (new CecKeypress { Keycode = CecUserControlCode.Power }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Volume up", (new CecKeypress { Keycode = CecUserControlCode.VolumeUp }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Volume down", (new CecKeypress { Keycode = CecUserControlCode.VolumeDown }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Mute", (new CecKeypress { Keycode = CecUserControlCode.Mute }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Play", (new CecKeypress { Keycode = CecUserControlCode.Play }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Stop", (new CecKeypress { Keycode = CecUserControlCode.Stop }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Pause", (new CecKeypress { Keycode = CecUserControlCode.Pause }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Record", (new CecKeypress { Keycode = CecUserControlCode.Record }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Rewind", (new CecKeypress { Keycode = CecUserControlCode.Rewind }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Fast forward", (new CecKeypress { Keycode = CecUserControlCode.FastForward }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Eject", (new CecKeypress { Keycode = CecUserControlCode.Eject }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Forward", (new CecKeypress { Keycode = CecUserControlCode.Forward }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Backward", (new CecKeypress { Keycode = CecUserControlCode.Backward }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Stop record", (new CecKeypress { Keycode = CecUserControlCode.StopRecord }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Pause record", (new CecKeypress { Keycode = CecUserControlCode.PauseRecord }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Angle", (new CecKeypress { Keycode = CecUserControlCode.Angle }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Sub picture", (new CecKeypress { Keycode = CecUserControlCode.SubPicture }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Video on demand", (new CecKeypress { Keycode = CecUserControlCode.VideoOnDemand }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Electronic program guide", (new CecKeypress { Keycode = CecUserControlCode.ElectronicProgramGuide }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Timer programming", (new CecKeypress { Keycode = CecUserControlCode.TimerProgramming }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Initial configuration", (new CecKeypress { Keycode = CecUserControlCode.InitialConfiguration }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Play (function)", (new CecKeypress { Keycode = CecUserControlCode.PlayFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Pause play (function)", (new CecKeypress { Keycode = CecUserControlCode.PausePlayFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Record (function)", (new CecKeypress { Keycode = CecUserControlCode.RecordFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Pause record (function)", (new CecKeypress { Keycode = CecUserControlCode .PauseRecordFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Stop (function)", (new CecKeypress { Keycode = CecUserControlCode.StopFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Mute (function)", (new CecKeypress { Keycode = CecUserControlCode.MuteFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Restore volume", (new CecKeypress { Keycode = CecUserControlCode.RestoreVolumeFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Tune", (new CecKeypress { Keycode = CecUserControlCode.TuneFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Select media", (new CecKeypress { Keycode = CecUserControlCode.SelectMediaFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Select AV input", (new CecKeypress { Keycode = CecUserControlCode.SelectAVInputFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Select audio input", (new CecKeypress { Keycode = CecUserControlCode.SelectAudioInputFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Power toggle", (new CecKeypress { Keycode = CecUserControlCode.PowerToggleFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Power off", (new CecKeypress { Keycode = CecUserControlCode.PowerOffFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Power on", (new CecKeypress { Keycode = CecUserControlCode.PowerOnFunction }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F1 (blue)", (new CecKeypress { Keycode = CecUserControlCode.F1Blue }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F2 (red)", (new CecKeypress { Keycode = CecUserControlCode.F2Red }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F3 (green)", (new CecKeypress { Keycode = CecUserControlCode.F3Green }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F4 (yellow)", (new CecKeypress { Keycode = CecUserControlCode.F4Yellow }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("F5", (new CecKeypress { Keycode = CecUserControlCode.F5 }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Data", (new CecKeypress { Keycode = CecUserControlCode.Data }), string.Empty));
+      cecButtonConfigBindingSource.Add(new CecButtonConfigItem("Return (Samsung)", (new CecKeypress { Keycode = CecUserControlCode.SamsungReturn }), string.Empty));
     }
 
     private void ProcessEventHandler(object src, UpdateEvent updateEvent)
index 8cc88a95658dbc2af5ceb2dcd368bae5d624eb3c..1a83d3ec997991cf7af03c89238949881cc59cb3 100644 (file)
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
 // You can specify all the values or you can default the Build and Revision Numbers 
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.6.3.0")]
-[assembly: AssemblyFileVersion("1.6.3.0")]
+[assembly: AssemblyVersion("1.7.0.0")]
+[assembly: AssemblyFileVersion("1.7.0.0")]
index 5b4529788487f19305da14379242bb5e4fcd82fd..7cf542bd1766ee445214d6cd718ee4c3b8a28a11 100644 (file)
 #include "CECClient.h"
 #include "CECProcessor.h"
 #include "LibCEC.h"
+#include "CECTypeUtils.h"
 #include "devices/CECPlaybackDevice.h"
 #include "devices/CECAudioSystem.h"
 #include "devices/CECTV.h"
+#include "implementations/CECCommandHandler.h"
 
 using namespace CEC;
 using namespace PLATFORM;
 
 #define LIB_CEC     m_processor->GetLib()
-#define ToString(x) LIB_CEC->ToString(x)
+#define ToString(x) CCECTypeUtils::ToString(x)
 
 CCECClient::CCECClient(CCECProcessor *processor, const libcec_configuration &configuration) :
     m_processor(processor),
@@ -119,9 +121,6 @@ bool CCECClient::OnRegister(void)
   // set the physical address
   SetPhysicalAddress(m_configuration);
 
-  // ensure that we know the vendor id of the TV, so we are using the correct handler
-  m_processor->GetTV()->GetVendorId(GetPrimaryLogicalAdddress());
-
   // make the primary device the active source if the option is set
   if (m_configuration.bActivateSource == 1)
     GetPrimaryDevice()->ActivateSource();
@@ -194,15 +193,19 @@ void CCECClient::ResetPhysicalAddress(void)
 
 void CCECClient::SetPhysicalAddress(const libcec_configuration &configuration)
 {
-  // try to autodetect the address
   bool bPASet(false);
-  if (m_processor->CECInitialised() && configuration.bAutodetectAddress == 1)
-    bPASet = AutodetectPhysicalAddress();
 
-  // try to use physical address setting
+  // override the physical address from configuration.iPhysicalAddress if it's set
   if (!bPASet && CLibCEC::IsValidPhysicalAddress(configuration.iPhysicalAddress))
     bPASet = SetPhysicalAddress(configuration.iPhysicalAddress);
 
+  // try to autodetect the address
+  if (!bPASet && m_processor->CECInitialised())
+  {
+    bPASet = AutodetectPhysicalAddress();
+    m_configuration.bAutodetectAddress = bPASet ? 1 : 0;
+  }
+
   // use the base device + hdmi port settings
   if (!bPASet)
     bPASet = SetHDMIPort(configuration.baseDevice, configuration.iHDMIPort);
@@ -245,11 +248,40 @@ bool CCECClient::SetPhysicalAddress(const uint16_t iPhysicalAddress)
   return true;
 }
 
+void CCECClient::SetSupportedDeviceTypes(void)
+{
+  cec_device_type_list types;
+  types.Clear();
+
+  // get the command handler for the tv
+  CCECCommandHandler *tvHandler = m_processor->GetTV()->GetHandler();
+  if (!tvHandler)
+    return;
+
+  // check all device types
+  for (uint8_t iPtr = 0; iPtr < 5; iPtr++)
+  {
+    if (m_configuration.deviceTypes.types[iPtr] == CEC_DEVICE_TYPE_RESERVED)
+      continue;
+
+    // get the supported device type. the handler will replace types it doesn't support by one it does support
+    cec_device_type type = tvHandler->GetReplacementDeviceType(m_configuration.deviceTypes.types[iPtr]);
+    if (!types.IsSet(type))
+      types.Add(type);
+  }
+
+  // set the new type list
+  m_configuration.deviceTypes = types;
+}
+
 bool CCECClient::AllocateLogicalAddresses(void)
 {
   // reset all previous LAs that were set
   m_configuration.logicalAddresses.Clear();
 
+  // get the supported device types from the command handler of the TV
+  SetSupportedDeviceTypes();
+
   // display an error if no device types are set
   if (m_configuration.deviceTypes.IsEmpty())
   {
index 3d812f0ff9377e574d3448aa125b58607ce0fb32..87a4b7fbaf071d9067ea897dc1ca8f9ac1fb7233 100644 (file)
@@ -292,6 +292,11 @@ namespace CEC
      */
     virtual bool AutodetectPhysicalAddress(void);
 
+    /*!
+     * @brief Replaces all device types in m_configuration by types that are supported by the command handler of the TV
+     */
+    virtual void SetSupportedDeviceTypes(void);
+
     CCECProcessor *                         m_processor;      /**< a pointer to the processor */
     libcec_configuration                    m_configuration;  /**< the configuration of this client */
     bool                                    m_bInitialised;   /**< true when initialised, false otherwise */
index 3bfa061548c0e4b74d4811e7296790a6849b2630..ca323fc4b67851fd3f26a58ff5b3998595b5bc56 100644 (file)
 #include "implementations/CECCommandHandler.h"
 #include "LibCEC.h"
 #include "CECClient.h"
+#include "CECTypeUtils.h"
 #include "platform/util/timeutils.h"
+#include "platform/util/util.h"
 
 using namespace CEC;
 using namespace std;
 using namespace PLATFORM;
 
 #define CEC_PROCESSOR_SIGNAL_WAIT_TIME 1000
+#define ACTIVE_SOURCE_CHECK_TIMEOUT    15000
 
-#define ToString(x) m_libcec->ToString(x)
+#define ToString(x) CCECTypeUtils::ToString(x)
 
 CCECProcessor::CCECProcessor(CLibCEC *libcec) :
     m_bInitialised(false),
@@ -66,7 +69,7 @@ CCECProcessor::CCECProcessor(CLibCEC *libcec) :
 CCECProcessor::~CCECProcessor(void)
 {
   Close();
-  delete m_busDevices;
+  DELETE_AND_NULL(m_busDevices);
 }
 
 bool CCECProcessor::Start(const char *strPort, uint16_t iBaudRate /* = CEC_SERIAL_DEFAULT_BAUDRATE */, uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */)
@@ -98,21 +101,13 @@ void CCECProcessor::Close(void)
   StopThread();
 
   // close the connection
-  if (m_communication)
-  {
-    delete m_communication;
-    m_communication = NULL;
-  }
+  DELETE_AND_NULL(m_communication);
 }
 
 void CCECProcessor::ResetMembers(void)
 {
   // close the connection
-  if (m_communication)
-  {
-    delete m_communication;
-    m_communication = NULL;
-  }
+  DELETE_AND_NULL(m_communication);
 
   // reset the other members to the initial state
   m_iStandardLineTimeout = 3;
@@ -153,9 +148,6 @@ bool CCECProcessor::OpenConnection(const char *strPort, uint16_t iBaudRate, uint
 
   m_libcec->AddLog(CEC_LOG_NOTICE, "connection opened");
 
-  // always start by setting the ackmask to 0, to clear previous values
-  SetAckMask(0);
-
   // mark as initialised
   SetCECInitialised(true);
 
@@ -206,6 +198,19 @@ void CCECProcessor::ReplaceHandlers(void)
     it->second->ReplaceHandler(true);
 }
 
+void CCECProcessor::CheckPendingActiveSource(void)
+{
+  if (!CECInitialised())
+    return;
+
+  // check each device
+  for (CECDEVICEMAP::iterator it = m_busDevices->Begin(); it != m_busDevices->End(); it++)
+  {
+    if (it->second->GetHandler()->ActiveSourcePending())
+      it->second->ActivateSource();
+  }
+}
+
 bool CCECProcessor::OnCommandReceived(const cec_command &command)
 {
   return m_inBuffer.Push(command);
@@ -216,6 +221,7 @@ void *CCECProcessor::Process(void)
   m_libcec->AddLog(CEC_LOG_DEBUG, "processor thread started");
 
   cec_command command;
+  CTimeout activeSourceCheck(ACTIVE_SOURCE_CHECK_TIMEOUT);
 
   // as long as we're not being stopped and the connection is open
   while (!IsStopped() && m_communication->IsOpen())
@@ -231,6 +237,13 @@ void *CCECProcessor::Process(void)
 
       // check if we need to replace handlers
       ReplaceHandlers();
+
+      // check whether we need to activate a source, if it failed before
+      if (activeSourceCheck.TimeLeft() == 0)
+      {
+        CheckPendingActiveSource();
+        activeSourceCheck.Init(ACTIVE_SOURCE_CHECK_TIMEOUT);
+      }
     }
   }
 
@@ -517,7 +530,7 @@ bool CCECProcessor::StartBootloader(const char *strPort /* = NULL */)
     if (comm->IsOpen())
     {
       bReturn = comm->StartBootloader();
-      delete comm;
+      DELETE_AND_NULL(comm);
     }
     return bReturn;
   }
@@ -632,6 +645,9 @@ bool CCECProcessor::RegisterClient(CCECClient *client)
     return false;
   }
 
+  // ensure that we know the vendor id of the TV
+  GetTV()->GetVendorId(CECDEVICE_UNREGISTERED);
+
   // unregister the client first if it's already been marked as registered
   if (client->IsRegistered())
     UnregisterClient(client);
@@ -707,6 +723,14 @@ bool CCECProcessor::RegisterClient(CCECClient *client)
     client->Alert(CEC_ALERT_SERVICE_DEVICE, param);
   }
 
+  // ensure that the command handler for the TV is initialised
+  if (bReturn)
+  {
+    CCECCommandHandler *handler = GetTV()->GetHandler();
+    if (handler)
+      handler->InitHandler();
+  }
+
   return bReturn;
 }
 
index 5f496d2631558506045e645ecf450e4ba37c5995..04d84f55ee2f5edab2997a5aec3d51a5df25d316 100644 (file)
@@ -134,6 +134,7 @@ namespace CEC
       void SetCECInitialised(bool bSetTo = true);
 
       void ReplaceHandlers(void);
+      void CheckPendingActiveSource(void);
       bool PhysicalAddressInUse(uint16_t iPhysicalAddress);
       bool SetAckMask(uint16_t iMask);
 
diff --git a/src/lib/CECTypeUtils.h b/src/lib/CECTypeUtils.h
new file mode 100644 (file)
index 0000000..5e39f54
--- /dev/null
@@ -0,0 +1,560 @@
+#pragma once
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#include "../../include/cectypes.h"
+
+namespace CEC
+{
+  class CCECTypeUtils
+  {
+  public:
+    /*!
+     * @brief Get the device type for the given logical address.
+     * @param address The address to get the type for.
+     * @return The type, or CEC_DEVICE_TYPE_RESERVED if unknown.
+     */
+    static cec_device_type GetType(const cec_logical_address address)
+    {
+      switch (address)
+      {
+        case CECDEVICE_AUDIOSYSTEM:
+          return CEC_DEVICE_TYPE_AUDIO_SYSTEM;
+        case CECDEVICE_PLAYBACKDEVICE1:
+        case CECDEVICE_PLAYBACKDEVICE2:
+        case CECDEVICE_PLAYBACKDEVICE3:
+          return CEC_DEVICE_TYPE_PLAYBACK_DEVICE;
+        case CECDEVICE_RECORDINGDEVICE1:
+        case CECDEVICE_RECORDINGDEVICE2:
+        case CECDEVICE_RECORDINGDEVICE3:
+          return CEC_DEVICE_TYPE_RECORDING_DEVICE;
+        case CECDEVICE_TUNER1:
+        case CECDEVICE_TUNER2:
+        case CECDEVICE_TUNER3:
+        case CECDEVICE_TUNER4:
+          return CEC_DEVICE_TYPE_TUNER;
+        case CECDEVICE_TV:
+          return CEC_DEVICE_TYPE_TV;
+        default:
+          return CEC_DEVICE_TYPE_RESERVED;
+      }
+    }
+
+    /*!
+     * @brief Get the ackmask for all devices of the same type as the given logical address.
+     * @param address The address to get the ackmask for.
+     * @return The ackmask for this type.
+     */
+    static uint16_t GetMaskForType(cec_logical_address address)
+    {
+      return GetMaskForType(GetType(address));
+    }
+
+    /*!
+     * @brief Get the ackmask for all devices of the given type.
+     * @param type The type to get the ackmask for.
+     * @return The ackmask for this type, or 0 of no types match.
+     */
+    static uint16_t GetMaskForType(const cec_device_type type)
+    {
+      switch (type)
+      {
+        case CEC_DEVICE_TYPE_AUDIO_SYSTEM:
+        {
+          cec_logical_addresses addr;
+          addr.Clear();
+          addr.Set(CECDEVICE_AUDIOSYSTEM);
+          return addr.AckMask();
+        }
+        case CEC_DEVICE_TYPE_PLAYBACK_DEVICE:
+        {
+          cec_logical_addresses addr;
+          addr.Clear();
+          addr.Set(CECDEVICE_PLAYBACKDEVICE1);
+          addr.Set(CECDEVICE_PLAYBACKDEVICE2);
+          addr.Set(CECDEVICE_PLAYBACKDEVICE3);
+          return addr.AckMask();
+        }
+        case CEC_DEVICE_TYPE_RECORDING_DEVICE:
+        {
+          cec_logical_addresses addr;
+          addr.Clear();
+          addr.Set(CECDEVICE_RECORDINGDEVICE1);
+          addr.Set(CECDEVICE_RECORDINGDEVICE2);
+          addr.Set(CECDEVICE_RECORDINGDEVICE3);
+          return addr.AckMask();
+        }
+        case CEC_DEVICE_TYPE_TUNER:
+        {
+          cec_logical_addresses addr;
+          addr.Clear();
+          addr.Set(CECDEVICE_TUNER1);
+          addr.Set(CECDEVICE_TUNER2);
+          addr.Set(CECDEVICE_TUNER3);
+          addr.Set(CECDEVICE_TUNER4);
+          return addr.AckMask();
+        }
+        case CEC_DEVICE_TYPE_TV:
+        {
+          cec_logical_addresses addr;
+          addr.Clear();
+          addr.Set(CECDEVICE_TV);
+          return addr.AckMask();
+        }
+        default:
+          return 0;
+      }
+    }
+
+    static const char *ToString(const cec_device_type type)
+    {
+      switch (type)
+      {
+      case CEC_DEVICE_TYPE_AUDIO_SYSTEM:
+        return "audio system";
+      case CEC_DEVICE_TYPE_PLAYBACK_DEVICE:
+        return "playback device";
+      case CEC_DEVICE_TYPE_RECORDING_DEVICE:
+          return "recording device";
+      case CEC_DEVICE_TYPE_RESERVED:
+          return "reserved";
+      case CEC_DEVICE_TYPE_TUNER:
+          return "tuner";
+      case CEC_DEVICE_TYPE_TV:
+          return "TV";
+      default:
+        return "unknown";
+      }
+    }
+
+    static const char *ToString(const cec_menu_state state)
+    {
+      switch (state)
+      {
+      case CEC_MENU_STATE_ACTIVATED:
+        return "activated";
+      case CEC_MENU_STATE_DEACTIVATED:
+        return "deactivated";
+      default:
+        return "unknown";
+      }
+    }
+
+    static const char *ToString(const cec_version version)
+    {
+      switch (version)
+      {
+      case CEC_VERSION_1_2:
+        return "1.2";
+      case CEC_VERSION_1_2A:
+        return "1.2a";
+      case CEC_VERSION_1_3:
+        return "1.3";
+      case CEC_VERSION_1_3A:
+        return "1.3a";
+      case CEC_VERSION_1_4:
+        return "1.4";
+      default:
+        return "unknown";
+      }
+    }
+
+    static const char *ToString(const cec_power_status status)
+    {
+      switch (status)
+      {
+      case CEC_POWER_STATUS_ON:
+        return "on";
+      case CEC_POWER_STATUS_STANDBY:
+        return "standby";
+      case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY:
+        return "in transition from on to standby";
+      case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON:
+        return "in transition from standby to on";
+      default:
+        return "unknown";
+      }
+    }
+
+    static const char *ToString(const cec_logical_address address)
+    {
+      switch(address)
+      {
+      case CECDEVICE_AUDIOSYSTEM:
+        return "Audio";
+      case CECDEVICE_BROADCAST:
+        return "Broadcast";
+      case CECDEVICE_FREEUSE:
+        return "Free use";
+      case CECDEVICE_PLAYBACKDEVICE1:
+        return "Playback 1";
+      case CECDEVICE_PLAYBACKDEVICE2:
+        return "Playback 2";
+      case CECDEVICE_PLAYBACKDEVICE3:
+        return "Playback 3";
+      case CECDEVICE_RECORDINGDEVICE1:
+        return "Recorder 1";
+      case CECDEVICE_RECORDINGDEVICE2:
+        return "Recorder 2";
+      case CECDEVICE_RECORDINGDEVICE3:
+        return "Recorder 3";
+      case CECDEVICE_RESERVED1:
+        return "Reserved 1";
+      case CECDEVICE_RESERVED2:
+        return "Reserved 2";
+      case CECDEVICE_TUNER1:
+        return "Tuner 1";
+      case CECDEVICE_TUNER2:
+        return "Tuner 2";
+      case CECDEVICE_TUNER3:
+        return "Tuner 3";
+      case CECDEVICE_TUNER4:
+        return "Tuner 4";
+      case CECDEVICE_TV:
+        return "TV";
+      default:
+        return "unknown";
+      }
+    }
+
+    static const char *ToString(const cec_deck_control_mode mode)
+    {
+      switch (mode)
+      {
+      case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND:
+        return "skip forward wind";
+      case CEC_DECK_CONTROL_MODE_EJECT:
+        return "eject";
+      case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND:
+        return "reverse rewind";
+      case CEC_DECK_CONTROL_MODE_STOP:
+        return "stop";
+      default:
+        return "unknown";
+      }
+    }
+
+    static const char *ToString(const cec_deck_info status)
+    {
+      switch (status)
+      {
+      case CEC_DECK_INFO_PLAY:
+        return "play";
+      case CEC_DECK_INFO_RECORD:
+        return "record";
+      case CEC_DECK_INFO_PLAY_REVERSE:
+        return "play reverse";
+      case CEC_DECK_INFO_STILL:
+        return "still";
+      case CEC_DECK_INFO_SLOW:
+        return "slow";
+      case CEC_DECK_INFO_SLOW_REVERSE:
+        return "slow reverse";
+      case CEC_DECK_INFO_FAST_FORWARD:
+        return "fast forward";
+      case CEC_DECK_INFO_FAST_REVERSE:
+        return "fast reverse";
+      case CEC_DECK_INFO_NO_MEDIA:
+        return "no media";
+      case CEC_DECK_INFO_STOP:
+        return "stop";
+      case CEC_DECK_INFO_SKIP_FORWARD_WIND:
+        return "info skip forward wind";
+      case CEC_DECK_INFO_SKIP_REVERSE_REWIND:
+        return "info skip reverse rewind";
+      case CEC_DECK_INFO_INDEX_SEARCH_FORWARD:
+        return "info index search forward";
+      case CEC_DECK_INFO_INDEX_SEARCH_REVERSE:
+        return "info index search reverse";
+      case CEC_DECK_INFO_OTHER_STATUS:
+        return "other";
+      case CEC_DECK_INFO_OTHER_STATUS_LG:
+        return "LG other";
+      default:
+        return "unknown";
+      }
+    }
+
+    static const char *ToString(const cec_opcode opcode)
+    {
+      switch (opcode)
+      {
+      case CEC_OPCODE_ACTIVE_SOURCE:
+        return "active source";
+      case CEC_OPCODE_IMAGE_VIEW_ON:
+        return "image view on";
+      case CEC_OPCODE_TEXT_VIEW_ON:
+        return "text view on";
+      case CEC_OPCODE_INACTIVE_SOURCE:
+        return "inactive source";
+      case CEC_OPCODE_REQUEST_ACTIVE_SOURCE:
+        return "request active source";
+      case CEC_OPCODE_ROUTING_CHANGE:
+        return "routing change";
+      case CEC_OPCODE_ROUTING_INFORMATION:
+        return "routing information";
+      case CEC_OPCODE_SET_STREAM_PATH:
+        return "set stream path";
+      case CEC_OPCODE_STANDBY:
+        return "standby";
+      case CEC_OPCODE_RECORD_OFF:
+        return "record off";
+      case CEC_OPCODE_RECORD_ON:
+        return "record on";
+      case CEC_OPCODE_RECORD_STATUS:
+        return "record status";
+      case CEC_OPCODE_RECORD_TV_SCREEN:
+        return "record tv screen";
+      case CEC_OPCODE_CLEAR_ANALOGUE_TIMER:
+        return "clear analogue timer";
+      case CEC_OPCODE_CLEAR_DIGITAL_TIMER:
+        return "clear digital timer";
+      case CEC_OPCODE_CLEAR_EXTERNAL_TIMER:
+        return "clear external timer";
+      case CEC_OPCODE_SET_ANALOGUE_TIMER:
+        return "set analogue timer";
+      case CEC_OPCODE_SET_DIGITAL_TIMER:
+        return "set digital timer";
+      case CEC_OPCODE_SET_EXTERNAL_TIMER:
+        return "set external timer";
+      case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE:
+        return "set timer program title";
+      case CEC_OPCODE_TIMER_CLEARED_STATUS:
+        return "timer cleared status";
+      case CEC_OPCODE_TIMER_STATUS:
+        return "timer status";
+      case CEC_OPCODE_CEC_VERSION:
+        return "cec version";
+      case CEC_OPCODE_GET_CEC_VERSION:
+        return "get cec version";
+      case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS:
+        return "give physical address";
+      case CEC_OPCODE_GET_MENU_LANGUAGE:
+        return "get menu language";
+      case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS:
+        return "report physical address";
+      case CEC_OPCODE_SET_MENU_LANGUAGE:
+        return "set menu language";
+      case CEC_OPCODE_DECK_CONTROL:
+        return "deck control";
+      case CEC_OPCODE_DECK_STATUS:
+        return "deck status";
+      case CEC_OPCODE_GIVE_DECK_STATUS:
+        return "give deck status";
+      case CEC_OPCODE_PLAY:
+        return "play";
+      case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS:
+        return "give tuner status";
+      case CEC_OPCODE_SELECT_ANALOGUE_SERVICE:
+        return "select analogue service";
+      case CEC_OPCODE_SELECT_DIGITAL_SERVICE:
+        return "set digital service";
+      case CEC_OPCODE_TUNER_DEVICE_STATUS:
+        return "tuner device status";
+      case CEC_OPCODE_TUNER_STEP_DECREMENT:
+        return "tuner step decrement";
+      case CEC_OPCODE_TUNER_STEP_INCREMENT:
+        return "tuner step increment";
+      case CEC_OPCODE_DEVICE_VENDOR_ID:
+        return "device vendor id";
+      case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID:
+        return "give device vendor id";
+      case CEC_OPCODE_VENDOR_COMMAND:
+        return "vendor command";
+      case CEC_OPCODE_VENDOR_COMMAND_WITH_ID:
+        return "vendor command with id";
+      case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN:
+        return "vendor remote button down";
+      case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP:
+        return "vendor remote button up";
+      case CEC_OPCODE_SET_OSD_STRING:
+        return "set osd string";
+      case CEC_OPCODE_GIVE_OSD_NAME:
+        return "give osd name";
+      case CEC_OPCODE_SET_OSD_NAME:
+        return "set osd name";
+      case CEC_OPCODE_MENU_REQUEST:
+        return "menu request";
+      case CEC_OPCODE_MENU_STATUS:
+        return "menu status";
+      case CEC_OPCODE_USER_CONTROL_PRESSED:
+        return "user control pressed";
+      case CEC_OPCODE_USER_CONTROL_RELEASE:
+        return "user control release";
+      case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS:
+        return "give device power status";
+      case CEC_OPCODE_REPORT_POWER_STATUS:
+        return "report power status";
+      case CEC_OPCODE_FEATURE_ABORT:
+        return "feature abort";
+      case CEC_OPCODE_ABORT:
+        return "abort";
+      case CEC_OPCODE_GIVE_AUDIO_STATUS:
+        return "give audio status";
+      case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS:
+        return "give audio mode status";
+      case CEC_OPCODE_REPORT_AUDIO_STATUS:
+        return "report audio status";
+      case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE:
+        return "set system audio mode";
+      case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST:
+        return "system audio mode request";
+      case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS:
+        return "system audio mode status";
+      case CEC_OPCODE_SET_AUDIO_RATE:
+        return "set audio rate";
+      case CEC_OPCODE_START_ARC:
+        return "start ARC";
+      case CEC_OPCODE_REPORT_ARC_STARTED:
+        return "report ARC started";
+      case CEC_OPCODE_REPORT_ARC_ENDED:
+        return "report ARC ended";
+      case CEC_OPCODE_REQUEST_ARC_START:
+        return "request ARC start";
+      case CEC_OPCODE_REQUEST_ARC_END:
+        return "request ARC end";
+      case CEC_OPCODE_END_ARC:
+        return "end ARC";
+      case CEC_OPCODE_CDC:
+        return "CDC";
+      case CEC_OPCODE_NONE:
+        return "poll";
+      default:
+        return "UNKNOWN";
+      }
+    }
+
+    static const char *ToString(const cec_system_audio_status mode)
+    {
+      switch(mode)
+      {
+      case CEC_SYSTEM_AUDIO_STATUS_ON:
+        return "on";
+      case CEC_SYSTEM_AUDIO_STATUS_OFF:
+        return "off";
+      default:
+        return "unknown";
+      }
+    }
+
+    static const char *ToString(const cec_audio_status UNUSED(status))
+    {
+      // TODO this is a mask
+      return "TODO";
+    }
+
+    static const char *ToString(const cec_vendor_id vendor)
+    {
+      switch (vendor)
+      {
+      case CEC_VENDOR_SAMSUNG:
+        return "Samsung";
+      case CEC_VENDOR_LG:
+        return "LG";
+      case CEC_VENDOR_PANASONIC:
+        return "Panasonic";
+      case CEC_VENDOR_PIONEER:
+        return "Pioneer";
+      case CEC_VENDOR_ONKYO:
+        return "Onkyo";
+      case CEC_VENDOR_YAMAHA:
+        return "Yamaha";
+      case CEC_VENDOR_PHILIPS:
+        return "Philips";
+      case CEC_VENDOR_SONY:
+        return "Sony";
+      case CEC_VENDOR_TOSHIBA:
+        return "Toshiba";
+      default:
+        return "Unknown";
+      }
+    }
+
+    static const char *ToString(const cec_client_version version)
+    {
+      switch (version)
+      {
+      case CEC_CLIENT_VERSION_PRE_1_5:
+        return "pre-1.5";
+      case CEC_CLIENT_VERSION_1_5_0:
+        return "1.5.0";
+      case CEC_CLIENT_VERSION_1_5_1:
+        return "1.5.1";
+      case CEC_CLIENT_VERSION_1_5_2:
+        return "1.5.2";
+      case CEC_CLIENT_VERSION_1_5_3:
+        return "1.5.3";
+      case CEC_CLIENT_VERSION_1_6_0:
+        return "1.6.0";
+      case CEC_CLIENT_VERSION_1_6_1:
+        return "1.6.1";
+      case CEC_CLIENT_VERSION_1_6_2:
+        return "1.6.2";
+      case CEC_CLIENT_VERSION_1_6_3:
+        return "1.6.3";
+      case CEC_CLIENT_VERSION_1_7_0:
+        return "1.7.0";
+      default:
+        return "Unknown";
+      }
+    }
+
+    static const char *ToString(const cec_server_version version)
+    {
+      switch (version)
+      {
+      case CEC_SERVER_VERSION_PRE_1_5:
+        return "pre-1.5";
+      case CEC_SERVER_VERSION_1_5_0:
+        return "1.5.0";
+      case CEC_SERVER_VERSION_1_5_1:
+        return "1.5.1";
+      case CEC_SERVER_VERSION_1_5_2:
+        return "1.5.2";
+      case CEC_SERVER_VERSION_1_5_3:
+        return "1.5.3";
+      case CEC_SERVER_VERSION_1_6_0:
+        return "1.6.0";
+      case CEC_SERVER_VERSION_1_6_1:
+        return "1.6.1";
+      case CEC_SERVER_VERSION_1_6_2:
+        return "1.6.2";
+      case CEC_SERVER_VERSION_1_6_3:
+        return "1.6.3";
+      case CEC_SERVER_VERSION_1_7_0:
+        return "1.7.0";
+      default:
+        return "Unknown";
+      }
+    }
+  };
+}
index b64cdc709ad6ab22f7a7eb17dac3c2d264e24896..56ece65b08d706d7275b6f04fd696ccd1482511e 100644 (file)
 #include "adapter/USBCECAdapterDetection.h"
 #include "adapter/USBCECAdapterCommunication.h"
 #include "CECProcessor.h"
+#include "CECTypeUtils.h"
 #include "devices/CECAudioSystem.h"
 #include "devices/CECBusDevice.h"
 #include "devices/CECPlaybackDevice.h"
 #include "devices/CECTV.h"
 #include "platform/util/timeutils.h"
 #include "platform/util/StdString.h"
+#include "platform/util/util.h"
 
 #include "CECClient.h"
 
@@ -48,6 +50,7 @@ using namespace std;
 using namespace CEC;
 using namespace PLATFORM;
 
+//TODO replace deprecated constructor in 2.0
 CLibCEC::CLibCEC(const char *UNUSED(strDeviceName), cec_device_type_list UNUSED(types), uint16_t UNUSED(iPhysicalAddress) /* = 0 */) :
     m_iStartTime(GetTimeMs()),
     m_client(NULL)
@@ -55,6 +58,7 @@ CLibCEC::CLibCEC(const char *UNUSED(strDeviceName), cec_device_type_list UNUSED(
   m_cec = new CCECProcessor(this);
 }
 
+//TODO replace deprecated constructor in 2.0
 CLibCEC::CLibCEC(libcec_configuration *UNUSED(configuration)) :
     m_iStartTime(GetTimeMs()),
     m_client(NULL)
@@ -68,8 +72,7 @@ CLibCEC::~CLibCEC(void)
   UnregisterClients();
 
   // delete the adapter connection
-  delete m_cec;
-  m_cec = NULL;
+  DELETE_AND_NULL(m_cec);
 }
 
 bool CLibCEC::Open(const char *strPort, uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */)
@@ -99,12 +102,14 @@ bool CLibCEC::Open(const char *strPort, uint32_t iTimeoutMs /* = CEC_DEFAULT_CON
 
 void CLibCEC::Close(void)
 {
+  if (!m_cec)
+    return;
+
   // unregister all clients
-  UnregisterClients();
+  m_cec->UnregisterClients();
 
   // close the connection
-  if (m_cec)
-    m_cec->Close();
+  m_cec->Close();
 }
 
 int8_t CLibCEC::FindAdapters(cec_adapter *deviceList, uint8_t iBufSize, const char *strDevicePath /* = NULL */)
@@ -353,84 +358,17 @@ bool CLibCEC::GetNextCommand(cec_command *command)
 
 cec_device_type CLibCEC::GetType(cec_logical_address address)
 {
-  switch (address)
-  {
-    case CECDEVICE_AUDIOSYSTEM:
-      return CEC_DEVICE_TYPE_AUDIO_SYSTEM;
-    case CECDEVICE_PLAYBACKDEVICE1:
-    case CECDEVICE_PLAYBACKDEVICE2:
-    case CECDEVICE_PLAYBACKDEVICE3:
-      return CEC_DEVICE_TYPE_PLAYBACK_DEVICE;
-    case CECDEVICE_RECORDINGDEVICE1:
-    case CECDEVICE_RECORDINGDEVICE2:
-    case CECDEVICE_RECORDINGDEVICE3:
-      return CEC_DEVICE_TYPE_RECORDING_DEVICE;
-    case CECDEVICE_TUNER1:
-    case CECDEVICE_TUNER2:
-    case CECDEVICE_TUNER3:
-    case CECDEVICE_TUNER4:
-      return CEC_DEVICE_TYPE_TUNER;
-    case CECDEVICE_TV:
-      return CEC_DEVICE_TYPE_TV;
-    default:
-      return CEC_DEVICE_TYPE_RESERVED;
-  }
+  return CCECTypeUtils::GetType(address);
 }
 
 uint16_t CLibCEC::GetMaskForType(cec_logical_address address)
 {
-  return GetMaskForType(GetType(address));
+  return CCECTypeUtils::GetMaskForType(address);
 }
 
 uint16_t CLibCEC::GetMaskForType(cec_device_type type)
 {
-  switch (type)
-  {
-    case CEC_DEVICE_TYPE_AUDIO_SYSTEM:
-    {
-      cec_logical_addresses addr;
-      addr.Clear();
-      addr.Set(CECDEVICE_AUDIOSYSTEM);
-      return addr.AckMask();
-    }
-    case CEC_DEVICE_TYPE_PLAYBACK_DEVICE:
-    {
-      cec_logical_addresses addr;
-      addr.Clear();
-      addr.Set(CECDEVICE_PLAYBACKDEVICE1);
-      addr.Set(CECDEVICE_PLAYBACKDEVICE2);
-      addr.Set(CECDEVICE_PLAYBACKDEVICE3);
-      return addr.AckMask();
-    }
-    case CEC_DEVICE_TYPE_RECORDING_DEVICE:
-    {
-      cec_logical_addresses addr;
-      addr.Clear();
-      addr.Set(CECDEVICE_RECORDINGDEVICE1);
-      addr.Set(CECDEVICE_RECORDINGDEVICE2);
-      addr.Set(CECDEVICE_RECORDINGDEVICE3);
-      return addr.AckMask();
-    }
-    case CEC_DEVICE_TYPE_TUNER:
-    {
-      cec_logical_addresses addr;
-      addr.Clear();
-      addr.Set(CECDEVICE_TUNER1);
-      addr.Set(CECDEVICE_TUNER2);
-      addr.Set(CECDEVICE_TUNER3);
-      addr.Set(CECDEVICE_TUNER4);
-      return addr.AckMask();
-    }
-    case CEC_DEVICE_TYPE_TV:
-    {
-      cec_logical_addresses addr;
-      addr.Clear();
-      addr.Set(CECDEVICE_TV);
-      return addr.AckMask();
-    }
-    default:
-      return 0;
-  }
+  return CCECTypeUtils::GetMaskForType(type);
 }
 
 bool CLibCEC::IsValidPhysicalAddress(uint16_t iPhysicalAddress)
@@ -441,420 +379,67 @@ bool CLibCEC::IsValidPhysicalAddress(uint16_t iPhysicalAddress)
 
 const char *CLibCEC::ToString(const cec_device_type type)
 {
-  switch (type)
-  {
-  case CEC_DEVICE_TYPE_AUDIO_SYSTEM:
-    return "audio system";
-  case CEC_DEVICE_TYPE_PLAYBACK_DEVICE:
-    return "playback device";
-  case CEC_DEVICE_TYPE_RECORDING_DEVICE:
-      return "recording device";
-  case CEC_DEVICE_TYPE_RESERVED:
-      return "reserved";
-  case CEC_DEVICE_TYPE_TUNER:
-      return "tuner";
-  case CEC_DEVICE_TYPE_TV:
-      return "TV";
-  default:
-    return "unknown";
-  }
+  return CCECTypeUtils::ToString(type);
 }
 
 const char *CLibCEC::ToString(const cec_menu_state state)
 {
-  switch (state)
-  {
-  case CEC_MENU_STATE_ACTIVATED:
-    return "activated";
-  case CEC_MENU_STATE_DEACTIVATED:
-    return "deactivated";
-  default:
-    return "unknown";
-  }
+  return CCECTypeUtils::ToString(state);
 }
 
 const char *CLibCEC::ToString(const cec_version version)
 {
-  switch (version)
-  {
-  case CEC_VERSION_1_2:
-    return "1.2";
-  case CEC_VERSION_1_2A:
-    return "1.2a";
-  case CEC_VERSION_1_3:
-    return "1.3";
-  case CEC_VERSION_1_3A:
-    return "1.3a";
-  case CEC_VERSION_1_4:
-    return "1.4";
-  default:
-    return "unknown";
-  }
+  return CCECTypeUtils::ToString(version);
 }
 
 const char *CLibCEC::ToString(const cec_power_status status)
 {
-  switch (status)
-  {
-  case CEC_POWER_STATUS_ON:
-    return "on";
-  case CEC_POWER_STATUS_STANDBY:
-    return "standby";
-  case CEC_POWER_STATUS_IN_TRANSITION_ON_TO_STANDBY:
-    return "in transition from on to standby";
-  case CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON:
-    return "in transition from standby to on";
-  default:
-    return "unknown";
-  }
+  return CCECTypeUtils::ToString(status);
 }
 
 const char *CLibCEC::ToString(const cec_logical_address address)
 {
-  switch(address)
-  {
-  case CECDEVICE_AUDIOSYSTEM:
-    return "Audio";
-  case CECDEVICE_BROADCAST:
-    return "Broadcast";
-  case CECDEVICE_FREEUSE:
-    return "Free use";
-  case CECDEVICE_PLAYBACKDEVICE1:
-    return "Playback 1";
-  case CECDEVICE_PLAYBACKDEVICE2:
-    return "Playback 2";
-  case CECDEVICE_PLAYBACKDEVICE3:
-    return "Playback 3";
-  case CECDEVICE_RECORDINGDEVICE1:
-    return "Recorder 1";
-  case CECDEVICE_RECORDINGDEVICE2:
-    return "Recorder 2";
-  case CECDEVICE_RECORDINGDEVICE3:
-    return "Recorder 3";
-  case CECDEVICE_RESERVED1:
-    return "Reserved 1";
-  case CECDEVICE_RESERVED2:
-    return "Reserved 2";
-  case CECDEVICE_TUNER1:
-    return "Tuner 1";
-  case CECDEVICE_TUNER2:
-    return "Tuner 2";
-  case CECDEVICE_TUNER3:
-    return "Tuner 3";
-  case CECDEVICE_TUNER4:
-    return "Tuner 4";
-  case CECDEVICE_TV:
-    return "TV";
-  default:
-    return "unknown";
-  }
+  return CCECTypeUtils::ToString(address);
 }
 
 const char *CLibCEC::ToString(const cec_deck_control_mode mode)
 {
-  switch (mode)
-  {
-  case CEC_DECK_CONTROL_MODE_SKIP_FORWARD_WIND:
-    return "skip forward wind";
-  case CEC_DECK_CONTROL_MODE_EJECT:
-    return "eject";
-  case CEC_DECK_CONTROL_MODE_SKIP_REVERSE_REWIND:
-    return "reverse rewind";
-  case CEC_DECK_CONTROL_MODE_STOP:
-    return "stop";
-  default:
-    return "unknown";
-  }
+  return CCECTypeUtils::ToString(mode);
 }
 
 const char *CLibCEC::ToString(const cec_deck_info status)
 {
-  switch (status)
-  {
-  case CEC_DECK_INFO_PLAY:
-    return "play";
-  case CEC_DECK_INFO_RECORD:
-    return "record";
-  case CEC_DECK_INFO_PLAY_REVERSE:
-    return "play reverse";
-  case CEC_DECK_INFO_STILL:
-    return "still";
-  case CEC_DECK_INFO_SLOW:
-    return "slow";
-  case CEC_DECK_INFO_SLOW_REVERSE:
-    return "slow reverse";
-  case CEC_DECK_INFO_FAST_FORWARD:
-    return "fast forward";
-  case CEC_DECK_INFO_FAST_REVERSE:
-    return "fast reverse";
-  case CEC_DECK_INFO_NO_MEDIA:
-    return "no media";
-  case CEC_DECK_INFO_STOP:
-    return "stop";
-  case CEC_DECK_INFO_SKIP_FORWARD_WIND:
-    return "info skip forward wind";
-  case CEC_DECK_INFO_SKIP_REVERSE_REWIND:
-    return "info skip reverse rewind";
-  case CEC_DECK_INFO_INDEX_SEARCH_FORWARD:
-    return "info index search forward";
-  case CEC_DECK_INFO_INDEX_SEARCH_REVERSE:
-    return "info index search reverse";
-  case CEC_DECK_INFO_OTHER_STATUS:
-    return "other";
-  case CEC_DECK_INFO_OTHER_STATUS_LG:
-    return "LG other";
-  default:
-    return "unknown";
-  }
+  return CCECTypeUtils::ToString(status);
 }
 
 const char *CLibCEC::ToString(const cec_opcode opcode)
 {
-  switch (opcode)
-  {
-  case CEC_OPCODE_ACTIVE_SOURCE:
-    return "active source";
-  case CEC_OPCODE_IMAGE_VIEW_ON:
-    return "image view on";
-  case CEC_OPCODE_TEXT_VIEW_ON:
-    return "text view on";
-  case CEC_OPCODE_INACTIVE_SOURCE:
-    return "inactive source";
-  case CEC_OPCODE_REQUEST_ACTIVE_SOURCE:
-    return "request active source";
-  case CEC_OPCODE_ROUTING_CHANGE:
-    return "routing change";
-  case CEC_OPCODE_ROUTING_INFORMATION:
-    return "routing information";
-  case CEC_OPCODE_SET_STREAM_PATH:
-    return "set stream path";
-  case CEC_OPCODE_STANDBY:
-    return "standby";
-  case CEC_OPCODE_RECORD_OFF:
-    return "record off";
-  case CEC_OPCODE_RECORD_ON:
-    return "record on";
-  case CEC_OPCODE_RECORD_STATUS:
-    return "record status";
-  case CEC_OPCODE_RECORD_TV_SCREEN:
-    return "record tv screen";
-  case CEC_OPCODE_CLEAR_ANALOGUE_TIMER:
-    return "clear analogue timer";
-  case CEC_OPCODE_CLEAR_DIGITAL_TIMER:
-    return "clear digital timer";
-  case CEC_OPCODE_CLEAR_EXTERNAL_TIMER:
-    return "clear external timer";
-  case CEC_OPCODE_SET_ANALOGUE_TIMER:
-    return "set analogue timer";
-  case CEC_OPCODE_SET_DIGITAL_TIMER:
-    return "set digital timer";
-  case CEC_OPCODE_SET_EXTERNAL_TIMER:
-    return "set external timer";
-  case CEC_OPCODE_SET_TIMER_PROGRAM_TITLE:
-    return "set timer program title";
-  case CEC_OPCODE_TIMER_CLEARED_STATUS:
-    return "timer cleared status";
-  case CEC_OPCODE_TIMER_STATUS:
-    return "timer status";
-  case CEC_OPCODE_CEC_VERSION:
-    return "cec version";
-  case CEC_OPCODE_GET_CEC_VERSION:
-    return "get cec version";
-  case CEC_OPCODE_GIVE_PHYSICAL_ADDRESS:
-    return "give physical address";
-  case CEC_OPCODE_GET_MENU_LANGUAGE:
-    return "get menu language";
-  case CEC_OPCODE_REPORT_PHYSICAL_ADDRESS:
-    return "report physical address";
-  case CEC_OPCODE_SET_MENU_LANGUAGE:
-    return "set menu language";
-  case CEC_OPCODE_DECK_CONTROL:
-    return "deck control";
-  case CEC_OPCODE_DECK_STATUS:
-    return "deck status";
-  case CEC_OPCODE_GIVE_DECK_STATUS:
-    return "give deck status";
-  case CEC_OPCODE_PLAY:
-    return "play";
-  case CEC_OPCODE_GIVE_TUNER_DEVICE_STATUS:
-    return "give tuner status";
-  case CEC_OPCODE_SELECT_ANALOGUE_SERVICE:
-    return "select analogue service";
-  case CEC_OPCODE_SELECT_DIGITAL_SERVICE:
-    return "set digital service";
-  case CEC_OPCODE_TUNER_DEVICE_STATUS:
-    return "tuner device status";
-  case CEC_OPCODE_TUNER_STEP_DECREMENT:
-    return "tuner step decrement";
-  case CEC_OPCODE_TUNER_STEP_INCREMENT:
-    return "tuner step increment";
-  case CEC_OPCODE_DEVICE_VENDOR_ID:
-    return "device vendor id";
-  case CEC_OPCODE_GIVE_DEVICE_VENDOR_ID:
-    return "give device vendor id";
-  case CEC_OPCODE_VENDOR_COMMAND:
-    return "vendor command";
-  case CEC_OPCODE_VENDOR_COMMAND_WITH_ID:
-    return "vendor command with id";
-  case CEC_OPCODE_VENDOR_REMOTE_BUTTON_DOWN:
-    return "vendor remote button down";
-  case CEC_OPCODE_VENDOR_REMOTE_BUTTON_UP:
-    return "vendor remote button up";
-  case CEC_OPCODE_SET_OSD_STRING:
-    return "set osd string";
-  case CEC_OPCODE_GIVE_OSD_NAME:
-    return "give osd name";
-  case CEC_OPCODE_SET_OSD_NAME:
-    return "set osd name";
-  case CEC_OPCODE_MENU_REQUEST:
-    return "menu request";
-  case CEC_OPCODE_MENU_STATUS:
-    return "menu status";
-  case CEC_OPCODE_USER_CONTROL_PRESSED:
-    return "user control pressed";
-  case CEC_OPCODE_USER_CONTROL_RELEASE:
-    return "user control release";
-  case CEC_OPCODE_GIVE_DEVICE_POWER_STATUS:
-    return "give device power status";
-  case CEC_OPCODE_REPORT_POWER_STATUS:
-    return "report power status";
-  case CEC_OPCODE_FEATURE_ABORT:
-    return "feature abort";
-  case CEC_OPCODE_ABORT:
-    return "abort";
-  case CEC_OPCODE_GIVE_AUDIO_STATUS:
-    return "give audio status";
-  case CEC_OPCODE_GIVE_SYSTEM_AUDIO_MODE_STATUS:
-    return "give audio mode status";
-  case CEC_OPCODE_REPORT_AUDIO_STATUS:
-    return "report audio status";
-  case CEC_OPCODE_SET_SYSTEM_AUDIO_MODE:
-    return "set system audio mode";
-  case CEC_OPCODE_SYSTEM_AUDIO_MODE_REQUEST:
-    return "system audio mode request";
-  case CEC_OPCODE_SYSTEM_AUDIO_MODE_STATUS:
-    return "system audio mode status";
-  case CEC_OPCODE_SET_AUDIO_RATE:
-    return "set audio rate";
-  case CEC_OPCODE_START_ARC:
-    return "start ARC";
-  case CEC_OPCODE_REPORT_ARC_STARTED:
-    return "report ARC started";
-  case CEC_OPCODE_REPORT_ARC_ENDED:
-    return "report ARC ended";
-  case CEC_OPCODE_REQUEST_ARC_START:
-    return "request ARC start";
-  case CEC_OPCODE_REQUEST_ARC_END:
-    return "request ARC end";
-  case CEC_OPCODE_END_ARC:
-    return "end ARC";
-  case CEC_OPCODE_CDC:
-    return "CDC";
-  case CEC_OPCODE_NONE:
-    return "poll";
-  default:
-    return "UNKNOWN";
-  }
+  return CCECTypeUtils::ToString(opcode);
 }
 
 const char *CLibCEC::ToString(const cec_system_audio_status mode)
 {
-  switch(mode)
-  {
-  case CEC_SYSTEM_AUDIO_STATUS_ON:
-    return "on";
-  case CEC_SYSTEM_AUDIO_STATUS_OFF:
-    return "off";
-  default:
-    return "unknown";
-  }
+  return CCECTypeUtils::ToString(mode);
 }
 
-const char *CLibCEC::ToString(const cec_audio_status UNUSED(status))
+const char *CLibCEC::ToString(const cec_audio_status status)
 {
-  // TODO this is a mask
-  return "TODO";
+  return CCECTypeUtils::ToString(status);
 }
 
 const char *CLibCEC::ToString(const cec_vendor_id vendor)
 {
-  switch (vendor)
-  {
-  case CEC_VENDOR_SAMSUNG:
-    return "Samsung";
-  case CEC_VENDOR_LG:
-    return "LG";
-  case CEC_VENDOR_PANASONIC:
-    return "Panasonic";
-  case CEC_VENDOR_PIONEER:
-    return "Pioneer";
-  case CEC_VENDOR_ONKYO:
-    return "Onkyo";
-  case CEC_VENDOR_YAMAHA:
-    return "Yamaha";
-  case CEC_VENDOR_PHILIPS:
-    return "Philips";
-  case CEC_VENDOR_SONY:
-    return "Sony";
-  case CEC_VENDOR_TOSHIBA:
-    return "Toshiba";
-  default:
-    return "Unknown";
-  }
+  return CCECTypeUtils::ToString(vendor);
 }
 
 const char *CLibCEC::ToString(const cec_client_version version)
 {
-  switch (version)
-  {
-  case CEC_CLIENT_VERSION_PRE_1_5:
-    return "pre-1.5";
-  case CEC_CLIENT_VERSION_1_5_0:
-    return "1.5.0";
-  case CEC_CLIENT_VERSION_1_5_1:
-    return "1.5.1";
-  case CEC_CLIENT_VERSION_1_5_2:
-    return "1.5.2";
-  case CEC_CLIENT_VERSION_1_5_3:
-    return "1.5.3";
-  case CEC_CLIENT_VERSION_1_6_0:
-    return "1.6.0";
-  case CEC_CLIENT_VERSION_1_6_1:
-    return "1.6.1";
-  case CEC_CLIENT_VERSION_1_6_2:
-    return "1.6.2";
-  case CEC_CLIENT_VERSION_1_6_3:
-    return "1.6.3";
-  default:
-    return "Unknown";
-  }
+  return CCECTypeUtils::ToString(version);
 }
 
 const char *CLibCEC::ToString(const cec_server_version version)
 {
-  switch (version)
-  {
-  case CEC_SERVER_VERSION_PRE_1_5:
-    return "pre-1.5";
-  case CEC_SERVER_VERSION_1_5_0:
-    return "1.5.0";
-  case CEC_SERVER_VERSION_1_5_1:
-    return "1.5.1";
-  case CEC_SERVER_VERSION_1_5_2:
-    return "1.5.2";
-  case CEC_SERVER_VERSION_1_5_3:
-    return "1.5.3";
-  case CEC_SERVER_VERSION_1_6_0:
-    return "1.6.0";
-  case CEC_SERVER_VERSION_1_6_1:
-    return "1.6.1";
-  case CEC_SERVER_VERSION_1_6_2:
-    return "1.6.2";
-  case CEC_SERVER_VERSION_1_6_3:
-    return "1.6.3";
-  default:
-    return "Unknown";
-  }
+  return CCECTypeUtils::ToString(version);
 }
 
 void CLibCEC::CheckKeypressTimeout(void)
@@ -932,8 +517,7 @@ void CLibCEC::UnregisterClients(void)
 
   m_clients.clear();
 
-  delete m_client;
-  m_client = NULL;
+  DELETE_AND_NULL(m_client);
 }
 
 void * CECInitialise(libcec_configuration *configuration)
@@ -996,7 +580,7 @@ bool CECStartBootloader(void)
 
 void CECDestroy(CEC::ICECAdapter *instance)
 {
-  delete instance;
+  DELETE_AND_NULL(instance);
 }
 
 bool CLibCEC::GetDeviceInformation(const char *strPort, libcec_configuration *config, uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */)
index 19f5e6f7a2dc03fd300dccbea40c68f1c3b32c5f..30637f2920a091df0e365a4486d8a5fa62906b50 100644 (file)
@@ -29,7 +29,11 @@ libcec_la_SOURCES = CECProcessor.cpp \
                     implementations/SLCommandHandler.cpp \
                     implementations/VLCommandHandler.cpp \
                     implementations/RLCommandHandler.cpp \
-                    platform/posix/serialport.cpp
-
+                    platform/posix/serialport.cpp \
+                    platform/posix/serversocket.cpp\
+                    platform/posix/os-edid.cpp \
+                    platform/adl/adl-edid.cpp \
+                    platform/nvidia/nv-edid.cpp
 libcec_la_LDFLAGS = @LIBS@ -version-info @VERSION@
 libcec_la_CPPFLAGS = -I@abs_top_srcdir@/include
index bdc24126f7a2b2099205d07b7a58ee2385a14e14..6642ac838567a35dd0b0fc86cd0e3aa27028c968 100644 (file)
 #include "USBCECAdapterCommands.h"
 #include "../LibCEC.h"
 #include "../CECProcessor.h"
+#include "../CECTypeUtils.h"
 
 using namespace CEC;
 using namespace PLATFORM;
 
 #define LIB_CEC     m_comm->m_callback->GetLib()
-#define ToString(p) LIB_CEC->ToString(p)
+#define ToString(p) CCECTypeUtils::ToString(p)
 
 CUSBCECAdapterCommands::CUSBCECAdapterCommands(CUSBCECAdapterCommunication *comm) :
     m_comm(comm),
@@ -65,6 +66,7 @@ cec_datapacket CUSBCECAdapterCommands::RequestSetting(cec_adapter_messagecode ms
     retVal.Shift(2); // shift out start and msgcode
     retVal.size -= 1; // remove end
   }
+
   delete message;
   return retVal;
 }
index d961240fc13c3ca282c53a5c41545792505f004c..70feae9c70c1795e835b7390401cf12c4501921d 100644 (file)
@@ -106,6 +106,11 @@ namespace CEC
      */
     uint32_t RequestBuildDate(void);
 
+    /*!
+     * @return The persisted build date.
+     */
+    uint32_t GetPersistedBuildDate(void) const { return m_iBuildDate; };
+
   private:
     /*!
      * @brief Reads all settings from the eeprom.
index 801ebc509550fda47fe1b80dff0dce9cca77befc..45be4a6c739855de665581bf2802c085d1365be7 100644 (file)
 #include "USBCECAdapterMessageQueue.h"
 #include "../platform/sockets/serialport.h"
 #include "../platform/util/timeutils.h"
+#include "../platform/util/util.h"
+#include "../platform/util/edid.h"
+#include "../platform/adl/adl-edid.h"
+#include "../platform/nvidia/nv-edid.h"
 #include "../LibCEC.h"
 #include "../CECProcessor.h"
 
@@ -65,14 +69,22 @@ CUSBCECAdapterCommunication::CUSBCECAdapterCommunication(IAdapterCommunicationCa
   for (unsigned int iPtr = CECDEVICE_TV; iPtr < CECDEVICE_BROADCAST; iPtr++)
     m_bWaitingForAck[iPtr] = false;
   m_port = new CSerialPort(strPort, iBaudRate);
+  m_commands = new CUSBCECAdapterCommands(this);
 }
 
 CUSBCECAdapterCommunication::~CUSBCECAdapterCommunication(void)
 {
   Close();
-  delete m_commands;
-  delete m_adapterMessageQueue;
-  delete m_port;
+  DELETE_AND_NULL(m_commands);
+  DELETE_AND_NULL(m_adapterMessageQueue);
+  DELETE_AND_NULL(m_port);
+}
+
+void CUSBCECAdapterCommunication::ResetMessageQueue(void)
+{
+  DELETE_AND_NULL(m_adapterMessageQueue);
+  m_adapterMessageQueue = new CCECAdapterMessageQueue(this);
+  m_adapterMessageQueue->CreateThread();
 }
 
 bool CUSBCECAdapterCommunication::Open(uint32_t iTimeoutMs /* = CEC_DEFAULT_CONNECT_TIMEOUT */, bool bSkipChecks /* = false */, bool bStartListening /* = true */)
@@ -95,15 +107,7 @@ bool CUSBCECAdapterCommunication::Open(uint32_t iTimeoutMs /* = CEC_DEFAULT_CONN
       return true;
     }
 
-    /* adapter commands */
-    if (!m_commands)
-      m_commands = new CUSBCECAdapterCommands(this);
-
-    if (!m_adapterMessageQueue)
-    {
-      m_adapterMessageQueue = new CCECAdapterMessageQueue(this);
-      m_adapterMessageQueue->CreateThread();
-    }
+    ResetMessageQueue();
 
     /* try to open the connection */
     CStdString strError;
@@ -144,6 +148,9 @@ bool CUSBCECAdapterCommunication::Open(uint32_t iTimeoutMs /* = CEC_DEFAULT_CONN
     ClearInputBytes();
   }
 
+  // always start by setting the ackmask to 0, to clear previous values
+  SetAckMask(0);
+
   if (!CreateThread())
   {
     bConnectionOpened = false;
@@ -195,10 +202,7 @@ void CUSBCECAdapterCommunication::Close(void)
   m_adapterMessageQueue->Clear();
 
   /* stop and delete the ping thread */
-  if (m_pingThread)
-    m_pingThread->StopThread(0);
-  delete m_pingThread;
-  m_pingThread = NULL;
+  DELETE_AND_NULL(m_pingThread);
 
   /* close and delete the com port connection */
   if (m_port)
@@ -495,11 +499,15 @@ bool CUSBCECAdapterCommunication::StartBootloader(void)
 
 bool CUSBCECAdapterCommunication::SetAckMask(uint16_t iMask)
 {
-  if (m_iAckMask == iMask)
-    return true;
+  {
+    CLockObject lock(m_mutex);
+    if (m_iAckMask == iMask)
+      return true;
+  }
 
   if (IsOpen() && m_commands->SetAckMask(iMask))
   {
+    CLockObject lock(m_mutex);
     m_iAckMask = iMask;
     return true;
   }
@@ -510,6 +518,7 @@ bool CUSBCECAdapterCommunication::SetAckMask(uint16_t iMask)
 
 uint16_t CUSBCECAdapterCommunication::GetAckMask(void)
 {
+  CLockObject lock(m_mutex);
   return m_iAckMask;
 }
 
@@ -520,12 +529,12 @@ bool CUSBCECAdapterCommunication::PingAdapter(void)
 
 uint16_t CUSBCECAdapterCommunication::GetFirmwareVersion(void)
 {
-  return IsOpen() ? m_commands->GetFirmwareVersion() : CEC_FW_VERSION_UNKNOWN;
+  return m_commands ? m_commands->GetFirmwareVersion() : CEC_FW_VERSION_UNKNOWN;
 }
 
 uint32_t CUSBCECAdapterCommunication::GetFirmwareBuildDate(void)
 {
-  return IsOpen() ? m_commands->RequestBuildDate() : 0;
+  return IsOpen() ? m_commands->RequestBuildDate() : m_commands ? m_commands->GetPersistedBuildDate() : 0;
 }
 
 bool CUSBCECAdapterCommunication::IsRunningLatestFirmware(void)
@@ -554,6 +563,42 @@ bool CUSBCECAdapterCommunication::SetControlledMode(bool controlled)
   return IsOpen() ? m_commands->SetControlledMode(controlled) : false;
 }
 
+uint16_t CUSBCECAdapterCommunication::GetPhysicalAddress(void)
+{
+  uint16_t iPA(0);
+
+  // try to get the PA from ADL
+#if defined(HAS_ADL_EDID_PARSER)
+  {
+    LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s - trying to get the physical address via ADL", __FUNCTION__);
+    CADLEdidParser adl;
+    iPA = adl.GetPhysicalAddress();
+    LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s - ADL returned physical address %04x", __FUNCTION__, iPA);
+  }
+#endif
+
+  // try to get the PA from the nvidia driver
+#if defined(HAS_NVIDIA_EDID_PARSER)
+  if (iPA == 0)
+  {
+    LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s - trying to get the physical address via nvidia driver", __FUNCTION__);
+    CNVEdidParser nv;
+    iPA = nv.GetPhysicalAddress();
+    LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s - nvidia driver returned physical address %04x", __FUNCTION__, iPA);
+  }
+#endif
+
+  // try to get the PA from the OS
+  if (iPA == 0)
+  {
+    LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s - trying to get the physical address from the OS", __FUNCTION__);
+    iPA = CEDIDParser::GetPhysicalAddress();
+    LIB_CEC->AddLog(CEC_LOG_DEBUG, "%s - OS returned physical address %04x", __FUNCTION__, iPA);
+  }
+
+  return iPA;
+}
+
 void *CAdapterPingThread::Process(void)
 {
   while (!IsStopped())
index 7409e86d874b002b356a16a39cdea1b3931f2e70..948f2de9c19d5b067412945995b6d91f1234287d 100644 (file)
@@ -82,7 +82,7 @@ namespace CEC
     bool PersistConfiguration(const libcec_configuration &configuration);
     bool GetConfiguration(libcec_configuration &configuration);
     CStdString GetPortName(void);
-    uint16_t GetPhysicalAddress(void) { return 0; }
+    uint16_t GetPhysicalAddress(void);
     bool SetControlledMode(bool controlled);
     ///}
 
@@ -157,6 +157,11 @@ namespace CEC
      */
     void MarkAsWaiting(const cec_logical_address dest);
 
+    /*!
+     * @brief Clear and reset the message queue.
+     */
+    void ResetMessageQueue(void);
+
     PLATFORM::ISocket *                          m_port;                 /**< the com port connection */
     PLATFORM::CMutex                             m_mutex;                /**< mutex for changes in this class */
     uint8_t                                      m_iLineTimeout;         /**< the current line timeout on the CEC line */
index 45b348c8752af10aed323f993fc118fd918a6c45..847115abcb1e6f58e3ce875ded4453c98c2906a0 100644 (file)
@@ -113,7 +113,7 @@ bool CCECAdapterMessageQueueEntry::IsResponse(const CCECAdapterMessage &msg)
 {
   cec_adapter_messagecode msgCode = msg.Message();
   return msgCode == MessageCode() ||
-         msgCode == MSGCODE_TIMEOUT_ERROR ||
+         (m_message->IsTranmission() && msgCode == MSGCODE_TIMEOUT_ERROR) ||
          msgCode == MSGCODE_COMMAND_ACCEPTED ||
          msgCode == MSGCODE_COMMAND_REJECTED ||
          (m_message->IsTranmission() && msgCode == MSGCODE_HIGH_ERROR) ||
index d3c674c5265f57c321fd65db0f853d0a3f4f716c..7824451c86f1b963191cd6b04df866e4a0843c69 100644 (file)
 #include "../CECProcessor.h"
 #include "../implementations/CECCommandHandler.h"
 #include "../LibCEC.h"
+#include "../CECTypeUtils.h"
 
 using namespace CEC;
 using namespace PLATFORM;
 
 #define LIB_CEC     m_processor->GetLib()
-#define ToString(p) LIB_CEC->ToString(p)
+#define ToString(p) CCECTypeUtils::ToString(p)
 
 CCECAudioSystem::CCECAudioSystem(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) :
     CCECBusDevice(processor, address, iPhysicalAddress),
index b192391906607f0da79ea1cb377aa3aa375256b5..8f966a233194dd748e76a1a43c1b85263ca1a225 100644 (file)
@@ -37,7 +37,9 @@
 #include "../implementations/SLCommandHandler.h"
 #include "../implementations/VLCommandHandler.h"
 #include "../LibCEC.h"
+#include "../CECTypeUtils.h"
 #include "../platform/util/timeutils.h"
+#include "../platform/util/util.h"
 
 #include "CECAudioSystem.h"
 #include "CECPlaybackDevice.h"
@@ -50,7 +52,7 @@ using namespace CEC;
 using namespace PLATFORM;
 
 #define LIB_CEC     m_processor->GetLib()
-#define ToString(p) LIB_CEC->ToString(p)
+#define ToString(p) CCECTypeUtils::ToString(p)
 
 CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogicalAddress, uint16_t iPhysicalAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) :
   m_type                  (CEC_DEVICE_TYPE_RESERVED),
@@ -83,7 +85,7 @@ CCECBusDevice::CCECBusDevice(CCECProcessor *processor, cec_logical_address iLogi
 
 CCECBusDevice::~CCECBusDevice(void)
 {
-  delete m_handler;
+  DELETE_AND_NULL(m_handler);
 }
 
 bool CCECBusDevice::ReplaceHandler(bool bActivateSource /* = true */)
@@ -105,7 +107,7 @@ bool CCECBusDevice::ReplaceHandler(bool bActivateSource /* = true */)
       if (CCECCommandHandler::HasSpecificHandler(m_vendor))
       {
         LIB_CEC->AddLog(CEC_LOG_DEBUG, "replacing the command handler for device '%s' (%x)", GetLogicalAddressName(), GetLogicalAddress());
-        delete m_handler;
+        DELETE_AND_NULL(m_handler);
 
         switch (m_vendor)
         {
@@ -131,10 +133,14 @@ bool CCECBusDevice::ReplaceHandler(bool bActivateSource /* = true */)
 
   if (bInitHandler)
   {
-    m_handler->InitHandler();
+    CCECBusDevice *primary = GetProcessor()->GetPrimaryDevice();
+    if (primary->GetLogicalAddress() != CECDEVICE_UNREGISTERED)
+    {
+      m_handler->InitHandler();
 
-    if (bActivateSource && IsHandledByLibCEC() && IsActiveSource())
-      m_handler->ActivateSource();
+      if (bActivateSource && IsHandledByLibCEC() && IsActiveSource())
+        m_handler->ActivateSource();
+    }
   }
 
   MarkReady();
@@ -946,15 +952,15 @@ bool CCECBusDevice::TransmitActiveSource(void)
       LIB_CEC->AddLog(CEC_LOG_DEBUG, "<< %s (%X) is not the active source", GetLogicalAddressName(), m_iLogicalAddress);
   }
 
+  bool bActiveSourceSent(false);
   if (bSendActiveSource)
   {
     MarkBusy();
-    m_handler->TransmitActiveSource(m_iLogicalAddress, m_iPhysicalAddress);
+    bActiveSourceSent = m_handler->TransmitActiveSource(m_iLogicalAddress, m_iPhysicalAddress);
     MarkReady();
-    return true;
   }
 
-  return false;
+  return bActiveSourceSent;
 }
 
 bool CCECBusDevice::TransmitImageViewOn(void)
@@ -968,10 +974,11 @@ bool CCECBusDevice::TransmitImageViewOn(void)
     }
   }
 
+  bool bImageViewOnSent(false);
   MarkBusy();
-  m_handler->TransmitImageViewOn(m_iLogicalAddress, CECDEVICE_TV);
+  bImageViewOnSent = m_handler->TransmitImageViewOn(m_iLogicalAddress, CECDEVICE_TV);
   MarkReady();
-  return true;
+  return bImageViewOnSent;
 }
 
 bool CCECBusDevice::TransmitInactiveSource(void)
index d1ac742c0ec39d4673c7dd343ea327fdffb3a014..1beed4f37221cdfdce1e74127b07c377afcf7198 100644 (file)
 #include "../implementations/CECCommandHandler.h"
 #include "../CECProcessor.h"
 #include "../LibCEC.h"
+#include "../CECTypeUtils.h"
 
 using namespace CEC;
 using namespace PLATFORM;
 
-#define ToString(p) m_processor->GetLib()->ToString(p)
+#define ToString(p) CCECTypeUtils::ToString(p)
 
 CCECPlaybackDevice::CCECPlaybackDevice(CCECProcessor *processor, cec_logical_address address, uint16_t iPhysicalAddress /* = CEC_INVALID_PHYSICAL_ADDRESS */) :
     CCECBusDevice(processor, address, iPhysicalAddress),
index 40d7ec37425a26ded517d2c96f3829c2a62ccb8b..a240c9086739cc343e3e25354c5750d7acaedbfd 100644 (file)
 #include "../CECClient.h"
 #include "../CECProcessor.h"
 #include "../LibCEC.h"
+#include "../CECTypeUtils.h"
+#include "../platform/util/util.h"
 
 using namespace CEC;
 using namespace std;
 using namespace PLATFORM;
 
 #define LIB_CEC     m_busDevice->GetProcessor()->GetLib()
-#define ToString(p) LIB_CEC->ToString(p)
+#define ToString(p) CCECTypeUtils::ToString(p)
 
 CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice) :
     m_busDevice(busDevice),
@@ -54,13 +56,14 @@ CCECCommandHandler::CCECCommandHandler(CCECBusDevice *busDevice) :
     m_bHandlerInited(false),
     m_bOPTSendDeckStatusUpdateOnActiveSource(false),
     m_vendorId(CEC_VENDOR_UNKNOWN),
-    m_waitForResponse(new CWaitForResponse)
+    m_waitForResponse(new CWaitForResponse),
+    m_bActiveSourcePending(false)
 {
 }
 
 CCECCommandHandler::~CCECCommandHandler(void)
 {
-  delete m_waitForResponse;
+  DELETE_AND_NULL(m_waitForResponse);
 }
 
 bool CCECCommandHandler::HandleCommand(const cec_command &command)
@@ -193,6 +196,10 @@ bool CCECCommandHandler::HandleCommand(const cec_command &command)
   case CEC_OPCODE_VENDOR_COMMAND:
     HandleVendorCommand(command);
     break;
+  case CEC_OPCODE_PLAY:
+    // libCEC (currently) doesn't need to do anything with this, since player applications handle it
+    // but it should not respond with a feature abort
+    break;
   default:
     bHandled = false;
     break;
@@ -1054,16 +1061,33 @@ bool CCECCommandHandler::ActivateSource(void)
   if (m_busDevice->IsActiveSource() &&
     m_busDevice->IsHandledByLibCEC())
   {
+    {
+      CLockObject lock(m_mutex);
+      m_bActiveSourcePending = false;
+    }
+
     m_busDevice->SetPowerStatus(CEC_POWER_STATUS_ON);
     m_busDevice->SetMenuState(CEC_MENU_STATE_ACTIVATED);
 
-    m_busDevice->TransmitImageViewOn();
-    m_busDevice->TransmitActiveSource();
-    m_busDevice->TransmitMenuState(CECDEVICE_TV);
+    bool bActiveSourceFailed = !m_busDevice->TransmitImageViewOn() ||
+                               !m_busDevice->TransmitActiveSource() ||
+                               !m_busDevice->TransmitMenuState(CECDEVICE_TV);
+
+    if (!bActiveSourceFailed)
+    {
+      CCECPlaybackDevice *playbackDevice = m_busDevice->AsPlaybackDevice();
+      if (playbackDevice && SendDeckStatusUpdateOnActiveSource())
+        bActiveSourceFailed = !playbackDevice->TransmitDeckStatus(CECDEVICE_TV);
+    }
+
+    if (bActiveSourceFailed)
+    {
+      LIB_CEC->AddLog(CEC_LOG_DEBUG, "failed to make '%s' the active source. will retry later", m_busDevice->GetLogicalAddressName());
+      CLockObject lock(m_mutex);
+      m_bActiveSourcePending = true;
+      return false;
+    }
 
-    CCECPlaybackDevice *playbackDevice = m_busDevice->AsPlaybackDevice();
-    if (playbackDevice && SendDeckStatusUpdateOnActiveSource())
-      playbackDevice->TransmitDeckStatus(CECDEVICE_TV);
     m_bHandlerInited = true;
   }
   return true;
@@ -1073,3 +1097,9 @@ void CCECCommandHandler::SignalOpcode(cec_opcode opcode)
 {
   m_waitForResponse->Received(opcode);
 }
+
+bool CCECCommandHandler::ActiveSourcePending(void)
+{
+  CLockObject lock(m_mutex);
+  return m_bActiveSourcePending;
+}
index 1bced84ff8fc469b17a004aa70891233913a1f78..3a9bd6f1a3370bcc367bb611183cc2d6f9f691b2 100644 (file)
@@ -162,6 +162,10 @@ namespace CEC
 
     virtual void SignalOpcode(cec_opcode opcode);
 
+    virtual bool ActiveSourcePending(void);
+    virtual bool SupportsDeviceType(const cec_device_type UNUSED(type)) const { return true; };
+    cec_device_type GetReplacementDeviceType(const cec_device_type type) const { return type; }
+
   protected:
     virtual bool HandleActiveSource(const cec_command &command);
     virtual bool HandleDeckControl(const cec_command &command);
@@ -218,5 +222,7 @@ namespace CEC
     bool                                  m_bOPTSendDeckStatusUpdateOnActiveSource;
     cec_vendor_id                         m_vendorId;
     CWaitForResponse                     *m_waitForResponse;
+    bool                                  m_bActiveSourcePending;
+    PLATFORM::CMutex                      m_mutex;
   };
 };
index 9643ee50f5f4c4bbdc339c342936317d81a8e5b9..b913c322be41e4ab17fa2af264c02f6db0fe25a0 100644 (file)
@@ -42,14 +42,6 @@ CRLCommandHandler::CRLCommandHandler(CCECBusDevice *busDevice) :
     CCECCommandHandler(busDevice)
 {
   m_vendorId = CEC_VENDOR_TOSHIBA;
-  CCECBusDevice *primary = m_processor->GetPrimaryDevice();
-
-  /* imitate Toshiba devices */
-  if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
-  {
-    primary->SetVendorId(CEC_VENDOR_TOSHIBA);
-    primary->ReplaceHandler(false);
-  }
 }
 
 bool CRLCommandHandler::InitHandler(void)
@@ -58,12 +50,21 @@ bool CRLCommandHandler::InitHandler(void)
     return true;
   m_bHandlerInited = true;
 
-  if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
+  CCECBusDevice *primary = m_processor->GetPrimaryDevice();
+  if (primary && primary->GetLogicalAddress() != CECDEVICE_UNREGISTERED)
   {
-    CCECBusDevice *primary = m_processor->GetPrimaryDevice();
+    /* imitate Toshiba devices */
+    if (m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
+    {
+      primary->SetVendorId(CEC_VENDOR_TOSHIBA);
+      primary->ReplaceHandler(false);
+    }
 
-    /* send the vendor id */
-    primary->TransmitVendorID(CECDEVICE_BROADCAST);
+    if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
+    {
+      /* send the vendor id */
+      primary->TransmitVendorID(CECDEVICE_BROADCAST);
+    }
   }
 
   return true;
index f39aef8997f48a504387518e5fccdbc747a24b53..6066d3b9bb21dbf03591d8f7b0a3ef7057ae2bba 100644 (file)
@@ -62,14 +62,6 @@ CSLCommandHandler::CSLCommandHandler(CCECBusDevice *busDevice) :
     m_bActiveSourceSent(false)
 {
   m_vendorId = CEC_VENDOR_LG;
-  CCECBusDevice *primary = m_processor->GetPrimaryDevice();
-
-  /* imitate LG devices */
-  if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
-  {
-    primary->SetVendorId(CEC_VENDOR_LG);
-    primary->ReplaceHandler(false);
-  }
 
   /* LG devices don't always reply to CEC version requests, so just set it to 1.3a */
   m_busDevice->SetCecVersion(CEC_VERSION_1_3A);
@@ -87,16 +79,25 @@ bool CSLCommandHandler::InitHandler(void)
     return true;
   m_bHandlerInited = true;
 
-  if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
+  CCECBusDevice *primary = m_processor->GetPrimaryDevice();
+  if (primary && primary->GetLogicalAddress() != CECDEVICE_UNREGISTERED)
   {
-    CCECBusDevice *primary = m_processor->GetPrimaryDevice();
+    /* imitate LG devices */
+    if (m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
+    {
+      primary->SetVendorId(CEC_VENDOR_LG);
+      primary->ReplaceHandler(false);
+    }
 
-    /* start as 'in transition standby->on' */
-    primary->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
-    primary->TransmitPowerState(CECDEVICE_TV);
+    if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
+    {
+      /* start as 'in transition standby->on' */
+      primary->SetPowerStatus(CEC_POWER_STATUS_IN_TRANSITION_STANDBY_TO_ON);
+      primary->TransmitPowerState(CECDEVICE_TV);
 
-    /* send the vendor id */
-    primary->TransmitVendorID(CECDEVICE_BROADCAST);
+      /* send the vendor id */
+      primary->TransmitVendorID(CECDEVICE_BROADCAST);
+    }
   }
 
   return true;
@@ -133,9 +134,17 @@ bool CSLCommandHandler::HandleDeviceVendorId(const cec_command &command)
 
   if (!SLInitialised() && command.initiator == CECDEVICE_TV)
   {
-    cec_command response;
-    cec_command::Format(response, command.destination, command.initiator, CEC_OPCODE_FEATURE_ABORT);
-    return Transmit(response);
+    CCECBusDevice *destination = m_processor->GetDevice(command.destination);
+    if (destination && (destination->GetLogicalAddress() == CECDEVICE_BROADCAST || destination->IsHandledByLibCEC()))
+    {
+      cec_logical_address initiator = destination->GetLogicalAddress();
+      if (initiator == CECDEVICE_BROADCAST)
+        initiator = m_processor->GetPrimaryDevice()->GetLogicalAddress();
+
+      cec_command response;
+      cec_command::Format(response, initiator, command.initiator, CEC_OPCODE_FEATURE_ABORT);
+      return Transmit(response);
+    }
   }
   return true;
 }
index 59eb5747cb6cc9693415286f836337647c5e1aab..3d96004a7f401bdbf5874ac1a0cf69484b74b857 100644 (file)
@@ -52,24 +52,26 @@ CVLCommandHandler::CVLCommandHandler(CCECBusDevice *busDevice) :
     m_bPowerUpEventReceived(false)
 {
   m_vendorId = CEC_VENDOR_PANASONIC;
-
-  /* use the VL commandhandler for the primary device that is handled by libCEC */
-  if (busDevice->GetLogicalAddress() == CECDEVICE_TV)
-  {
-    CCECBusDevice *primary = m_processor->GetPrimaryDevice();
-    if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
-    {
-      primary->SetVendorId(CEC_VENDOR_PANASONIC);
-      primary->ReplaceHandler(false);
-    }
-  }
 }
 
 bool CVLCommandHandler::InitHandler(void)
 {
   CCECBusDevice *primary = m_processor->GetPrimaryDevice();
-  if (primary->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE)
-    return m_processor->GetPrimaryClient()->ChangeDeviceType(CEC_DEVICE_TYPE_RECORDING_DEVICE, CEC_DEVICE_TYPE_PLAYBACK_DEVICE);
+  if (primary && primary->GetLogicalAddress() != CECDEVICE_UNREGISTERED)
+  {
+    /* use the VL commandhandler for the primary device that is handled by libCEC */
+    if (m_busDevice->GetLogicalAddress() == CECDEVICE_TV)
+    {
+      if (primary && m_busDevice->GetLogicalAddress() != primary->GetLogicalAddress())
+      {
+        primary->SetVendorId(CEC_VENDOR_PANASONIC);
+        primary->ReplaceHandler(false);
+      }
+    }
+
+    if (primary->GetType() == CEC_DEVICE_TYPE_RECORDING_DEVICE)
+      return m_processor->GetPrimaryClient()->ChangeDeviceType(CEC_DEVICE_TYPE_RECORDING_DEVICE, CEC_DEVICE_TYPE_PLAYBACK_DEVICE);
+  }
 
   return CCECCommandHandler::InitHandler();
 }
@@ -121,7 +123,8 @@ bool CVLCommandHandler::TransmitActiveSource(const cec_logical_address iInitiato
   else
   {
     // transmit standard active source message
-    return CCECCommandHandler::TransmitActiveSource(iInitiator, iPhysicalAddress);
+    return CCECCommandHandler::TransmitActiveSource(iInitiator, iPhysicalAddress) &&
+        TransmitMenuState(iInitiator, CECDEVICE_TV, CEC_MENU_STATE_ACTIVATED);
   }
 }
 
@@ -137,7 +140,8 @@ bool CVLCommandHandler::TransmitPendingActiveSourceCommands(void)
   if (bTransmitCommand)
   {
     LIB_CEC->AddLog(CEC_LOG_DEBUG, "transmitting delayed activate source command");
-    return CCECCommandHandler::TransmitActiveSource(m_busDevice->GetLogicalAddress(), m_busDevice->GetCurrentPhysicalAddress());
+    return CCECCommandHandler::TransmitActiveSource(m_busDevice->GetLogicalAddress(), m_busDevice->GetCurrentPhysicalAddress()) &&
+        TransmitMenuState(m_busDevice->GetLogicalAddress(), CECDEVICE_TV, CEC_MENU_STATE_ACTIVATED);
   }
   return true;
 }
index d24ea3d93ad9470fa66fb0c7f16e89fab701c94e..f2bfc7ec7a0a7c9ead58845636d206a81fb9acfe 100644 (file)
@@ -48,6 +48,8 @@ namespace CEC
     bool TransmitPendingActiveSourceCommands(void);
 
     bool PowerUpEventReceived(void);
+    bool SupportsDeviceType(const cec_device_type type) const { return type != CEC_DEVICE_TYPE_RECORDING_DEVICE; };
+    cec_device_type GetReplacementDeviceType(const cec_device_type type) const { return type == CEC_DEVICE_TYPE_RECORDING_DEVICE ? CEC_DEVICE_TYPE_PLAYBACK_DEVICE : type; }
 
   private:
     PLATFORM::CMutex m_mutex;
diff --git a/src/lib/platform/adl/adl-edid.cpp b/src/lib/platform/adl/adl-edid.cpp
new file mode 100644 (file)
index 0000000..368b86b
--- /dev/null
@@ -0,0 +1,203 @@
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#include "adl-edid.h"
+
+// for dlsym and friends
+#if defined(__WINDOWS__)
+#include "../windows/dlfcn-win32.h"
+#endif
+
+using namespace PLATFORM;
+
+CADLEdidParser::CADLEdidParser(void) :
+  m_bOpen(false),
+  m_handle(NULL)
+{
+  Initialise();
+}
+
+CADLEdidParser::~CADLEdidParser(void)
+{
+  CloseLibrary();
+}
+
+bool CADLEdidParser::OpenLibrary(void)
+{
+  CloseLibrary();
+
+#if !defined(__WINDOWS__)
+  m_handle = dlopen("libatiadlxx.so", RTLD_LAZY|RTLD_GLOBAL);
+#else
+  m_handle = LoadLibrary("atiadlxx.dll");
+  // try 32 bit
+  if (!m_handle)
+    m_handle = LoadLibrary("atiadlxy.dll");
+#endif
+
+  return m_handle != NULL;
+}
+
+void CADLEdidParser::CloseLibrary(void)
+{
+  if (LibOpen())
+    ADL_Main_Control_Destroy();
+
+  if (m_handle)
+    dlclose(m_handle);
+  m_handle = NULL;
+}
+
+void *__stdcall ADL_AllocMemory(int iSize)
+{
+  void* lpBuffer = malloc(iSize);
+  return lpBuffer;
+}
+
+void CADLEdidParser::Initialise(void)
+{
+  if (OpenLibrary())
+  {
+    // dlsym the methods we need
+    ADL_Main_Control_Create          = (ADL_MAIN_CONTROL_CREATE)          dlsym(m_handle, "ADL_Main_Control_Create");
+         ADL_Main_Control_Destroy         = (ADL_MAIN_CONTROL_DESTROY)         dlsym(m_handle, "ADL_Main_Control_Destroy");
+         ADL_Adapter_NumberOfAdapters_Get = (ADL_ADAPTER_NUMBEROFADAPTERS_GET) dlsym(m_handle, "ADL_Adapter_NumberOfAdapters_Get");
+         ADL_Adapter_AdapterInfo_Get      = (ADL_ADAPTER_ADAPTERINFO_GET)      dlsym(m_handle, "ADL_Adapter_AdapterInfo_Get");
+         ADL_Display_DisplayInfo_Get      = (ADL_DISPLAY_DISPLAYINFO_GET)      dlsym(m_handle, "ADL_Display_DisplayInfo_Get");
+         ADL_Display_EdidData_Get         = (ADL_DISPLAY_EDIDDATA_GET)         dlsym(m_handle, "ADL_Display_EdidData_Get");
+
+         // check whether they could all be resolved
+    if (ADL_Main_Control_Create &&
+        ADL_Main_Control_Destroy &&
+        ADL_Adapter_NumberOfAdapters_Get &&
+        ADL_Adapter_AdapterInfo_Get &&
+        ADL_Display_DisplayInfo_Get &&
+        ADL_Display_EdidData_Get)
+    {
+      // and try to initialise it
+      m_bOpen = (ADL_OK == ADL_Main_Control_Create(ADL_AllocMemory, 1));
+    }
+  }
+}
+
+int CADLEdidParser::GetNumAdapters(void)
+{
+  int iNumAdapters(0);
+
+  if (!LibOpen() || ADL_OK != ADL_Adapter_NumberOfAdapters_Get(&iNumAdapters))
+    iNumAdapters = 0;
+
+  return iNumAdapters;
+}
+
+LPAdapterInfo CADLEdidParser::GetAdapterInfo(int iNumAdapters)
+{
+  // validate input
+  if (iNumAdapters <= 0)
+    return NULL;
+
+  LPAdapterInfo adapterInfo = (LPAdapterInfo)malloc(sizeof(AdapterInfo) * iNumAdapters);
+  memset(adapterInfo, 0, sizeof(AdapterInfo) * iNumAdapters);
+
+  // get the info
+  ADL_Adapter_AdapterInfo_Get(adapterInfo, sizeof(AdapterInfo) * iNumAdapters);
+
+  return adapterInfo;
+}
+
+bool CADLEdidParser::GetAdapterEDID(int iAdapterIndex, int iDisplayIndex, ADLDisplayEDIDData *data)
+{
+  // validate input
+  if (iAdapterIndex < 0 || iDisplayIndex < 0)
+    return false;
+
+  memset(data, 0, sizeof(ADLDisplayEDIDData));
+  data->iSize = sizeof(ADLDisplayEDIDData);
+  data->iBlockIndex = 1;
+
+  return (ADL_Display_EdidData_Get(iAdapterIndex, iDisplayIndex, data) == ADL_OK);
+}
+
+uint16_t CADLEdidParser::GetPhysicalAddress(void)
+{
+  uint16_t iPA(0);
+
+  // get the number of adapters
+  int iNumAdapters = GetNumAdapters();
+  if (iNumAdapters <= 0)
+    return 0;
+
+  // get the adapter info
+  LPAdapterInfo adapterInfo = GetAdapterInfo(iNumAdapters);
+  if (!adapterInfo)
+    return 0;
+
+  // iterate over it
+  for (int iAdapterPtr = 0; iAdapterPtr < iNumAdapters; iAdapterPtr++)
+  {
+    int iNumDisplays(-1);
+    LPADLDisplayInfo displayInfo(NULL);
+    int iAdapterIndex = adapterInfo[iAdapterPtr].iAdapterIndex;
+
+    // get the display info
+    if (ADL_OK != ADL_Display_DisplayInfo_Get(iAdapterIndex, &iNumDisplays, &displayInfo, 0))
+      continue;
+
+    // iterate over it
+    for (int iDisplayPtr = 0; iDisplayPtr < iNumDisplays; iDisplayPtr++)
+               {
+      // check whether the display is connected
+      if ((displayInfo[iDisplayPtr].iDisplayInfoValue & ADL_DISPLAY_CONNECTED) != ADL_DISPLAY_CONNECTED)
+        continue;
+
+      int iDisplayIndex = displayInfo[iDisplayPtr].displayID.iDisplayLogicalIndex;
+
+      // try to get the EDID
+      ADLDisplayEDIDData edidData;
+      if (GetAdapterEDID(iAdapterIndex, iDisplayIndex, &edidData))
+                       {
+        // try to get the PA from the EDID
+        iPA = CEDIDParser::GetPhysicalAddressFromEDID(edidData.cEDIDData, edidData.iEDIDSize);
+
+        // found it
+        if (iPA != 0)
+          break;
+                       }
+               }
+
+    free(displayInfo);
+  }
+
+  free(adapterInfo);
+
+  return iPA;
+}
diff --git a/src/lib/platform/adl/adl-edid.h b/src/lib/platform/adl/adl-edid.h
new file mode 100644 (file)
index 0000000..10b76c9
--- /dev/null
@@ -0,0 +1,95 @@
+#pragma once
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#define HAS_ADL_EDID_PARSER
+
+#include "../os.h"
+#include "../util/edid.h"
+
+#if !defined(__WINDOWS__)
+#include "adl_sdk.h"
+#include <dlfcn.h>
+#include <stdlib.h>    
+#include <string.h>
+#include <unistd.h>
+
+typedef void* ADL_LIB_HANDLE;
+
+#else
+#include <windows.h>
+#include <tchar.h>
+#include "adl_sdk.h"
+
+typedef HINSTANCE ADL_LIB_HANDLE;
+#endif
+
+typedef int (*ADL_MAIN_CONTROL_CREATE )         (ADL_MAIN_MALLOC_CALLBACK, int);
+typedef int (*ADL_MAIN_CONTROL_DESTROY)         (void);
+typedef int (*ADL_ADAPTER_NUMBEROFADAPTERS_GET) (int*);
+typedef int (*ADL_ADAPTER_ADAPTERINFO_GET)      (LPAdapterInfo, int);
+typedef int (*ADL_DISPLAY_DISPLAYINFO_GET)      (int, int *, ADLDisplayInfo **, int);
+typedef int (*ADL_DISPLAY_EDIDDATA_GET)         (int, int, ADLDisplayEDIDData *);
+
+#define ADL_DISPLAY_CONNECTED (ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED | ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED)
+
+namespace PLATFORM
+{
+  class CADLEdidParser
+  {
+  public:
+    CADLEdidParser(void);
+    virtual ~CADLEdidParser(void);
+
+    uint16_t GetPhysicalAddress(void);
+    int GetNumAdapters(void);
+
+  private:
+    bool LibOpen(void) { return m_bOpen; }
+    void Initialise(void);
+    bool OpenLibrary(void);
+    void CloseLibrary(void);
+
+    LPAdapterInfo GetAdapterInfo(int iNumAdapters);
+    bool GetAdapterEDID(int iAdapterIndex, int iDisplayIndex, ADLDisplayEDIDData *data);
+
+    bool           m_bOpen;
+    ADL_LIB_HANDLE m_handle;
+
+    ADL_MAIN_CONTROL_CREATE          ADL_Main_Control_Create;
+    ADL_MAIN_CONTROL_DESTROY         ADL_Main_Control_Destroy;
+         ADL_ADAPTER_NUMBEROFADAPTERS_GET ADL_Adapter_NumberOfAdapters_Get;
+         ADL_ADAPTER_ADAPTERINFO_GET      ADL_Adapter_AdapterInfo_Get;
+         ADL_DISPLAY_DISPLAYINFO_GET      ADL_Display_DisplayInfo_Get;
+    ADL_DISPLAY_EDIDDATA_GET         ADL_Display_EdidData_Get;
+  };
+}
diff --git a/src/lib/platform/adl/adl_defines.h b/src/lib/platform/adl/adl_defines.h
new file mode 100644 (file)
index 0000000..f37ab0e
--- /dev/null
@@ -0,0 +1,1343 @@
+//
+//  Copyright (c) 2008 - 2012 Advanced Micro Devices, Inc.
+//  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
+//  EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+//  WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
+
+/// \file adl_defines.h
+/// \brief Contains all definitions exposed by ADL for \ALL platforms.\n <b>Included in ADL SDK</b>
+///
+/// This file contains all definitions used by ADL.  
+/// The ADL definitions include the following:
+/// \li ADL error codes
+/// \li Enumerations for the ADLDisplayInfo structure
+/// \li Maximum limits
+///
+
+#ifndef ADL_DEFINES_H_
+#define ADL_DEFINES_H_
+
+/// \defgroup DEFINES Constants and Definitions
+// @{
+
+/// \defgroup define_misc Miscellaneous Constant Definitions
+// @{
+
+/// \name General Definitions
+// @{
+
+/// Defines ADL_TRUE
+#define ADL_TRUE       1
+/// Defines ADL_FALSE
+#define ADL_FALSE              0
+
+/// Defines the maximum string length
+#define ADL_MAX_CHAR                                    4096
+/// Defines the maximum string length
+#define ADL_MAX_PATH                                    256
+/// Defines the maximum number of supported adapters
+#define ADL_MAX_ADAPTERS                               250
+/// Defines the maxumum number of supported displays
+#define ADL_MAX_DISPLAYS                                150
+/// Defines the maxumum string length for device name
+#define ADL_MAX_DEVICENAME                                                             32
+/// Defines for all adapters
+#define ADL_ADAPTER_INDEX_ALL                                                  -1
+///    Defines APIs with iOption none
+#define ADL_MAIN_API_OPTION_NONE                                               0
+// @}
+
+/// \name Definitions for iOption parameter used by
+/// ADL_Display_DDCBlockAccess_Get()
+// @{
+
+/// Switch to DDC line 2 before sending the command to the display.
+#define ADL_DDC_OPTION_SWITCHDDC2              0x00000001
+/// Save command in the registry under a unique key, corresponding to parameter \b iCommandIndex
+#define ADL_DDC_OPTION_RESTORECOMMAND 0x00000002
+/// Combine write-read DDC block access command. 
+#define ADL_DDC_OPTION_COMBOWRITEREAD 0x00000010
+// @}
+
+/// \name Values for
+/// ADLI2C.iAction used with ADL_Display_WriteAndReadI2C()
+// @{
+
+#define ADL_DL_I2C_ACTIONREAD                                                                  0x00000001
+#define ADL_DL_I2C_ACTIONWRITE                                                         0x00000002
+#define ADL_DL_I2C_ACTIONREAD_REPEATEDSTART    0x00000003
+// @}
+
+
+// @}          //Misc
+
+/// \defgroup define_adl_results Result Codes
+/// This group of definitions are the various results returned by all ADL functions \n
+// @{
+/// All OK, but need to wait
+#define ADL_OK_WAIT                            4
+/// All OK, but need restart
+#define ADL_OK_RESTART                         3
+/// All OK but need mode change
+#define ADL_OK_MODE_CHANGE                     2
+/// All OK, but with warning
+#define ADL_OK_WARNING                         1
+/// ADL function completed successfully 
+#define ADL_OK                                 0
+/// Generic Error. Most likely one or more of the Escape calls to the driver failed!
+#define ADL_ERR                                        -1
+/// ADL not initialized
+#define ADL_ERR_NOT_INIT                       -2
+/// One of the parameter passed is invalid
+#define ADL_ERR_INVALID_PARAM                  -3
+/// One of the parameter size is invalid
+#define ADL_ERR_INVALID_PARAM_SIZE             -4
+/// Invalid ADL index passed
+#define ADL_ERR_INVALID_ADL_IDX                        -5
+/// Invalid controller index passed
+#define ADL_ERR_INVALID_CONTROLLER_IDX         -6
+/// Invalid display index passed
+#define ADL_ERR_INVALID_DIPLAY_IDX             -7
+/// Function  not supported by the driver
+#define ADL_ERR_NOT_SUPPORTED                  -8
+/// Null Pointer error
+#define ADL_ERR_NULL_POINTER                   -9
+/// Call can't be made due to disabled adapter
+#define ADL_ERR_DISABLED_ADAPTER               -10
+/// Invalid Callback
+#define ADL_ERR_INVALID_CALLBACK               -11
+/// Display Resource conflict
+#define ADL_ERR_RESOURCE_CONFLICT                              -12
+
+// @}
+/// </A>
+
+/// \defgroup define_display_type Display Type
+/// Define Monitor/CRT display type
+// @{
+/// Define Monitor display type
+#define ADL_DT_MONITOR                         0
+/// Define TV display type
+#define ADL_DT_TELEVISION                      1
+/// Define LCD display type
+#define ADL_DT_LCD_PANEL                               2
+/// Define DFP display type
+#define ADL_DT_DIGITAL_FLAT_PANEL              3
+/// Define Componment Video display type
+#define ADL_DT_COMPONENT_VIDEO                 4
+/// Define Projector display type
+#define ADL_DT_PROJECTOR                       5
+// @}
+
+/// \defgroup define_display_connection_type Display Connection Type
+// @{
+/// Define unknown display output type
+#define ADL_DOT_UNKNOWN                                0
+/// Define composite display output type
+#define ADL_DOT_COMPOSITE                      1
+/// Define SVideo display output type
+#define ADL_DOT_SVIDEO                         2
+/// Define analog display output type
+#define ADL_DOT_ANALOG                         3
+/// Define digital display output type
+#define ADL_DOT_DIGITAL                                4
+// @}
+
+/// \defgroup define_color_type Display Color Type and Source
+/// Define  Display Color Type and Source
+// @{
+#define ADL_DISPLAY_COLOR_BRIGHTNESS   (1 << 0)
+#define ADL_DISPLAY_COLOR_CONTRAST     (1 << 1)
+#define ADL_DISPLAY_COLOR_SATURATION   (1 << 2)
+#define ADL_DISPLAY_COLOR_HUE          (1 << 3)
+#define ADL_DISPLAY_COLOR_TEMPERATURE  (1 << 4)        
+
+/// Color Temperature Source is EDID
+#define ADL_DISPLAY_COLOR_TEMPERATURE_SOURCE_EDID      (1 << 5)
+/// Color Temperature Source is User
+#define ADL_DISPLAY_COLOR_TEMPERATURE_SOURCE_USER      (1 << 6)
+// @}
+
+/// \defgroup define_adjustment_capabilities Display Adjustment Capabilities
+/// Display adjustment capabilities values.  Returned by ADL_Display_AdjustCaps_Get
+// @{
+#define ADL_DISPLAY_ADJUST_OVERSCAN            (1 << 0)
+#define ADL_DISPLAY_ADJUST_VERT_POS            (1 << 1)
+#define ADL_DISPLAY_ADJUST_HOR_POS             (1 << 2)
+#define ADL_DISPLAY_ADJUST_VERT_SIZE           (1 << 3)
+#define ADL_DISPLAY_ADJUST_HOR_SIZE            (1 << 4)
+#define ADL_DISPLAY_ADJUST_SIZEPOS             (ADL_DISPLAY_ADJUST_VERT_POS | ADL_DISPLAY_ADJUST_HOR_POS | ADL_DISPLAY_ADJUST_VERT_SIZE | ADL_DISPLAY_ADJUST_HOR_SIZE)
+#define ADL_DISPLAY_CUSTOMMODES                        (1<<5)
+#define ADL_DISPLAY_ADJUST_UNDERSCAN           (1<<6)
+// @}
+
+
+/// \defgroup define_desktop_config Desktop Configuration Flags
+/// These flags are used by ADL_DesktopConfig_xxx
+// @{
+#define ADL_DESKTOPCONFIG_UNKNOWN    0           /* UNKNOWN desktop config   */
+#define ADL_DESKTOPCONFIG_SINGLE     (1 <<  0)    /* Single                   */
+#define ADL_DESKTOPCONFIG_CLONE      (1 <<  2)    /* Clone                    */
+#define ADL_DESKTOPCONFIG_BIGDESK_H  (1 <<  4)    /* Big Desktop Horizontal   */
+#define ADL_DESKTOPCONFIG_BIGDESK_V  (1 <<  5)    /* Big Desktop Vertical     */
+#define ADL_DESKTOPCONFIG_BIGDESK_HR (1 <<  6)    /* Big Desktop Reverse Horz */
+#define ADL_DESKTOPCONFIG_BIGDESK_VR (1 <<  7)    /* Big Desktop Reverse Vert */
+#define ADL_DESKTOPCONFIG_RANDR12    (1 <<  8)    /* RandR 1.2 Multi-display */
+// @}
+
+/// needed for ADLDDCInfo structure
+#define ADL_MAX_DISPLAY_NAME                                256
+
+/// \defgroup define_edid_flags Values for ulDDCInfoFlag
+/// defines for ulDDCInfoFlag EDID flag
+// @{
+#define ADL_DISPLAYDDCINFOEX_FLAG_PROJECTORDEVICE       (1 << 0)
+#define ADL_DISPLAYDDCINFOEX_FLAG_EDIDEXTENSION         (1 << 1)
+#define ADL_DISPLAYDDCINFOEX_FLAG_DIGITALDEVICE         (1 << 2)
+#define ADL_DISPLAYDDCINFOEX_FLAG_HDMIAUDIODEVICE       (1 << 3)
+#define ADL_DISPLAYDDCINFOEX_FLAG_SUPPORTS_AI           (1 << 4)
+#define ADL_DISPLAYDDCINFOEX_FLAG_SUPPORT_xvYCC601      (1 << 5)
+#define ADL_DISPLAYDDCINFOEX_FLAG_SUPPORT_xvYCC709      (1 << 6)
+// @}
+
+/// \defgroup define_displayinfo_connector Display Connector Type
+/// defines for ADLDisplayInfo.iDisplayConnector
+// @{
+#define ADL_DISPLAY_CONTYPE_UNKNOWN                 0
+#define ADL_DISPLAY_CONTYPE_VGA                     1
+#define ADL_DISPLAY_CONTYPE_DVI_D                   2
+#define ADL_DISPLAY_CONTYPE_DVI_I                   3
+#define ADL_DISPLAY_CONTYPE_ATICVDONGLE_NTSC        4
+#define ADL_DISPLAY_CONTYPE_ATICVDONGLE_JPN         5
+#define ADL_DISPLAY_CONTYPE_ATICVDONGLE_NONI2C_JPN  6
+#define ADL_DISPLAY_CONTYPE_ATICVDONGLE_NONI2C_NTSC 7
+#define ADL_DISPLAY_CONTYPE_PROPRIETARY                                8
+#define ADL_DISPLAY_CONTYPE_HDMI_TYPE_A             10
+#define ADL_DISPLAY_CONTYPE_HDMI_TYPE_B             11
+#define ADL_DISPLAY_CONTYPE_SVIDEO                     12
+#define ADL_DISPLAY_CONTYPE_COMPOSITE               13
+#define ADL_DISPLAY_CONTYPE_RCA_3COMPONENT          14
+#define ADL_DISPLAY_CONTYPE_DISPLAYPORT             15
+#define ADL_DISPLAY_CONTYPE_EDP                     16
+#define ADL_DISPLAY_CONTYPE_WIRELESSDISPLAY         17
+// @}
+
+/// TV Capabilities and Standards
+/// \defgroup define_tv_caps TV Capabilities and Standards
+// @{
+#define ADL_TV_STANDARDS                       (1 << 0)
+#define ADL_TV_SCART                           (1 << 1)
+
+/// TV Standards Definitions
+#define ADL_STANDARD_NTSC_M            (1 << 0)
+#define ADL_STANDARD_NTSC_JPN          (1 << 1)
+#define ADL_STANDARD_NTSC_N            (1 << 2)
+#define ADL_STANDARD_PAL_B             (1 << 3)
+#define ADL_STANDARD_PAL_COMB_N                (1 << 4)
+#define ADL_STANDARD_PAL_D             (1 << 5)
+#define ADL_STANDARD_PAL_G             (1 << 6)
+#define ADL_STANDARD_PAL_H             (1 << 7)
+#define ADL_STANDARD_PAL_I             (1 << 8)
+#define ADL_STANDARD_PAL_K             (1 << 9)
+#define ADL_STANDARD_PAL_K1            (1 << 10)
+#define ADL_STANDARD_PAL_L             (1 << 11)
+#define ADL_STANDARD_PAL_M             (1 << 12)
+#define ADL_STANDARD_PAL_N             (1 << 13)
+#define ADL_STANDARD_PAL_SECAM_D       (1 << 14)
+#define ADL_STANDARD_PAL_SECAM_K       (1 << 15)
+#define ADL_STANDARD_PAL_SECAM_K1      (1 << 16)
+#define ADL_STANDARD_PAL_SECAM_L       (1 << 17)
+// @}
+
+
+/// \defgroup define_video_custom_mode Video Custom Mode flags
+/// Component Video Custom Mode flags.  This is used by the iFlags parameter in ADLCustomMode
+// @{
+#define ADL_CUSTOMIZEDMODEFLAG_MODESUPPORTED   (1 << 0)
+#define ADL_CUSTOMIZEDMODEFLAG_NOTDELETETABLE  (1 << 1)
+#define ADL_CUSTOMIZEDMODEFLAG_INSERTBYDRIVER  (1 << 2)
+#define ADL_CUSTOMIZEDMODEFLAG_INTERLACED      (1 << 3)
+#define ADL_CUSTOMIZEDMODEFLAG_BASEMODE                (1 << 4)
+// @}
+
+/// \defgroup define_ddcinfoflag Values used for DDCInfoFlag
+/// ulDDCInfoFlag field values used by the ADLDDCInfo structure
+// @{
+#define ADL_DISPLAYDDCINFOEX_FLAG_PROJECTORDEVICE      (1 << 0)
+#define ADL_DISPLAYDDCINFOEX_FLAG_EDIDEXTENSION                (1 << 1)
+#define ADL_DISPLAYDDCINFOEX_FLAG_DIGITALDEVICE                (1 << 2)
+#define ADL_DISPLAYDDCINFOEX_FLAG_HDMIAUDIODEVICE      (1 << 3)
+#define ADL_DISPLAYDDCINFOEX_FLAG_SUPPORTS_AI          (1 << 4)
+#define ADL_DISPLAYDDCINFOEX_FLAG_SUPPORT_xvYCC601     (1 << 5)
+#define ADL_DISPLAYDDCINFOEX_FLAG_SUPPORT_xvYCC709     (1 << 6)
+// @}
+
+/// \defgroup define_cv_dongle Values used by ADL_CV_DongleSettings_xxx
+/// The following is applicable to ADL_DISPLAY_CONTYPE_ATICVDONGLE_JP and ADL_DISPLAY_CONTYPE_ATICVDONGLE_NONI2C_D only
+// @{
+#define ADL_DISPLAY_CV_DONGLE_D1          (1 << 0)
+#define ADL_DISPLAY_CV_DONGLE_D2          (1 << 1)
+#define ADL_DISPLAY_CV_DONGLE_D3          (1 << 2)
+#define ADL_DISPLAY_CV_DONGLE_D4          (1 << 3)
+#define ADL_DISPLAY_CV_DONGLE_D5          (1 << 4)
+
+/// The following is applicable to ADL_DISPLAY_CONTYPE_ATICVDONGLE_NA and ADL_DISPLAY_CONTYPE_ATICVDONGLE_NONI2C only
+
+#define ADL_DISPLAY_CV_DONGLE_480I        (1 << 0)
+#define ADL_DISPLAY_CV_DONGLE_480P        (1 << 1)
+#define ADL_DISPLAY_CV_DONGLE_540P        (1 << 2)
+#define ADL_DISPLAY_CV_DONGLE_720P        (1 << 3)
+#define ADL_DISPLAY_CV_DONGLE_1080I       (1 << 4)
+#define ADL_DISPLAY_CV_DONGLE_1080P       (1 << 5)
+#define ADL_DISPLAY_CV_DONGLE_16_9        (1 << 6)
+#define ADL_DISPLAY_CV_DONGLE_720P50      (1 << 7)
+#define ADL_DISPLAY_CV_DONGLE_1080I25     (1 << 8)
+#define ADL_DISPLAY_CV_DONGLE_576I25      (1 << 9)
+#define ADL_DISPLAY_CV_DONGLE_576P50      (1 << 10)
+#define ADL_DISPLAY_CV_DONGLE_1080P24      (1 << 11)
+#define ADL_DISPLAY_CV_DONGLE_1080P25      (1 << 12)
+#define ADL_DISPLAY_CV_DONGLE_1080P30      (1 << 13)
+#define ADL_DISPLAY_CV_DONGLE_1080P50      (1 << 14)
+// @}
+
+/// \defgroup define_formats_ovr       Formats Override Settings
+/// Display force modes flags
+// @{
+///
+#define ADL_DISPLAY_FORMAT_FORCE_720P          0x00000001
+#define ADL_DISPLAY_FORMAT_FORCE_1080I         0x00000002
+#define ADL_DISPLAY_FORMAT_FORCE_1080P         0x00000004
+#define ADL_DISPLAY_FORMAT_FORCE_720P50                0x00000008
+#define ADL_DISPLAY_FORMAT_FORCE_1080I25       0x00000010
+#define ADL_DISPLAY_FORMAT_FORCE_576I25                0x00000020
+#define ADL_DISPLAY_FORMAT_FORCE_576P50                0x00000040
+#define ADL_DISPLAY_FORMAT_FORCE_1080P24       0x00000080
+#define ADL_DISPLAY_FORMAT_FORCE_1080P25       0x00000100
+#define ADL_DISPLAY_FORMAT_FORCE_1080P30       0x00000200
+#define ADL_DISPLAY_FORMAT_FORCE_1080P50       0x00000400
+
+///< Below are \b EXTENDED display mode flags
+
+#define ADL_DISPLAY_FORMAT_CVDONGLEOVERIDE  0x00000001
+#define ADL_DISPLAY_FORMAT_CVMODEUNDERSCAN  0x00000002
+#define ADL_DISPLAY_FORMAT_FORCECONNECT_SUPPORTED  0x00000004
+#define ADL_DISPLAY_FORMAT_RESTRICT_FORMAT_SELECTION 0x00000008
+#define ADL_DISPLAY_FORMAT_SETASPECRATIO 0x00000010
+#define ADL_DISPLAY_FORMAT_FORCEMODES    0x00000020
+#define ADL_DISPLAY_FORMAT_LCDRTCCOEFF   0x00000040
+// @}
+
+/// Defines used by OD5
+#define ADL_PM_PARAM_DONT_CHANGE    0
+
+/// The following defines Bus types
+// @{
+#define ADL_BUSTYPE_PCI           0       /* PCI bus                          */
+#define ADL_BUSTYPE_AGP           1       /* AGP bus                          */
+#define ADL_BUSTYPE_PCIE          2       /* PCI Express bus                  */
+#define ADL_BUSTYPE_PCIE_GEN2     3       /* PCI Express 2nd generation bus   */
+#define ADL_BUSTYPE_PCIE_GEN3     4       /* PCI Express 3rd generation bus   */
+// @}
+
+/// \defgroup define_ws_caps   Workstation Capabilities
+/// Workstation values
+// @{
+
+/// This value indicates that the workstation card supports active stereo though stereo output connector
+#define ADL_STEREO_SUPPORTED           (1 << 2)
+/// This value indicates that the workstation card supports active stereo via "blue-line"
+#define ADL_STEREO_BLUE_LINE           (1 << 3)
+/// This value is used to turn off stereo mode.
+#define ADL_STEREO_OFF                         0
+/// This value indicates that the workstation card supports active stereo.  This is also used to set the stereo mode to active though the stereo output connector
+#define ADL_STEREO_ACTIVE                      (1 << 1)
+/// This value indicates that the workstation card supports auto-stereo monitors with horizontal interleave. This is also used to set the stereo mode to use the auto-stereo monitor with horizontal interleave
+#define ADL_STEREO_AUTO_HORIZONTAL     (1 << 30)
+/// This value indicates that the workstation card supports auto-stereo monitors with vertical interleave. This is also used to set the stereo mode to use the auto-stereo monitor with vertical interleave
+#define ADL_STEREO_AUTO_VERTICAL       (1 << 31)
+/// This value indicates that the workstation card supports passive stereo, ie. non stereo sync
+#define ADL_STEREO_PASSIVE              (1 << 6) 
+/// This value indicates that the workstation card supports auto-stereo monitors with vertical interleave. This is also used to set the stereo mode to use the auto-stereo monitor with vertical interleave
+#define ADL_STEREO_PASSIVE_HORIZ        (1 << 7)
+/// This value indicates that the workstation card supports auto-stereo monitors with vertical interleave. This is also used to set the stereo mode to use the auto-stereo monitor with vertical interleave
+#define ADL_STEREO_PASSIVE_VERT         (1 << 8)
+/// This value indicates that the workstation card supports DeepBitDepth (10 bpp) 
+#define ADL_DEEPBITDEPTH_10BPP_SUPPORTED   (1 << 5)
+
+/// This value indicates that the workstation supports 8-Bit Grayscale
+#define ADL_8BIT_GREYSCALE_SUPPORTED   (1 << 9)
+
+/// Load balancing is supported.
+#define ADL_WORKSTATION_LOADBALANCING_SUPPORTED         0x00000001
+/// Load balancing is available.
+#define ADL_WORKSTATION_LOADBALANCING_AVAILABLE         0x00000002
+
+/// Load balancing is disabled.
+#define ADL_WORKSTATION_LOADBALANCING_DISABLED          0x00000000
+/// Load balancing is Enabled.
+#define ADL_WORKSTATION_LOADBALANCING_ENABLED           0x00000001
+
+
+
+// @}
+
+/// \defgroup define_adapterspeed speed setting from the adapter
+// @{
+#define ADL_CONTEXT_SPEED_UNFORCED             0               /* default asic running speed */
+#define ADL_CONTEXT_SPEED_FORCEHIGH            1               /* asic running speed is forced to high */
+#define ADL_CONTEXT_SPEED_FORCELOW             2               /* asic running speed is forced to low */
+
+#define ADL_ADAPTER_SPEEDCAPS_SUPPORTED                (1 << 0)        /* change asic running speed setting is supported */
+// @}
+
+/// \defgroup define_glsync Genlock related values
+/// GL-Sync port types (unique values)
+// @{
+/// Unknown port of GL-Sync module
+#define ADL_GLSYNC_PORT_UNKNOWN                0
+/// BNC port of of GL-Sync module
+#define ADL_GLSYNC_PORT_BNC                    1
+/// RJ45(1) port of of GL-Sync module
+#define ADL_GLSYNC_PORT_RJ45PORT1      2
+/// RJ45(2) port of of GL-Sync module
+#define ADL_GLSYNC_PORT_RJ45PORT2      3
+
+// GL-Sync Genlock settings mask (bit-vector)
+
+/// None of the ADLGLSyncGenlockConfig members are valid
+#define ADL_GLSYNC_CONFIGMASK_NONE                             0
+/// The ADLGLSyncGenlockConfig.lSignalSource member is valid
+#define ADL_GLSYNC_CONFIGMASK_SIGNALSOURCE             (1 << 0)
+/// The ADLGLSyncGenlockConfig.iSyncField member is valid
+#define ADL_GLSYNC_CONFIGMASK_SYNCFIELD                        (1 << 1)
+/// The ADLGLSyncGenlockConfig.iSampleRate member is valid
+#define ADL_GLSYNC_CONFIGMASK_SAMPLERATE               (1 << 2)
+/// The ADLGLSyncGenlockConfig.lSyncDelay member is valid
+#define ADL_GLSYNC_CONFIGMASK_SYNCDELAY                        (1 << 3)
+/// The ADLGLSyncGenlockConfig.iTriggerEdge member is valid
+#define ADL_GLSYNC_CONFIGMASK_TRIGGEREDGE              (1 << 4)
+/// The ADLGLSyncGenlockConfig.iScanRateCoeff member is valid
+#define ADL_GLSYNC_CONFIGMASK_SCANRATECOEFF            (1 << 5)
+/// The ADLGLSyncGenlockConfig.lFramelockCntlVector member is valid
+#define ADL_GLSYNC_CONFIGMASK_FRAMELOCKCNTL            (1 << 6)
+
+
+// GL-Sync Framelock control mask (bit-vector)
+
+/// Framelock is disabled
+#define ADL_GLSYNC_FRAMELOCKCNTL_NONE                  0
+/// Framelock is enabled
+#define ADL_GLSYNC_FRAMELOCKCNTL_ENABLE                        ( 1 << 0)
+
+#define ADL_GLSYNC_FRAMELOCKCNTL_DISABLE               ( 1 << 1)
+#define ADL_GLSYNC_FRAMELOCKCNTL_SWAP_COUNTER_RESET    ( 1 << 2)
+#define ADL_GLSYNC_FRAMELOCKCNTL_SWAP_COUNTER_ACK      ( 1 << 3)
+
+#define ADL_GLSYNC_FRAMELOCKCNTL_STATE_ENABLE          ( 1 << 0)
+
+// GL-Sync Framelock counters mask (bit-vector)
+#define ADL_GLSYNC_COUNTER_SWAP                                ( 1 << 0 )
+
+// GL-Sync Signal Sources (unique values)
+
+/// GL-Sync signal source is undefined
+#define ADL_GLSYNC_SIGNALSOURCE_UNDEFINED    0x00000100
+/// GL-Sync signal source is Free Run
+#define ADL_GLSYNC_SIGNALSOURCE_FREERUN      0x00000101
+/// GL-Sync signal source is the BNC GL-Sync port
+#define ADL_GLSYNC_SIGNALSOURCE_BNCPORT      0x00000102
+/// GL-Sync signal source is the RJ45(1) GL-Sync port
+#define ADL_GLSYNC_SIGNALSOURCE_RJ45PORT1    0x00000103
+/// GL-Sync signal source is the RJ45(2) GL-Sync port
+#define ADL_GLSYNC_SIGNALSOURCE_RJ45PORT2    0x00000104
+
+
+// GL-Sync Signal Types (unique values)
+
+/// GL-Sync signal type is unknown
+#define ADL_GLSYNC_SIGNALTYPE_UNDEFINED      0
+/// GL-Sync signal type is 480I
+#define ADL_GLSYNC_SIGNALTYPE_480I           1
+/// GL-Sync signal type is 576I
+#define ADL_GLSYNC_SIGNALTYPE_576I           2
+/// GL-Sync signal type is 480P
+#define ADL_GLSYNC_SIGNALTYPE_480P           3
+/// GL-Sync signal type is 576P
+#define ADL_GLSYNC_SIGNALTYPE_576P           4
+/// GL-Sync signal type is 720P
+#define ADL_GLSYNC_SIGNALTYPE_720P           5
+/// GL-Sync signal type is 1080P
+#define ADL_GLSYNC_SIGNALTYPE_1080P          6
+/// GL-Sync signal type is 1080I
+#define ADL_GLSYNC_SIGNALTYPE_1080I          7
+/// GL-Sync signal type is SDI
+#define ADL_GLSYNC_SIGNALTYPE_SDI            8
+/// GL-Sync signal type is TTL
+#define ADL_GLSYNC_SIGNALTYPE_TTL            9
+/// GL_Sync signal type is Analog
+#define ADL_GLSYNC_SIGNALTYPE_ANALOG           10
+
+// GL-Sync Sync Field options (unique values)
+
+///GL-Sync sync field option is undefined
+#define ADL_GLSYNC_SYNCFIELD_UNDEFINED         0
+///GL-Sync sync field option is Sync to Field 1 (used for Interlaced signal types)
+#define ADL_GLSYNC_SYNCFIELD_BOTH                      1
+///GL-Sync sync field option is Sync to Both fields (used for Interlaced signal types)
+#define ADL_GLSYNC_SYNCFIELD_1                         2
+
+
+// GL-Sync trigger edge options (unique values)
+
+/// GL-Sync trigger edge is undefined
+#define ADL_GLSYNC_TRIGGEREDGE_UNDEFINED     0
+/// GL-Sync trigger edge is the rising edge
+#define ADL_GLSYNC_TRIGGEREDGE_RISING        1
+/// GL-Sync trigger edge is the falling edge
+#define ADL_GLSYNC_TRIGGEREDGE_FALLING       2
+/// GL-Sync trigger edge is both the rising and the falling edge
+#define ADL_GLSYNC_TRIGGEREDGE_BOTH          3
+
+
+// GL-Sync scan rate coefficient/multiplier options (unique values)
+
+/// GL-Sync scan rate coefficient/multiplier is undefined
+#define ADL_GLSYNC_SCANRATECOEFF_UNDEFINED   0
+/// GL-Sync scan rate coefficient/multiplier is 5
+#define ADL_GLSYNC_SCANRATECOEFF_x5          1
+/// GL-Sync scan rate coefficient/multiplier is 4
+#define ADL_GLSYNC_SCANRATECOEFF_x4          2
+/// GL-Sync scan rate coefficient/multiplier is 3
+#define ADL_GLSYNC_SCANRATECOEFF_x3          3
+/// GL-Sync scan rate coefficient/multiplier is 5:2 (SMPTE)
+#define ADL_GLSYNC_SCANRATECOEFF_x5_DIV_2    4
+/// GL-Sync scan rate coefficient/multiplier is 2
+#define ADL_GLSYNC_SCANRATECOEFF_x2          5
+/// GL-Sync scan rate coefficient/multiplier is 3 : 2
+#define ADL_GLSYNC_SCANRATECOEFF_x3_DIV_2    6
+/// GL-Sync scan rate coefficient/multiplier is 5 : 4
+#define ADL_GLSYNC_SCANRATECOEFF_x5_DIV_4    7
+/// GL-Sync scan rate coefficient/multiplier is 1 (default)
+#define ADL_GLSYNC_SCANRATECOEFF_x1          8
+/// GL-Sync scan rate coefficient/multiplier is 4 : 5
+#define ADL_GLSYNC_SCANRATECOEFF_x4_DIV_5    9
+/// GL-Sync scan rate coefficient/multiplier is 2 : 3
+#define ADL_GLSYNC_SCANRATECOEFF_x2_DIV_3    10
+/// GL-Sync scan rate coefficient/multiplier is 1 : 2
+#define ADL_GLSYNC_SCANRATECOEFF_x1_DIV_2    11
+/// GL-Sync scan rate coefficient/multiplier is 2 : 5 (SMPTE)
+#define ADL_GLSYNC_SCANRATECOEFF_x2_DIV_5    12
+/// GL-Sync scan rate coefficient/multiplier is 1 : 3
+#define ADL_GLSYNC_SCANRATECOEFF_x1_DIV_3    13
+/// GL-Sync scan rate coefficient/multiplier is 1 : 4
+#define ADL_GLSYNC_SCANRATECOEFF_x1_DIV_4    14
+/// GL-Sync scan rate coefficient/multiplier is 1 : 5
+#define ADL_GLSYNC_SCANRATECOEFF_x1_DIV_5    15
+
+
+// GL-Sync port (signal presence) states (unique values)
+
+/// GL-Sync port state is undefined
+#define ADL_GLSYNC_PORTSTATE_UNDEFINED       0
+/// GL-Sync port is not connected
+#define ADL_GLSYNC_PORTSTATE_NOCABLE         1
+/// GL-Sync port is Idle
+#define ADL_GLSYNC_PORTSTATE_IDLE            2
+/// GL-Sync port has an Input signal
+#define ADL_GLSYNC_PORTSTATE_INPUT           3
+/// GL-Sync port is Output
+#define ADL_GLSYNC_PORTSTATE_OUTPUT          4
+
+
+// GL-Sync LED types (used index within ADL_Workstation_GLSyncPortState_Get returned ppGlSyncLEDs array) (unique values)
+
+/// Index into the ADL_Workstation_GLSyncPortState_Get returned ppGlSyncLEDs array for the one LED of the BNC port
+#define ADL_GLSYNC_LEDTYPE_BNC               0
+/// Index into the ADL_Workstation_GLSyncPortState_Get returned ppGlSyncLEDs array for the Left LED of the RJ45(1) or RJ45(2) port
+#define ADL_GLSYNC_LEDTYPE_RJ45_LEFT         0
+/// Index into the ADL_Workstation_GLSyncPortState_Get returned ppGlSyncLEDs array for the Right LED of the RJ45(1) or RJ45(2) port
+#define ADL_GLSYNC_LEDTYPE_RJ45_RIGHT        1
+
+
+// GL-Sync LED colors (unique values)
+
+/// GL-Sync LED undefined color
+#define ADL_GLSYNC_LEDCOLOR_UNDEFINED        0
+/// GL-Sync LED is unlit
+#define ADL_GLSYNC_LEDCOLOR_NOLIGHT          1
+/// GL-Sync LED is yellow
+#define ADL_GLSYNC_LEDCOLOR_YELLOW           2
+/// GL-Sync LED is red
+#define ADL_GLSYNC_LEDCOLOR_RED              3
+/// GL-Sync LED is green
+#define ADL_GLSYNC_LEDCOLOR_GREEN            4
+/// GL-Sync LED is flashing green
+#define ADL_GLSYNC_LEDCOLOR_FLASH_GREEN      5
+
+
+// GL-Sync Port Control (refers one GL-Sync Port) (unique values)
+
+/// Used to configure the RJ54(1) or RJ42(2) port of GL-Sync is as Idle
+#define ADL_GLSYNC_PORTCNTL_NONE             0x00000000
+/// Used to configure the RJ54(1) or RJ42(2) port of GL-Sync is as Output
+#define ADL_GLSYNC_PORTCNTL_OUTPUT           0x00000001
+
+
+// GL-Sync Mode Control (refers one Display/Controller) (bitfields)
+
+/// Used to configure the display to use internal timing (not genlocked)
+#define ADL_GLSYNC_MODECNTL_NONE             0x00000000
+/// Bitfield used to configure the display as genlocked (either as Timing Client or as Timing Server)
+#define ADL_GLSYNC_MODECNTL_GENLOCK          0x00000001
+/// Bitfield used to configure the display as Timing Server
+#define ADL_GLSYNC_MODECNTL_TIMINGSERVER     0x00000002
+
+// GL-Sync Mode Status
+/// Display is currently not genlocked
+#define ADL_GLSYNC_MODECNTL_STATUS_NONE                 0x00000000
+/// Display is currently genlocked
+#define ADL_GLSYNC_MODECNTL_STATUS_GENLOCK   0x00000001
+/// Display requires a mode switch
+#define ADL_GLSYNC_MODECNTL_STATUS_SETMODE_REQUIRED 0x00000002
+/// Display is capable of being genlocked
+#define ADL_GLSYNC_MODECNTL_STATUS_GENLOCK_ALLOWED 0x00000004
+
+#define ADL_MAX_GLSYNC_PORTS                                                   8
+#define ADL_MAX_GLSYNC_PORT_LEDS                                               8
+
+// @}
+
+/// \defgroup define_crossfirestate CrossfireX state of a particular adapter CrossfireX combination
+// @{
+#define ADL_XFIREX_STATE_NOINTERCONNECT                        ( 1 << 0 )      /* Dongle / cable is missing */
+#define ADL_XFIREX_STATE_DOWNGRADEPIPES                        ( 1 << 1 )      /* CrossfireX can be enabled if pipes are downgraded */
+#define ADL_XFIREX_STATE_DOWNGRADEMEM                  ( 1 << 2 )      /* CrossfireX cannot be enabled unless mem downgraded */
+#define ADL_XFIREX_STATE_REVERSERECOMMENDED            ( 1 << 3 )      /* Card reversal recommended, CrossfireX cannot be enabled. */
+#define ADL_XFIREX_STATE_3DACTIVE                      ( 1 << 4 )      /* 3D client is active - CrossfireX cannot be safely enabled */
+#define ADL_XFIREX_STATE_MASTERONSLAVE                 ( 1 << 5 )      /* Dongle is OK but master is on slave */
+#define ADL_XFIREX_STATE_NODISPLAYCONNECT              ( 1 << 6 )      /* No (valid) display connected to master card. */
+#define ADL_XFIREX_STATE_NOPRIMARYVIEW                 ( 1 << 7 )      /* CrossfireX is enabled but master is not current primary device */
+#define ADL_XFIREX_STATE_DOWNGRADEVISMEM               ( 1 << 8 )      /* CrossfireX cannot be enabled unless visible mem downgraded */
+#define ADL_XFIREX_STATE_LESSTHAN8LANE_MASTER          ( 1 << 9 )      /* CrossfireX can be enabled however performance not optimal due to <8 lanes */
+#define ADL_XFIREX_STATE_LESSTHAN8LANE_SLAVE           ( 1 << 10 )     /* CrossfireX can be enabled however performance not optimal due to <8 lanes */
+#define ADL_XFIREX_STATE_PEERTOPEERFAILED              ( 1 << 11 )     /* CrossfireX cannot be enabled due to failed peer to peer test */
+#define ADL_XFIREX_STATE_MEMISDOWNGRADED               ( 1 << 16 )     /* Notification that memory is currently downgraded */
+#define ADL_XFIREX_STATE_PIPESDOWNGRADED               ( 1 << 17 )     /* Notification that pipes are currently downgraded */
+#define ADL_XFIREX_STATE_XFIREXACTIVE                  ( 1 << 18 )     /* CrossfireX is enabled on current device */
+#define ADL_XFIREX_STATE_VISMEMISDOWNGRADED            ( 1 << 19 )     /* Notification that visible FB memory is currently downgraded */
+#define ADL_XFIREX_STATE_INVALIDINTERCONNECTION                ( 1 << 20 )     /* Cannot support current inter-connection configuration */
+#define ADL_XFIREX_STATE_NONP2PMODE                    ( 1 << 21 )     /* CrossfireX will only work with clients supporting non P2P mode */
+#define ADL_XFIREX_STATE_DOWNGRADEMEMBANKS             ( 1 << 22 )     /* CrossfireX cannot be enabled unless memory banks downgraded */
+#define ADL_XFIREX_STATE_MEMBANKSDOWNGRADED            ( 1 << 23 )     /* Notification that memory banks are currently downgraded */
+#define ADL_XFIREX_STATE_DUALDISPLAYSALLOWED           ( 1 << 24 )     /* Extended desktop or clone mode is allowed. */
+#define ADL_XFIREX_STATE_P2P_APERTURE_MAPPING          ( 1 << 25 )     /* P2P mapping was through peer aperture */
+#define ADL_XFIREX_STATE_P2PFLUSH_REQUIRED             ADL_XFIREX_STATE_P2P_APERTURE_MAPPING   /* For back compatible */
+#define ADL_XFIREX_STATE_XSP_CONNECTED                 ( 1 << 26 )     /* There is CrossfireX side port connection between GPUs */
+#define ADL_XFIREX_STATE_ENABLE_CF_REBOOT_REQUIRED     ( 1 << 27 )     /* System needs a reboot bofore enable CrossfireX */
+#define ADL_XFIREX_STATE_DISABLE_CF_REBOOT_REQUIRED    ( 1 << 28 )     /* System needs a reboot after disable CrossfireX */
+#define ADL_XFIREX_STATE_DRV_HANDLE_DOWNGRADE_KEY      ( 1 << 29 )     /* Indicate base driver handles the downgrade key updating */
+#define ADL_XFIREX_STATE_CF_RECONFIG_REQUIRED          ( 1 << 30 )     /* CrossfireX need to be reconfigured by CCC because of a LDA chain broken */
+#define ADL_XFIREX_STATE_ERRORGETTINGSTATUS            ( 1 << 31 )     /* Could not obtain current status */
+// @}
+
+///////////////////////////////////////////////////////////////////////////
+// ADL_DISPLAY_ADJUSTMENT_PIXELFORMAT adjustment values
+// (bit-vector)
+///////////////////////////////////////////////////////////////////////////
+/// \defgroup define_pixel_formats Pixel Formats values
+/// This group defines the various Pixel Formats that a particular digital display can support. \n
+/// Since a display can support multiple formats, these values can be bit-or'ed to indicate the various formats \n
+// @{
+#define ADL_DISPLAY_PIXELFORMAT_UNKNOWN             0
+#define ADL_DISPLAY_PIXELFORMAT_RGB                       (1 << 0)
+#define ADL_DISPLAY_PIXELFORMAT_YCRCB444                  (1 << 1)    //Limited range
+#define ADL_DISPLAY_PIXELFORMAT_YCRCB422                 (1 << 2)    //Limited range
+#define ADL_DISPLAY_PIXELFORMAT_RGB_LIMITED_RANGE      (1 << 3)
+#define ADL_DISPLAY_PIXELFORMAT_RGB_FULL_RANGE    ADL_DISPLAY_PIXELFORMAT_RGB  //Full range
+// @}
+
+/// \defgroup define_contype Connector Type Values
+/// ADLDisplayConfig.ulConnectorType defines
+// @{
+#define ADL_DL_DISPLAYCONFIG_CONTYPE_UNKNOWN      0
+#define ADL_DL_DISPLAYCONFIG_CONTYPE_CV_NONI2C_JP 1
+#define ADL_DL_DISPLAYCONFIG_CONTYPE_CV_JPN       2
+#define ADL_DL_DISPLAYCONFIG_CONTYPE_CV_NA        3
+#define ADL_DL_DISPLAYCONFIG_CONTYPE_CV_NONI2C_NA 4
+#define ADL_DL_DISPLAYCONFIG_CONTYPE_VGA          5
+#define ADL_DL_DISPLAYCONFIG_CONTYPE_DVI_D        6
+#define ADL_DL_DISPLAYCONFIG_CONTYPE_DVI_I        7
+#define ADL_DL_DISPLAYCONFIG_CONTYPE_HDMI_TYPE_A  8
+#define ADL_DL_DISPLAYCONFIG_CONTYPE_HDMI_TYPE_B  9
+#define ADL_DL_DISPLAYCONFIG_CONTYPE_DISPLAYPORT  10
+// @}
+
+
+///////////////////////////////////////////////////////////////////////////
+// ADL_DISPLAY_DISPLAYINFO_ Definitions 
+// for ADLDisplayInfo.iDisplayInfoMask and ADLDisplayInfo.iDisplayInfoValue
+// (bit-vector)
+///////////////////////////////////////////////////////////////////////////
+/// \defgroup define_displayinfomask Display Info Mask Values
+// @{
+#define ADL_DISPLAY_DISPLAYINFO_DISPLAYCONNECTED                       0x00000001
+#define ADL_DISPLAY_DISPLAYINFO_DISPLAYMAPPED                          0x00000002
+#define ADL_DISPLAY_DISPLAYINFO_NONLOCAL                                       0x00000004
+#define ADL_DISPLAY_DISPLAYINFO_FORCIBLESUPPORTED                      0x00000008
+#define ADL_DISPLAY_DISPLAYINFO_GENLOCKSUPPORTED                       0x00000010
+#define ADL_DISPLAY_DISPLAYINFO_MULTIVPU_SUPPORTED                     0x00000020
+
+#define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_SINGLE                        0x00000100
+#define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_CLONE                 0x00000200
+
+/// Legacy support for XP 
+#define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_2VSTRETCH             0x00000400
+#define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_2HSTRETCH             0x00000800
+#define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_EXTENDED              0x00001000
+
+/// More support manners  
+#define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_NSTRETCH1GPU  0x00010000
+#define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_NSTRETCHNGPU  0x00020000 
+#define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_RESERVED2             0x00040000
+#define ADL_DISPLAY_DISPLAYINFO_MANNER_SUPPORTED_RESERVED3             0x00080000
+
+/// Projector display type
+#define ADL_DISPLAY_DISPLAYINFO_SHOWTYPE_PROJECTOR                             0x00100000
+
+// @}
+
+
+///////////////////////////////////////////////////////////////////////////
+// ADL_ADAPTER_DISPLAY_MANNER_SUPPORTED_ Definitions 
+// for ADLAdapterDisplayCap of ADL_Adapter_Display_Cap()
+// (bit-vector)
+///////////////////////////////////////////////////////////////////////////
+/// \defgroup define_adaptermanner Adapter Manner Support Values
+// @{
+#define ADL_ADAPTER_DISPLAYCAP_MANNER_SUPPORTED_NOTACTIVE              0x00000001
+#define ADL_ADAPTER_DISPLAYCAP_MANNER_SUPPORTED_SINGLE                 0x00000002
+#define ADL_ADAPTER_DISPLAYCAP_MANNER_SUPPORTED_CLONE                  0x00000004
+#define ADL_ADAPTER_DISPLAYCAP_MANNER_SUPPORTED_NSTRETCH1GPU   0x00000008
+#define ADL_ADAPTER_DISPLAYCAP_MANNER_SUPPORTED_NSTRETCHNGPU   0x00000010
+
+/// Legacy support for XP 
+#define ADL_ADAPTER_DISPLAYCAP_MANNER_SUPPORTED_2VSTRETCH              0x00000020
+#define ADL_ADAPTER_DISPLAYCAP_MANNER_SUPPORTED_2HSTRETCH              0x00000040
+#define ADL_ADAPTER_DISPLAYCAP_MANNER_SUPPORTED_EXTENDED               0x00000080
+
+#define ADL_ADAPTER_DISPLAYCAP_PREFERDISPLAY_SUPPORTED                 0x00000100
+#define ADL_ADAPTER_DISPLAYCAP_BEZEL_SUPPORTED                                 0x00000200
+
+
+///////////////////////////////////////////////////////////////////////////
+// ADL_DISPLAY_DISPLAYMAP_MANNER_ Definitions 
+// for ADLDisplayMap.iDisplayMapMask and ADLDisplayMap.iDisplayMapValue
+// (bit-vector)
+///////////////////////////////////////////////////////////////////////////
+#define ADL_DISPLAY_DISPLAYMAP_MANNER_RESERVED                 0x00000001
+#define ADL_DISPLAY_DISPLAYMAP_MANNER_NOTACTIVE                        0x00000002
+#define ADL_DISPLAY_DISPLAYMAP_MANNER_SINGLE                   0x00000004
+#define ADL_DISPLAY_DISPLAYMAP_MANNER_CLONE                            0x00000008
+#define ADL_DISPLAY_DISPLAYMAP_MANNER_RESERVED1                        0x00000010  // Removed NSTRETCH
+#define ADL_DISPLAY_DISPLAYMAP_MANNER_HSTRETCH                 0x00000020
+#define ADL_DISPLAY_DISPLAYMAP_MANNER_VSTRETCH                 0x00000040
+#define ADL_DISPLAY_DISPLAYMAP_MANNER_VLD                              0x00000080
+
+// @}
+
+///////////////////////////////////////////////////////////////////////////
+// ADL_DISPLAY_DISPLAYMAP_OPTION_ Definitions 
+// for iOption in function ADL_Display_DisplayMapConfig_Get
+// (bit-vector)
+///////////////////////////////////////////////////////////////////////////
+#define ADL_DISPLAY_DISPLAYMAP_OPTION_GPUINFO                  0x00000001
+
+///////////////////////////////////////////////////////////////////////////
+// ADL_DISPLAY_DISPLAYTARGET_ Definitions 
+// for ADLDisplayTarget.iDisplayTargetMask and ADLDisplayTarget.iDisplayTargetValue
+// (bit-vector)
+///////////////////////////////////////////////////////////////////////////
+#define ADL_DISPLAY_DISPLAYTARGET_PREFERRED                    0x00000001
+
+///////////////////////////////////////////////////////////////////////////
+// ADL_DISPLAY_POSSIBLEMAPRESULT_VALID Definitions 
+// for ADLPossibleMapResult.iPossibleMapResultMask and ADLPossibleMapResult.iPossibleMapResultValue
+// (bit-vector)
+///////////////////////////////////////////////////////////////////////////
+#define ADL_DISPLAY_POSSIBLEMAPRESULT_VALID                            0x00000001
+#define ADL_DISPLAY_POSSIBLEMAPRESULT_BEZELSUPPORTED   0x00000002
+#define ADL_DISPLAY_POSSIBLEMAPRESULT_OVERLAPSUPPORTED 0x00000004
+
+///////////////////////////////////////////////////////////////////////////
+// ADL_DISPLAY_MODE_ Definitions 
+// for ADLMode.iModeMask, ADLMode.iModeValue, and ADLMode.iModeFlag
+// (bit-vector)
+///////////////////////////////////////////////////////////////////////////
+/// \defgroup define_displaymode Display Mode Values
+// @{
+#define ADL_DISPLAY_MODE_COLOURFORMAT_565                              0x00000001
+#define ADL_DISPLAY_MODE_COLOURFORMAT_8888                             0x00000002
+#define ADL_DISPLAY_MODE_ORIENTATION_SUPPORTED_000             0x00000004
+#define ADL_DISPLAY_MODE_ORIENTATION_SUPPORTED_090             0x00000008
+#define ADL_DISPLAY_MODE_ORIENTATION_SUPPORTED_180             0x00000010
+#define ADL_DISPLAY_MODE_ORIENTATION_SUPPORTED_270             0x00000020
+#define ADL_DISPLAY_MODE_REFRESHRATE_ROUNDED                   0x00000040
+#define ADL_DISPLAY_MODE_REFRESHRATE_ONLY                              0x00000080
+
+#define ADL_DISPLAY_MODE_PROGRESSIVE_FLAG      0
+#define ADL_DISPLAY_MODE_INTERLACED_FLAG       2
+// @}
+
+///////////////////////////////////////////////////////////////////////////
+// ADL_OSMODEINFO Definitions 
+///////////////////////////////////////////////////////////////////////////
+/// \defgroup define_osmode OS Mode Values
+// @{
+#define ADL_OSMODEINFOXPOS_DEFAULT                             -640
+#define ADL_OSMODEINFOYPOS_DEFAULT                             0
+#define ADL_OSMODEINFOXRES_DEFAULT                             640
+#define ADL_OSMODEINFOYRES_DEFAULT                             480
+#define ADL_OSMODEINFOXRES_DEFAULT800                  800
+#define ADL_OSMODEINFOYRES_DEFAULT600                  600
+#define ADL_OSMODEINFOREFRESHRATE_DEFAULT              60
+#define ADL_OSMODEINFOCOLOURDEPTH_DEFAULT              8
+#define ADL_OSMODEINFOCOLOURDEPTH_DEFAULT16            16
+#define ADL_OSMODEINFOCOLOURDEPTH_DEFAULT24            24
+#define ADL_OSMODEINFOCOLOURDEPTH_DEFAULT32            32
+#define ADL_OSMODEINFOORIENTATION_DEFAULT              0
+#define ADL_OSMODEINFOORIENTATION_DEFAULT_WIN7 DISPLAYCONFIG_ROTATION_FORCE_UINT32
+#define ADL_OSMODEFLAG_DEFAULT                                 0
+// @}
+
+
+///////////////////////////////////////////////////////////////////////////
+// ADLPurposeCode Enumeration
+///////////////////////////////////////////////////////////////////////////
+enum ADLPurposeCode
+{ 
+       ADL_PURPOSECODE_NORMAL  = 0, 
+       ADL_PURPOSECODE_HIDE_MODE_SWITCH, 
+       ADL_PURPOSECODE_MODE_SWITCH, 
+       ADL_PURPOSECODE_ATTATCH_DEVICE, 
+       ADL_PURPOSECODE_DETACH_DEVICE, 
+       ADL_PURPOSECODE_SETPRIMARY_DEVICE, 
+       ADL_PURPOSECODE_GDI_ROTATION, 
+       ADL_PURPOSECODE_ATI_ROTATION, 
+};
+///////////////////////////////////////////////////////////////////////////
+// ADLAngle Enumeration
+///////////////////////////////////////////////////////////////////////////
+enum ADLAngle
+{
+    ADL_ANGLE_LANDSCAPE = 0,
+    ADL_ANGLE_ROTATERIGHT = 90,
+    ADL_ANGLE_ROTATE180 = 180,
+    ADL_ANGLE_ROTATELEFT = 270,
+};
+
+///////////////////////////////////////////////////////////////////////////
+// ADLOrientationDataType Enumeration
+///////////////////////////////////////////////////////////////////////////
+enum ADLOrientationDataType 
+{ 
+       ADL_ORIENTATIONTYPE_OSDATATYPE, 
+       ADL_ORIENTATIONTYPE_NONOSDATATYPE 
+};
+
+///////////////////////////////////////////////////////////////////////////
+// ADLPanningMode Enumeration
+///////////////////////////////////////////////////////////////////////////
+enum ADLPanningMode
+{ 
+       ADL_PANNINGMODE_NO_PANNING = 0,
+       ADL_PANNINGMODE_AT_LEAST_ONE_NO_PANNING = 1,
+       ADL_PANNINGMODE_ALLOW_PANNING = 2, 
+};
+
+///////////////////////////////////////////////////////////////////////////
+// ADLLARGEDESKTOPTYPE Enumeration
+///////////////////////////////////////////////////////////////////////////
+enum ADLLARGEDESKTOPTYPE
+{
+       ADL_LARGEDESKTOPTYPE_NORMALDESKTOP = 0,
+    ADL_LARGEDESKTOPTYPE_PSEUDOLARGEDESKTOP = 1,
+    ADL_LARGEDESKTOPTYPE_VERYLARGEDESKTOP = 2,
+};
+
+// Other Definitions for internal use
+
+// Values for ADL_Display_WriteAndReadI2CRev_Get()
+
+#define ADL_I2C_MAJOR_API_REV           0x00000001
+#define ADL_I2C_MINOR_DEFAULT_API_REV   0x00000000
+#define ADL_I2C_MINOR_OEM_API_REV       0x00000001
+
+// Values for ADL_Display_WriteAndReadI2C()
+#define ADL_DL_I2C_LINE_OEM                0x00000001
+#define ADL_DL_I2C_LINE_OD_CONTROL         0x00000002
+#define ADL_DL_I2C_LINE_OEM2               0x00000003
+#define ADL_DL_I2C_LINE_OEM3               0x00000004
+#define ADL_DL_I2C_LINE_OEM4               0x00000005
+#define ADL_DL_I2C_LINE_OEM5               0x00000006
+#define ADL_DL_I2C_LINE_OEM6               0x00000007
+
+// Max size of I2C data buffer
+#define ADL_DL_I2C_MAXDATASIZE             0x00000040
+#define ADL_DL_I2C_MAXWRITEDATASIZE        0x0000000C
+#define ADL_DL_I2C_MAXADDRESSLENGTH        0x00000006
+#define ADL_DL_I2C_MAXOFFSETLENGTH         0x00000004
+
+
+/// Values for ADLDisplayProperty.iPropertyType
+#define ADL_DL_DISPLAYPROPERTY_TYPE_UNKNOWN              0
+#define ADL_DL_DISPLAYPROPERTY_TYPE_EXPANSIONMODE        1
+#define ADL_DL_DISPLAYPROPERTY_TYPE_USEUNDERSCANSCALING         2
+/// Enables ITC processing for HDMI panels that are capable of the feature
+#define ADL_DL_DISPLAYPROPERTY_TYPE_ITCFLAGENABLE        9 
+
+
+/// Values for ADLDisplayContent.iContentType
+/// Certain HDMI panels that support ITC have support for a feature such that, the display on the panel 
+/// can be adjusted to optimize the view of the content being displayed, depending on the type of content.
+#define ADL_DL_DISPLAYCONTENT_TYPE_GRAPHICS            1
+#define ADL_DL_DISPLAYCONTENT_TYPE_PHOTO               2
+#define ADL_DL_DISPLAYCONTENT_TYPE_CINEMA              4       
+#define ADL_DL_DISPLAYCONTENT_TYPE_GAME                        8
+
+
+
+
+
+//values for ADLDisplayProperty.iExpansionMode
+#define ADL_DL_DISPLAYPROPERTY_EXPANSIONMODE_CENTER        0
+#define ADL_DL_DISPLAYPROPERTY_EXPANSIONMODE_FULLSCREEN    1
+#define ADL_DL_DISPLAYPROPERTY_EXPANSIONMODE_ASPECTRATIO   2
+
+//values for ADL_Display_DitherState_Get
+#define ADL_DL_DISPLAY_DITHER_UNKNOWN    0
+#define ADL_DL_DISPLAY_DITHER_DISABLED   1
+#define ADL_DL_DISPLAY_DITHER_ENABLED    2
+
+/// Display Get Cached EDID flag
+#define ADL_MAX_EDIDDATA_SIZE              256 // number of UCHAR
+#define ADL_MAX_OVERRIDEEDID_SIZE          512 // number of UCHAR
+#define ADL_MAX_EDID_EXTENSION_BLOCKS      3
+
+#define ADL_DL_CONTROLLER_OVERLAY_ALPHA         0
+#define ADL_DL_CONTROLLER_OVERLAY_ALPHAPERPIX   1
+
+#define ADL_DL_DISPLAY_DATA_PACKET__INFO_PACKET_RESET      0x00000000
+#define ADL_DL_DISPLAY_DATA_PACKET__INFO_PACKET_SET        0x00000001
+#define ADL_DL_DISPLAY_DATA_PACKET__INFO_PACKET_SCAN       0x00000002
+
+///\defgroup define_display_packet Display Data Packet Types
+// @{
+#define ADL_DL_DISPLAY_DATA_PACKET__TYPE__AVI              0x00000001
+#define ADL_DL_DISPLAY_DATA_PACKET__TYPE__RESERVED         0x00000002
+#define ADL_DL_DISPLAY_DATA_PACKET__TYPE__VENDORINFO       0x00000004
+// @}
+
+// matrix types
+#define ADL_GAMUT_MATRIX_SD         1   // SD matrix i.e. BT601
+#define ADL_GAMUT_MATRIX_HD         2   // HD matrix i.e. BT709
+
+///\defgroup define_clockinfo_flags Clock flags
+/// Used by ADLAdapterODClockInfo.iFlag
+// @{
+#define ADL_DL_CLOCKINFO_FLAG_FULLSCREEN3DONLY         0x00000001
+#define ADL_DL_CLOCKINFO_FLAG_ALWAYSFULLSCREEN3D       0x00000002
+#define ADL_DL_CLOCKINFO_FLAG_VPURECOVERYREDUCED       0x00000004
+#define ADL_DL_CLOCKINFO_FLAG_THERMALPROTECTION        0x00000008
+// @}
+
+// Supported GPUs
+// ADL_Display_PowerXpressActiveGPU_Get()
+#define ADL_DL_POWERXPRESS_GPU_INTEGRATED              1
+#define ADL_DL_POWERXPRESS_GPU_DISCRETE                        2
+
+// Possible values for lpOperationResult
+// ADL_Display_PowerXpressActiveGPU_Get()
+#define ADL_DL_POWERXPRESS_SWITCH_RESULT_STARTED         1 // Switch procedure has been started - Windows platform only
+#define ADL_DL_POWERXPRESS_SWITCH_RESULT_DECLINED        2 // Switch procedure cannot be started - All platforms
+#define ADL_DL_POWERXPRESS_SWITCH_RESULT_ALREADY         3 // System already has required status  - All platforms
+#define ADL_DL_POWERXPRESS_SWITCH_RESULT_DEFERRED        5  // Switch was deferred and requires an X restart - Linux platform only
+
+// PowerXpress support version
+// ADL_Display_PowerXpressVersion_Get()
+#define ADL_DL_POWERXPRESS_VERSION_MAJOR                       2       // Current PowerXpress support version 2.0
+#define ADL_DL_POWERXPRESS_VERSION_MINOR                       0
+
+#define ADL_DL_POWERXPRESS_VERSION     (((ADL_DL_POWERXPRESS_VERSION_MAJOR) << 16) | ADL_DL_POWERXPRESS_VERSION_MINOR)
+
+//values for ADLThermalControllerInfo.iThermalControllerDomain
+#define ADL_DL_THERMAL_DOMAIN_OTHER      0
+#define ADL_DL_THERMAL_DOMAIN_GPU        1
+
+//values for ADLThermalControllerInfo.iFlags
+#define ADL_DL_THERMAL_FLAG_INTERRUPT    1
+#define ADL_DL_THERMAL_FLAG_FANCONTROL   2
+
+///\defgroup define_fanctrl Fan speed cotrol
+/// Values for ADLFanSpeedInfo.iFlags
+// @{
+#define ADL_DL_FANCTRL_SUPPORTS_PERCENT_READ     1
+#define ADL_DL_FANCTRL_SUPPORTS_PERCENT_WRITE    2
+#define ADL_DL_FANCTRL_SUPPORTS_RPM_READ         4
+#define ADL_DL_FANCTRL_SUPPORTS_RPM_WRITE        8
+// @}
+
+//values for ADLFanSpeedValue.iSpeedType
+#define ADL_DL_FANCTRL_SPEED_TYPE_PERCENT    1
+#define ADL_DL_FANCTRL_SPEED_TYPE_RPM        2
+
+//values for ADLFanSpeedValue.iFlags
+#define ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED   1
+
+// MVPU interfaces
+#define ADL_DL_MAX_MVPU_ADAPTERS   4
+#define MVPU_ADAPTER_0       0x00000001
+#define MVPU_ADAPTER_1           0x00000002
+#define MVPU_ADAPTER_2           0x00000004
+#define MVPU_ADAPTER_3           0x00000008
+#define ADL_DL_MAX_REGISTRY_PATH   256
+
+//values for ADLMVPUStatus.iStatus
+#define ADL_DL_MVPU_STATUS_OFF   0
+#define ADL_DL_MVPU_STATUS_ON    1
+
+// values for ASIC family
+///\defgroup define_Asic_type Detailed asic types
+/// Defines for Adapter ASIC family type
+// @{
+#define ADL_ASIC_UNDEFINED     0
+#define ADL_ASIC_DISCRETE      (1 << 0)
+#define ADL_ASIC_INTEGRATED    (1 << 1)
+#define ADL_ASIC_FIREGL                (1 << 2)
+#define ADL_ASIC_FIREMV                (1 << 3)
+#define ADL_ASIC_XGP           (1 << 4)
+#define ADL_ASIC_FUSION                (1 << 5)
+#define ADL_ASIC_FIRESTREAM (1 << 6)
+// @}
+
+///\defgroup define_detailed_timing_flags Detailed Timimg Flags
+/// Defines for ADLDetailedTiming.sTimingFlags field
+// @{
+#define ADL_DL_TIMINGFLAG_DOUBLE_SCAN              0x0001
+#define ADL_DL_TIMINGFLAG_INTERLACED               0x0002
+#define ADL_DL_TIMINGFLAG_H_SYNC_POLARITY          0x0004
+#define ADL_DL_TIMINGFLAG_V_SYNC_POLARITY          0x0008
+// @}
+
+///\defgroup define_modetiming_standard Timing Standards
+/// Defines for ADLDisplayModeInfo.iTimingStandard field
+// @{
+#define ADL_DL_MODETIMING_STANDARD_CVT             0x00000001 // CVT Standard
+#define ADL_DL_MODETIMING_STANDARD_GTF             0x00000002 // GFT Standard
+#define ADL_DL_MODETIMING_STANDARD_DMT             0x00000004 // DMT Standard
+#define ADL_DL_MODETIMING_STANDARD_CUSTOM          0x00000008 // User-defined standard
+#define ADL_DL_MODETIMING_STANDARD_DRIVER_DEFAULT  0x00000010 // Remove Mode from overriden list
+// @}
+
+// \defgroup define_xserverinfo driver x-server info
+/// These flags are used by ADL_XServerInfo_Get()
+// @
+
+/// Xinerama is active in the x-server, Xinerama extension may report it to be active but it
+/// may not be active in x-server
+#define ADL_XSERVERINFO_XINERAMAACTIVE            (1<<0)
+
+/// RandR 1.2 is supported by driver, RandR extension may report version 1.2 
+/// but driver may not support it
+#define ADL_XSERVERINFO_RANDR12SUPPORTED          (1<<1)
+// @
+
+
+///\defgroup define_eyefinity_constants Eyefinity Definitions
+// @{
+
+#define ADL_CONTROLLERVECTOR_0         1       // ADL_CONTROLLERINDEX_0 = 0, (1 << ADL_CONTROLLERINDEX_0)
+#define ADL_CONTROLLERVECTOR_1         2       // ADL_CONTROLLERINDEX_1 = 1, (1 << ADL_CONTROLLERINDEX_1)
+
+#define ADL_DISPLAY_SLSGRID_ORIENTATION_000            0x00000001
+#define ADL_DISPLAY_SLSGRID_ORIENTATION_090            0x00000002
+#define ADL_DISPLAY_SLSGRID_ORIENTATION_180            0x00000004
+#define ADL_DISPLAY_SLSGRID_ORIENTATION_270            0x00000008
+#define ADL_DISPLAY_SLSGRID_CAP_OPTION_RELATIVETO_LANDSCAPE    0x00000001
+#define ADL_DISPLAY_SLSGRID_CAP_OPTION_RELATIVETO_CURRENTANGLE         0x00000002
+#define ADL_DISPLAY_SLSGRID_PORTAIT_MODE                                               0x00000004
+
+
+#define ADL_DISPLAY_SLSMAPCONFIG_GET_OPTION_RELATIVETO_LANDSCAPE               0x00000001
+#define ADL_DISPLAY_SLSMAPCONFIG_GET_OPTION_RELATIVETO_CURRENTANGLE    0x00000002
+
+#define ADL_DISPLAY_SLSMAPCONFIG_CREATE_OPTION_RELATIVETO_LANDSCAPE            0x00000001
+#define ADL_DISPLAY_SLSMAPCONFIG_CREATE_OPTION_RELATIVETO_CURRENTANGLE         0x00000002
+
+#define ADL_DISPLAY_SLSMAPCONFIG_REARRANGE_OPTION_RELATIVETO_LANDSCAPE         0x00000001
+#define ADL_DISPLAY_SLSMAPCONFIG_REARRANGE_OPTION_RELATIVETO_CURRENTANGLE      0x00000002
+
+
+#define ADL_DISPLAY_SLSGRID_RELATIVETO_LANDSCAPE               0x00000010
+#define ADL_DISPLAY_SLSGRID_RELATIVETO_CURRENTANGLE    0x00000020
+
+
+/// The bit mask identifies displays is currently in bezel mode.
+#define ADL_DISPLAY_SLSMAP_BEZELMODE                   0x00000010
+/// The bit mask identifies displays from this map is arranged.
+#define ADL_DISPLAY_SLSMAP_DISPLAYARRANGED             0x00000002
+/// The bit mask identifies this map is currently in used for the current adapter.
+#define ADL_DISPLAY_SLSMAP_CURRENTCONFIG               0x00000004
+
+ ///For onlay active SLS  map info
+#define ADL_DISPLAY_SLSMAPINDEXLIST_OPTION_ACTIVE              0x00000001
+
+///For Bezel
+#define ADL_DISPLAY_BEZELOFFSET_STEPBYSTEPSET                  0x00000004
+#define ADL_DISPLAY_BEZELOFFSET_COMMIT                                 0x00000008
+
+// @}
+
+///\defgroup define_powerxpress_constants PowerXpress Definitions
+// @{
+
+/// The bit mask identifies PX caps for ADLPXConfigCaps.iPXConfigCapMask and ADLPXConfigCaps.iPXConfigCapValue
+#define        ADL_PX_CONFIGCAPS_SPLASHSCREEN_SUPPORT          0x0001
+#define        ADL_PX_CONFIGCAPS_CF_SUPPORT                            0x0002
+#define        ADL_PX_CONFIGCAPS_MUXLESS                                       0x0004
+#define        ADL_PX_CONFIGCAPS_PROFILE_COMPLIANT                     0x0008
+#define        ADL_PX_CONFIGCAPS_NON_AMD_DRIVEN_DISPLAYS       0x0010
+#define ADL_PX_CONFIGCAPS_FIXED_SUPPORT             0x0020
+#define ADL_PX_CONFIGCAPS_DYNAMIC_SUPPORT           0x0040
+#define ADL_PX_CONFIGCAPS_HIDE_AUTO_SWITCH                     0x0080
+
+/// The bit mask identifies PX schemes for ADLPXSchemeRange
+#define ADL_PX_SCHEMEMASK_FIXED                                                0x0001
+#define ADL_PX_SCHEMEMASK_DYNAMIC                                      0x0002
+
+/// PX Schemes
+typedef enum _ADLPXScheme
+{
+    ADL_PX_SCHEME_INVALID   = 0,
+    ADL_PX_SCHEME_FIXED     = ADL_PX_SCHEMEMASK_FIXED,
+    ADL_PX_SCHEME_DYNAMIC   = ADL_PX_SCHEMEMASK_DYNAMIC,
+}ADLPXScheme;
+
+/// Just keep the old definitions for compatibility, need to be removed later
+typedef enum PXScheme
+{
+       PX_SCHEME_INVALID   = 0,
+       PX_SCHEME_FIXED     = 1,
+       PX_SCHEME_DYNAMIC   = 2
+} PXScheme;
+
+
+// @}
+
+///\defgroup define_appprofiles For Application Profiles
+// @{
+
+#define ADL_APP_PROFILE_FILENAME_LENGTH                64
+#define ADL_APP_PROFILE_TIMESTAMP_LENGTH       32
+#define ADL_APP_PROFILE_VERSION_LENGTH         32
+#define ADL_APP_PROFILE_PROPERTY_LENGTH                64
+
+enum ApplicationListType
+{
+       ADL_PX40_MRU,
+       ADL_PX40_MISSED,
+       ADL_PX40_DISCRETE,
+       ADL_PX40_INTEGRATED,
+
+       ADL_PX40_TOTAL,
+};
+
+typedef enum _ADLProfilePropertyType
+{
+       ADL_PROFILEPROPERTY_TYPE_BINARY         = 0,
+       ADL_PROFILEPROPERTY_TYPE_BOOLEAN,
+       ADL_PROFILEPROPERTY_TYPE_DWORD,
+       ADL_PROFILEPROPERTY_TYPE_QWORD,
+       ADL_PROFILEPROPERTY_TYPE_ENUMERATED,
+       ADL_PROFILEPROPERTY_TYPE_STRING,
+}ADLProfilePropertyType;
+
+// @}
+
+///\defgroup define_dp12 For Display Port 1.2
+// @{
+
+/// Maximum Relative Address Link
+#define ADL_MAX_RAD_LINK_COUNT 15
+
+// @}
+
+///\defgroup defines_gamutspace Driver Supported Gamut Space
+// @{
+
+/// The flags desribes that gamut is related to source or to destination and to overlay or to graphics
+#define ADL_GAMUT_REFERENCE_SOURCE       (1 << 0)
+#define ADL_GAMUT_GAMUT_VIDEO_CONTENT    (1 << 1)
+
+/// The flags are used to describe the source of gamut and how read information from struct ADLGamutData
+#define ADL_CUSTOM_WHITE_POINT           (1 << 0)
+#define ADL_CUSTOM_GAMUT                 (1 << 1)
+
+/// The define means the predefined gamut values  .
+///Driver uses to find entry in the table and apply appropriate gamut space.
+#define ADL_GAMUT_SPACE_CCIR_709     (1 << 0)
+#define ADL_GAMUT_SPACE_CCIR_601     (1 << 1)
+#define ADL_GAMUT_SPACE_ADOBE_RGB    (1 << 2)
+#define ADL_GAMUT_SPACE_CIE_RGB      (1 << 3)
+#define ADL_GAMUT_SPACE_CUSTOM       (1 << 4)
+
+/// Predefine white point values are structed similar to gamut .
+#define ADL_WHITE_POINT_5000K       (1 << 0)
+#define ADL_WHITE_POINT_6500K       (1 << 1)
+#define ADL_WHITE_POINT_7500K       (1 << 2)
+#define ADL_WHITE_POINT_9300K       (1 << 3)
+#define ADL_WHITE_POINT_CUSTOM      (1 << 4)
+
+///gamut and white point coordinates are from 0.0 -1.0 and divider is used to find the real value .
+/// X float = X int /divider
+#define ADL_GAMUT_WHITEPOINT_DIVIDER           10000
+
+///gamma a0 coefficient uses the following divider:
+#define ADL_REGAMMA_COEFFICIENT_A0_DIVIDER       10000000
+///gamma a1 ,a2,a3 coefficients use the following divider:
+#define ADL_REGAMMA_COEFFICIENT_A1A2A3_DIVIDER   1000
+
+///describes whether the coefficients are from EDID or custom user values.
+#define ADL_EDID_REGAMMA_COEFFICIENTS          (1 << 0)
+///Used for struct ADLRegamma.Feature if set use gamma ramp , if missing  use regamma coefficents
+#define ADL_USE_GAMMA_RAMP                     (1 << 4)
+
+// @}
+
+/// \defgroup define_ddcinfo_pixelformats DDCInfo Pixel Formats
+// @{
+/// defines for iPanelPixelFormat  in struct ADLDDCInfo2
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_RGB656                       0x00000001L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_RGB666                       0x00000002L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_RGB888                       0x00000004L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_RGB101010                    0x00000008L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_RGB161616                    0x00000010L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_RGB_RESERVED1                0x00000020L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_RGB_RESERVED2                0x00000040L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_RGB_RESERVED3                0x00000080L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_XRGB_BIAS101010              0x00000100L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_YCBCR444_8BPCC               0x00000200L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_YCBCR444_10BPCC              0x00000400L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_YCBCR444_12BPCC              0x00000800L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_YCBCR422_8BPCC               0x00001000L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_YCBCR422_10BPCC              0x00002000L
+#define ADL_DISPLAY_DDCINFO_PIXEL_FORMAT_YCBCR422_12BPCC              0x00004000L
+// @}
+
+
+
+/// \defgroup define_dbd_state Deep Bit Depth
+// @{
+
+/// defines for ADL_Workstation_DeepBitDepth_Get and  ADL_Workstation_DeepBitDepth_Set functions
+// This value indicates that the deep bit depth state is forced off
+#define ADL_DEEPBITDEPTH_FORCEOFF      0 
+/// This value indicates that the deep bit depth state  is set to auto, the driver will automatically enable the 
+/// appropriate deep bit depth state depending on what connected display supports.
+#define ADL_DEEPBITDEPTH_10BPP_AUTO    1
+/// This value indicates that the deep bit depth state  is forced on to 10 bits per pixel, this is regardless if the display 
+/// supports 10 bpp.
+#define ADL_DEEPBITDEPTH_10BPP_FORCEON         2
+
+/// defines for ADLAdapterConfigMemory of ADL_Adapter_ConfigMemory_Get
+/// If this bit is set, it indicates that the Deep Bit Depth pixel is set on the display
+#define ADL_ADAPTER_CONFIGMEMORY_DBD                   (1 << 0)
+/// If this bit is set, it indicates that the display is rotated (90, 180 or 270)
+#define ADL_ADAPTER_CONFIGMEMORY_ROTATE                        (1 << 1)
+/// If this bit is set, it indicates that passive stereo is set on the display
+#define ADL_ADAPTER_CONFIGMEMORY_STEREO_PASSIVE        (1 << 2)
+/// If this bit is set, it indicates that the active stereo is set on the display
+#define ADL_ADAPTER_CONFIGMEMORY_STEREO_ACTIVE (1 << 3)
+/// If this bit is set, it indicates that the tear free vsync is set on the display
+#define ADL_ADAPTER_CONFIGMEMORY_ENHANCEDVSYNC (1 << 4)
+#define ADL_ADAPTER_CONFIGMEMORY_TEARFREEVSYNC (1 << 4)
+/// @}
+
+/// \defgroup define_adl_validmemoryrequiredfields Memory Type
+/// @{
+
+///  This group defines memory types in ADLMemoryRequired struct \n
+/// Indicates that this is the visible memory
+#define ADL_MEMORYREQTYPE_VISIBLE                              (1 << 0)
+/// Indicates that this is the invisible memory.
+#define ADL_MEMORYREQTYPE_INVISIBLE                            (1 << 1)
+/// Indicates that this is amount of visible memory per GPU that should be reserved for all other allocations.
+#define ADL_MEMORYREQTYPE_GPURESERVEDVISIBLE   (1 << 2)
+/// @}
+
+/// \defgroup define_adapter_tear_free_status
+/// Used in ADL_Adapter_TEAR_FREE_Set and ADL_Adapter_TFD_Get functions to indicate the tear free
+/// desktop status.
+/// @{
+/// Tear free desktop is enabled.
+#define ADL_ADAPTER_TEAR_FREE_ON                               1
+/// Tear free desktop can't be enabled due to a lack of graphic adapter memory.
+#define ADL_ADAPTER_TEAR_FREE_NOTENOUGHMEM             -1
+/// Tear free desktop can't be enabled due to quad buffer stereo being enabled.
+#define ADL_ADAPTER_TEAR_FREE_OFF_ERR_QUADBUFFERSTEREO -2
+/// Tear free desktop is disabled.
+#define ADL_ADAPTER_TEAR_FREE_OFF                              0
+/// @}
+
+/// \defgroup define_adapter_crossdisplay_platforminfo
+/// Used in ADL_Adapter_CrossDisplayPlatformInfo_Get function to indicate the Crossdisplay platform info.
+/// @{
+/// CROSSDISPLAY platform.
+#define ADL_CROSSDISPLAY_PLATFORM                                      (1 << 0)
+/// CROSSDISPLAY platform for Lasso station.
+#define ADL_CROSSDISPLAY_PLATFORM_LASSO                                (1 << 1)
+/// CROSSDISPLAY platform for docking station.
+#define ADL_CROSSDISPLAY_PLATFORM_DOCKSTATION          (1 << 2)
+/// @}
+
+/// \defgroup define_adapter_crossdisplay_option
+/// Used in ADL_Adapter_CrossdisplayInfoX2_Set function to indicate cross display options.
+/// @{
+/// Checking if 3D application is runnning. If yes, not to do switch, return ADL_OK_WAIT; otherwise do switch.
+#define ADL_CROSSDISPLAY_OPTION_NONE                   0
+/// Force switching without checking for running 3D applications
+#define ADL_CROSSDISPLAY_OPTION_FORCESWITCH            (1 << 0)
+/// @}
+
+/// \defgroup define_adapter_states Adapter Capabilities
+/// These defines the capabilities supported by an adapter. It is used by \ref ADL_Adapter_ConfigureState_Get
+/// @{
+/// Indicates that the adapter is headless (i.e. no displays can be connected to it)
+#define ADL_ADAPTERCONFIGSTATE_HEADLESS ( 1 << 2 )
+/// Indicates that the adapter is configured to define the main rendering capabilities. For example, adapters
+/// in Crossfire(TM) configuration, this bit would only be set on the adapter driving the display(s).
+#define ADL_ADAPTERCONFIGSTATE_REQUISITE_RENDER ( 1 << 0 )
+/// Indicates that the adapter is configured to be used to unload some of the rendering work for a particular
+/// requisite rendering adapter. For eample, for adapters in a Crossfire configuration, this bit would be set
+/// on all adapters that are currently not driving the display(s)
+#define ADL_ADAPTERCONFIGSTATE_ANCILLARY_RENDER ( 1 << 1 )
+/// @}
+
+/// \defgroup define_controllermode_ulModifiers 
+/// These defines the detailed actions supported by set viewport. It is used by \ref ADL_Display_ViewPort_Set
+/// @{
+/// Indicate that the viewport set will change the view position
+#define ADL_CONTROLLERMODE_CM_MODIFIER_VIEW_POSITION       0x00000001
+/// Indicate that the viewport set will change the view PanLock
+#define ADL_CONTROLLERMODE_CM_MODIFIER_VIEW_PANLOCK        0x00000002
+/// Indicate that the viewport set will change the view size
+#define ADL_CONTROLLERMODE_CM_MODIFIER_VIEW_SIZE           0x00000008
+/// @}
+
+
+// End Bracket for Constants and Definitions. Add new groups ABOVE this line!
+
+// @}
+#endif /* ADL_DEFINES_H_ */
+
+
diff --git a/src/lib/platform/adl/adl_sdk.h b/src/lib/platform/adl/adl_sdk.h
new file mode 100644 (file)
index 0000000..3934a2e
--- /dev/null
@@ -0,0 +1,29 @@
+///
+///  Copyright (c) 2008 - 2009 Advanced Micro Devices, Inc.
+///  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
+///  EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+///  WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
+
+/// \file adl_sdk.h
+/// \brief Contains the definition of the Memory Allocation Callback.\n <b>Included in ADL SDK</b>
+///
+/// \n\n
+/// This file contains the definition of the Memory Allocation Callback.\n
+/// It also includes definitions of the respective structures and constants.\n
+/// <b> This is the only header file to be included in a C/C++ project using ADL </b>
+
+#ifndef ADL_SDK_H_
+#define ADL_SDK_H_
+
+#include "adl_structures.h"
+
+#if !defined(__WINDOWS__)
+#define __stdcall
+#endif /* (LINUX) */
+
+/// Memory Allocation Call back 
+typedef void* ( __stdcall *ADL_MAIN_MALLOC_CALLBACK )( int );
+
+
+#endif /* ADL_SDK_H_ */
diff --git a/src/lib/platform/adl/adl_structures.h b/src/lib/platform/adl/adl_structures.h
new file mode 100644 (file)
index 0000000..927e5e0
--- /dev/null
@@ -0,0 +1,1752 @@
+///
+///  Copyright (c) 2008 - 2012 Advanced Micro Devices, Inc.
+///  THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
+///  EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
+///  WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
+
+/// \file adl_structures.h
+///\brief This file contains the structure declarations that are used by the public ADL interfaces for \ALL platforms.\n <b>Included in ADL SDK</b>
+///
+/// All data structures used in AMD Display Library (ADL) public interfaces should be defined in this header file.
+///
+
+#ifndef ADL_STRUCTURES_H_
+#define ADL_STRUCTURES_H_
+
+#include "adl_defines.h"
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the graphics adapter.
+///
+/// This structure is used to store various information about the graphics adapter.  This 
+/// information can be returned to the user. Alternatively, it can be used to access various driver calls to set
+/// or fetch various settings upon the user's request.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct AdapterInfo
+{
+/// \ALL_STRUCT_MEM
+
+/// Size of the structure.
+    int iSize;
+/// The ADL index handle. One GPU may be associated with one or two index handles
+    int iAdapterIndex;
+/// The unique device ID associated with this adapter.
+    char strUDID[ADL_MAX_PATH];        
+/// The BUS number associated with this adapter.
+    int iBusNumber;
+/// The driver number associated with this adapter.
+    int iDeviceNumber;
+/// The function number.
+    int iFunctionNumber;
+/// The vendor ID associated with this adapter.
+    int iVendorID;
+/// Adapter name.
+    char strAdapterName[ADL_MAX_PATH];
+/// Display name. For example, "\\Display0" for Windows or ":0:0" for Linux.
+    char strDisplayName[ADL_MAX_PATH];
+/// Present or not; 1 if present and 0 if not present.It the logical adapter is present, the display name such as \\.\Display1 can be found from OS
+       int iPresent;                           
+// @}
+
+#if defined (_WIN32) || defined (_WIN64)
+/// \WIN_STRUCT_MEM
+
+/// Exist or not; 1 is exist and 0 is not present.
+    int iExist;
+/// Driver registry path.
+    char strDriverPath[ADL_MAX_PATH];
+/// Driver registry path Ext for.
+    char strDriverPathExt[ADL_MAX_PATH];
+/// PNP string from Windows.
+    char strPNPString[ADL_MAX_PATH];
+/// It is generated from EnumDisplayDevices.
+    int iOSDisplayIndex;       
+// @}
+#endif /* (_WIN32) || (_WIN64) */
+
+#if defined (LINUX)
+/// \LNX_STRUCT_MEM
+
+/// Internal X screen number from GPUMapInfo (DEPRICATED use XScreenInfo)
+    int iXScreenNum;
+/// Internal driver index from GPUMapInfo
+    int iDrvIndex;
+/// \deprecated Internal x config file screen identifier name. Use XScreenInfo instead.
+    char strXScreenConfigName[ADL_MAX_PATH];
+   
+// @}
+#endif /* (LINUX) */
+} AdapterInfo, *LPAdapterInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the Linux X screen information.
+///
+/// This structure is used to store the current screen number and xorg.conf ID name assoicated with an adapter index.  
+/// This structure is updated during ADL_Main_Control_Refresh or ADL_ScreenInfo_Update.  
+/// Note:  This structure should be used in place of iXScreenNum and strXScreenConfigName in AdapterInfo as they will be 
+/// deprecated.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+#if defined (LINUX)
+typedef struct XScreenInfo
+{
+/// Internal X screen number from GPUMapInfo.
+       int iXScreenNum;
+/// Internal x config file screen identifier name.
+    char strXScreenConfigName[ADL_MAX_PATH];
+} XScreenInfo, *LPXScreenInfo;
+#endif /* (LINUX) */
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the ASIC memory.
+///
+/// This structure is used to store various information about the ASIC memory.  This 
+/// information can be returned to the user.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLMemoryInfo
+{
+/// Memory size in bytes.
+    long long iMemorySize;     
+/// Memory type in string.
+    char strMemoryType[ADL_MAX_PATH];
+/// Memory bandwidth in Mbytes/s.
+    long long iMemoryBandwidth;
+} ADLMemoryInfo, *LPADLMemoryInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about memory required by type
+///
+/// This structure is returned by ADL_Adapter_ConfigMemory_Get, which given a desktop and display configuration
+/// will return the Memory used.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLMemoryRequired
+{
+       long long iMemoryReq;           /// Memory in bytes required
+       int iType;                                      /// Type of Memory \ref define_adl_validmemoryrequiredfields
+       int iDisplayFeatureValue;   /// Display features \ref define_adl_visiblememoryfeatures that are using this type of memory
+} ADLMemoryRequired, *LPADLMemoryRequired;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the features associated with a display
+///
+/// This structure is a parameter to ADL_Adapter_ConfigMemory_Get, which given a desktop and display configuration
+/// will return the Memory used.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLMemoryDisplayFeatures
+{
+       int iDisplayIndex;                      /// ADL Display index
+       int iDisplayFeatureValue;       /// features that the display is using \ref define_adl_visiblememoryfeatures
+} ADLMemoryDisplayFeatures, *LPADLMemoryDisplayFeatures;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing DDC information.
+///
+/// This structure is used to store various DDC information that can be returned to the user.
+/// Note that all fields of type int are actually defined as unsigned int types within the driver.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDDCInfo
+{
+/// Size of the structure
+    int  ulSize;
+/// Indicates whether the attached display supports DDC. If this field is zero on return, no other DDC information fields will be used.
+    int  ulSupportsDDC;
+/// Returns the manufacturer ID of the display device. Should be zeroed if this information is not available.
+    int  ulManufacturerID;
+/// Returns the product ID of the display device. Should be zeroed if this information is not available.
+    int  ulProductID;
+/// Returns the name of the display device. Should be zeroed if this information is not available.
+    char cDisplayName[ADL_MAX_DISPLAY_NAME];
+/// Returns the maximum Horizontal supported resolution. Should be zeroed if this information is not available.
+    int  ulMaxHResolution;
+/// Returns the maximum Vertical supported resolution. Should be zeroed if this information is not available.
+    int  ulMaxVResolution;
+/// Returns the maximum supported refresh rate. Should be zeroed if this information is not available.
+    int  ulMaxRefresh;
+/// Returns the display device preferred timing mode's horizontal resolution.
+    int  ulPTMCx;
+/// Returns the display device preferred timing mode's vertical resolution.
+    int  ulPTMCy;
+/// Returns the display device preferred timing mode's refresh rate.
+    int  ulPTMRefreshRate;
+/// Return EDID flags.
+    int  ulDDCInfoFlag;
+} ADLDDCInfo, *LPADLDDCInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing DDC information.
+///
+/// This structure is used to store various DDC information that can be returned to the user.
+/// Note that all fields of type int are actually defined as unsigned int types within the driver.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDDCInfo2
+{
+/// Size of the structure
+    int  ulSize;
+/// Indicates whether the attached display supports DDC. If this field is zero on return, no other DDC 
+/// information fields will be used.
+    int  ulSupportsDDC;
+/// Returns the manufacturer ID of the display device. Should be zeroed if this information is not available.
+    int  ulManufacturerID;
+/// Returns the product ID of the display device. Should be zeroed if this information is not available.
+    int  ulProductID;
+/// Returns the name of the display device. Should be zeroed if this information is not available.
+    char cDisplayName[ADL_MAX_DISPLAY_NAME];
+/// Returns the maximum Horizontal supported resolution. Should be zeroed if this information is not available.
+    int  ulMaxHResolution;
+/// Returns the maximum Vertical supported resolution. Should be zeroed if this information is not available.
+    int  ulMaxVResolution;
+/// Returns the maximum supported refresh rate. Should be zeroed if this information is not available.
+    int  ulMaxRefresh;
+/// Returns the display device preferred timing mode's horizontal resolution.
+    int  ulPTMCx;
+/// Returns the display device preferred timing mode's vertical resolution.
+    int  ulPTMCy;
+/// Returns the display device preferred timing mode's refresh rate.
+    int  ulPTMRefreshRate;
+/// Return EDID flags.
+    int  ulDDCInfoFlag;
+// Returns 1 if the display supported packed pixel, 0 otherwise
+    int bPackedPixelSupported;
+// Returns the Pixel formats the display supports \ref define_ddcinfo_pixelformats
+    int iPanelPixelFormat;
+/// Return EDID serial ID.
+    int  ulSerialID;
+// Reserved for future use
+    int iReserved[26];
+} ADLDDCInfo2, *LPADLDDCInfo2;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information controller Gamma settings.
+///
+/// This structure is used to store the red, green and blue color channel information for the.
+/// controller gamma setting. This information is returned by ADL, and it can also be used to  
+/// set the controller gamma setting.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLGamma
+{
+/// Red color channel gamma value.
+       float fRed;
+/// Green color channel gamma value.
+       float fGreen;
+/// Blue color channel gamma value.
+       float fBlue;
+} ADLGamma, *LPADLGamma;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about component video custom modes.
+///
+/// This structure is used to store the component video custom mode.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLCustomMode
+{
+/// Custom mode flags.  They are returned by the ADL driver.
+       int iFlags;
+/// Custom mode width.
+       int iModeWidth;
+/// Custom mode height.
+       int iModeHeight;
+/// Custom mode base width.
+       int iBaseModeWidth;
+/// Custom mode base height.
+       int iBaseModeHeight;
+/// Custom mode refresh rate.
+       int iRefreshRate;
+} ADLCustomMode, *LPADLCustomMode;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing Clock information for OD5 calls.
+///
+/// This structure is used to retrieve clock information for OD5 calls.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLGetClocksOUT
+{
+    long ulHighCoreClock;
+    long ulHighMemoryClock;
+    long ulHighVddc;
+    long ulCoreMin;
+    long ulCoreMax;
+    long ulMemoryMin;
+    long ulMemoryMax;
+    long ulActivityPercent;
+    long ulCurrentCoreClock;
+    long ulCurrentMemoryClock;
+    long ulReserved;
+} ADLGetClocksOUT;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing HDTV information for display calls.
+///
+/// This structure is used to retrieve HDTV information information for display calls.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDisplayConfig
+{
+/// Size of the structure
+  long ulSize;
+/// HDTV connector type.
+  long ulConnectorType;
+/// HDTV capabilities.
+  long ulDeviceData;
+/// Overridden HDTV capabilities.
+  long ulOverridedDeviceData;
+/// Reserved field
+  long ulReserved;     
+} ADLDisplayConfig;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the display device.
+///
+/// This structure is used to store display device information
+/// such as display index, type, name, connection status, mapped adapter and controller indexes, 
+/// whether or not multiple VPUs are supported, local display connections or not (through Lasso), etc.
+/// This information can be returned to the user. Alternatively, it can be used to access various driver calls to set
+/// or fetch various display device related settings upon the user's request.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDisplayID
+{
+/// The logical display index belonging to this adapter.
+       int iDisplayLogicalIndex;
+
+///\brief The physical display index.
+/// For example, display index 2 from adapter 2 can be used by current adapter 1.\n
+/// So current adapter may enumerate this adapter as logical display 7 but the physical display 
+/// index is still 2.
+       int iDisplayPhysicalIndex;
+
+/// The persistent logical adapter index for the display.
+       int iDisplayLogicalAdapterIndex;
+
+///\brief The persistent physical adapter index for the display.
+/// It can be the current adapter or a non-local adapter. \n
+/// If this adapter index is different than the current adapter, 
+/// the Display Non Local flag is set inside DisplayInfoValue.
+    int iDisplayPhysicalAdapterIndex;
+} ADLDisplayID, *LPADLDisplayID;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the display device.
+///
+/// This structure is used to store various information about the display device.  This 
+/// information can be returned to the user, or used to access various driver calls to set
+/// or fetch various display-device-related settings upon the user's request
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDisplayInfo
+{
+/// The DisplayID structure
+       ADLDisplayID displayID; 
+
+///\deprecated The controller index to which the display is mapped.\n Will not be used in the future\n
+       int  iDisplayControllerIndex;   
+       
+/// The display's EDID name.
+       char strDisplayName[ADL_MAX_PATH];        
+       
+/// The display's manufacturer name.
+       char strDisplayManufacturerName[ADL_MAX_PATH];  
+
+/// The Display type. For example: CRT, TV, CV, DFP.
+       int  iDisplayType; 
+       
+/// The display output type. For example: HDMI, SVIDEO, COMPONMNET VIDEO.
+       int  iDisplayOutputType; 
+       
+/// The connector type for the device.  
+       int  iDisplayConnector; 
+
+///\brief The bit mask identifies the number of bits ADLDisplayInfo is currently using. \n
+/// It will be the sum all the bit definitions in ADL_DISPLAY_DISPLAYINFO_xxx. 
+       int  iDisplayInfoMask; 
+       
+/// The bit mask identifies the display status. \ref define_displayinfomask
+       int  iDisplayInfoValue; 
+} ADLDisplayInfo, *LPADLDisplayInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the display port MST device.
+///
+/// This structure is used to store various MST information about the display port device.  This 
+/// information can be returned to the user, or used to access various driver calls to 
+/// fetch various display-device-related settings upon the user's request
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDisplayDPMSTInfo
+{
+       /// The ADLDisplayID structure
+       ADLDisplayID displayID;
+       
+       /// total bandwidth available on the DP connector
+       int     iTotalAvailableBandwidthInMpbs;
+       /// bandwidth allocated to this display
+       int     iAllocatedBandwidthInMbps;
+
+       // info from DAL DpMstSinkInfo
+       /// string identifier for the display
+       char    strGlobalUniqueIdentifier[ADL_MAX_PATH]; 
+
+       /// The link count of relative address, rad[0] upto rad[linkCount] are valid
+       int             radLinkCount;
+       /// The physical connector ID, used to identify the physical DP port
+       int             iPhysicalConnectorID;
+       
+       /// Relative address, address scheme starts from source side
+       char    rad[ADL_MAX_RAD_LINK_COUNT];
+} ADLDisplayDPMSTInfo, *LPADLDisplayDPMSTInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing the display mode definition used per controller.
+///
+/// This structure is used to store the display mode definition used per controller.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDisplayMode
+{
+/// Vertical resolution (in pixels).
+   int  iPelsHeight;
+/// Horizontal resolution (in pixels).
+   int  iPelsWidth;
+/// Color depth.
+   int  iBitsPerPel;
+/// Refresh rate.
+   int  iDisplayFrequency;
+} ADLDisplayMode;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing detailed timing parameters.
+///
+/// This structure is used to store the detailed timing parameters.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDetailedTiming
+{
+/// Size of the structure.
+     int   iSize;
+/// Timing flags. \ref define_detailed_timing_flags
+     short sTimingFlags;
+/// Total width (columns).
+     short sHTotal;
+/// Displayed width.
+     short sHDisplay;
+/// Horizontal sync signal offset.
+     short sHSyncStart;
+/// Horizontal sync signal width.
+     short sHSyncWidth;
+/// Total height (rows).
+     short sVTotal;
+/// Displayed height.
+     short sVDisplay;
+/// Vertical sync signal offset.
+     short sVSyncStart;
+/// Vertical sync signal width.
+     short sVSyncWidth;
+/// Pixel clock value.
+     short sPixelClock;
+/// Overscan right.
+     short sHOverscanRight;
+/// Overscan left.
+     short sHOverscanLeft;
+/// Overscan bottom.
+     short sVOverscanBottom;
+/// Overscan top.
+     short sVOverscanTop;
+     short sOverscan8B;
+     short sOverscanGR;
+} ADLDetailedTiming;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing display mode information.
+///
+/// This structure is used to store the display mode information.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDisplayModeInfo
+{
+/// Timing standard of the current mode. \ref define_modetiming_standard
+  int  iTimingStandard;
+/// Applicable timing standards for the current mode.
+  int  iPossibleStandard;
+/// Refresh rate factor.
+  int  iRefreshRate;
+/// Num of pixels in a row.
+  int  iPelsWidth;
+/// Num of pixels in a column.
+  int  iPelsHeight;
+/// Detailed timing parameters.
+  ADLDetailedTiming  sDetailedTiming;
+} ADLDisplayModeInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Structure containing information about display property.
+///
+/// This structure is used to store the display property for the current adapter.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDisplayProperty
+{
+/// Must be set to sizeof the structure
+  int iSize;   
+/// Must be set to \ref ADL_DL_DISPLAYPROPERTY_TYPE_EXPANSIONMODE or \ref ADL_DL_DISPLAYPROPERTY_TYPE_USEUNDERSCANSCALING
+  int iPropertyType;
+/// Get or Set \ref ADL_DL_DISPLAYPROPERTY_EXPANSIONMODE_CENTER or \ref ADL_DL_DISPLAYPROPERTY_EXPANSIONMODE_FULLSCREEN or \ref ADL_DL_DISPLAYPROPERTY_EXPANSIONMODE_ASPECTRATIO or \ref ADL_DL_DISPLAYPROPERTY_TYPE_ITCFLAGENABLE
+  int iExpansionMode;
+/// Display Property supported? 1: Supported, 0: Not supported
+  int iSupport;
+/// Display Property current value 
+  int iCurrent;
+/// Display Property Default value
+  int iDefault;                        
+} ADLDisplayProperty;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about Clock.
+///
+/// This structure is used to store the clock information for the current adapter 
+/// such as core clock and memory clock info.
+///\nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLClockInfo
+{
+/// Core clock in 10 KHz.
+    int iCoreClock;
+/// Memory clock in 10 KHz.
+    int iMemoryClock;                  
+} ADLClockInfo, *LPADLClockInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about I2C.
+///
+/// This structure is used to store the I2C information for the current adapter.
+/// This structure is used by the ADL_Display_WriteAndReadI2C() function.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLI2C
+{
+/// Size of the structure
+    int iSize;
+/// Numerical value representing hardware I2C.
+    int iLine;
+/// The 7-bit I2C slave device address, shifted one bit to the left.
+    int iAddress;
+/// The offset of the data from the address.
+    int iOffset;
+/// Read from or write to slave device. \ref ADL_DL_I2C_ACTIONREAD or \ref ADL_DL_I2C_ACTIONWRITE or \ref ADL_DL_I2C_ACTIONREAD_REPEATEDSTART
+    int iAction;
+/// I2C clock speed in KHz.
+    int iSpeed;
+/// A numerical value representing the number of bytes to be sent or received on the I2C bus.
+    int iDataSize;
+/// Address of the characters which are to be sent or received on the I2C bus.
+    char *pcData;              
+} ADLI2C;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about EDID data.
+///
+/// This structure is used to store the information about EDID data for the adapter.
+/// This structure is used by the ADL_Display_EdidData_Get() and ADL_Display_EdidData_Set() functions.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDisplayEDIDData
+{
+/// Size of the structure
+  int iSize;
+/// Set to 0
+  int iFlag;
+  /// Size of cEDIDData. Set by ADL_Display_EdidData_Get() upon return
+  int iEDIDSize;
+/// 0, 1 or 2. If set to 3 or above an error ADL_ERR_INVALID_PARAM is generated
+  int iBlockIndex;
+/// EDID data
+  char cEDIDData[ADL_MAX_EDIDDATA_SIZE];
+/// Reserved
+  int iReserved[4];
+}ADLDisplayEDIDData;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about input of controller overlay adjustment.
+///
+/// This structure is used to store the information about input of controller overlay adjustment for the adapter. 
+/// This structure is used by the ADL_Display_ControllerOverlayAdjustmentCaps_Get, ADL_Display_ControllerOverlayAdjustmentData_Get, and
+/// ADL_Display_ControllerOverlayAdjustmentData_Set() functions.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLControllerOverlayInput
+{
+/// Should be set to the sizeof the structure
+  int  iSize;
+///\ref ADL_DL_CONTROLLER_OVERLAY_ALPHA or \ref ADL_DL_CONTROLLER_OVERLAY_ALPHAPERPIX
+  int  iOverlayAdjust; 
+/// Data.
+  int  iValue;
+/// Should be 0.
+  int  iReserved;                      
+} ADLControllerOverlayInput;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about overlay adjustment.
+///
+/// This structure is used to store the information about overlay adjustment for the adapter. 
+/// This structure is used by the ADLControllerOverlayInfo() function.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLAdjustmentinfo
+{
+/// Default value
+  int iDefault;
+/// Minimum value
+  int iMin;
+/// Maximum Value
+  int iMax;
+/// Step value
+  int iStep;
+} ADLAdjustmentinfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about controller overlay information.
+///
+/// This structure is used to store information about controller overlay info for the adapter.
+/// This structure is used by the ADL_Display_ControllerOverlayAdjustmentCaps_Get() function.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLControllerOverlayInfo
+{
+/// Should be set to the sizeof the structure
+  int                                  iSize;
+/// Data.
+  ADLAdjustmentinfo        sOverlayInfo;
+/// Should be 0.
+  int                                  iReserved[3];
+} ADLControllerOverlayInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing GL-Sync module information.
+///
+/// This structure is used to retrieve GL-Sync module information for
+/// Workstation Framelock/Genlock.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLGLSyncModuleID
+{
+/// Unique GL-Sync module ID.
+       int             iModuleID;
+/// GL-Sync GPU port index (to be passed into ADLGLSyncGenlockConfig.lSignalSource and ADLGlSyncPortControl.lSignalSource).
+       int             iGlSyncGPUPort;
+/// GL-Sync module firmware version of Boot Sector.
+       int             iFWBootSectorVersion;
+/// GL-Sync module firmware version of User Sector.
+       int             iFWUserSectorVersion;
+} ADLGLSyncModuleID , *LPADLGLSyncModuleID;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing GL-Sync ports capabilities.
+///
+/// This structure is used to retrieve hardware capabilities for the ports of the GL-Sync module
+/// for Workstation Framelock/Genlock (such as port type and number of associated LEDs).
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLGLSyncPortCaps
+{
+/// Port type. Bitfield of ADL_GLSYNC_PORTTYPE_*  \ref define_glsync
+       int             iPortType;
+/// Number of LEDs associated for this port.
+       int             iNumOfLEDs;
+}ADLGLSyncPortCaps, *LPADLGLSyncPortCaps;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing GL-Sync Genlock settings.
+///
+/// This structure is used to get and set genlock settings for the GPU ports of the GL-Sync module
+/// for Workstation Framelock/Genlock.\n
+/// \see define_glsync 
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLGLSyncGenlockConfig
+{
+/// Specifies what fields in this structure are valid \ref define_glsync
+       int             iValidMask;
+/// Delay (ms) generating a sync signal.
+       int             iSyncDelay;
+/// Vector of framelock control bits. Bitfield of ADL_GLSYNC_FRAMELOCKCNTL_* \ref define_glsync
+       int             iFramelockCntlVector;
+/// Source of the sync signal. Either GL_Sync GPU Port index or ADL_GLSYNC_SIGNALSOURCE_* \ref define_glsync
+       int             iSignalSource;  
+/// Use sampled sync signal. A value of 0 specifies no sampling.
+       int             iSampleRate;
+/// For interlaced sync signals, the value can be ADL_GLSYNC_SYNCFIELD_1 or *_BOTH \ref define_glsync
+       int             iSyncField;
+/// The signal edge that should trigger synchronization. ADL_GLSYNC_TRIGGEREDGE_* \ref define_glsync
+       int             iTriggerEdge;
+/// Scan rate multiplier applied to the sync signal. ADL_GLSYNC_SCANRATECOEFF_* \ref define_glsync
+       int             iScanRateCoeff;
+}ADLGLSyncGenlockConfig, *LPADLGLSyncGenlockConfig;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing GL-Sync port information.
+///
+/// This structure is used to get status of the GL-Sync ports (BNC or RJ45s)
+/// for Workstation Framelock/Genlock.
+/// \see define_glsync 
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLGlSyncPortInfo
+{
+/// Type of GL-Sync port (ADL_GLSYNC_PORT_*).
+       int             iPortType;
+/// The number of LEDs for this port. It's also filled within ADLGLSyncPortCaps.
+       int             iNumOfLEDs;
+/// Port state ADL_GLSYNC_PORTSTATE_*  \ref define_glsync
+       int             iPortState;
+/// Scanned frequency for this port (vertical refresh rate in milliHz; 60000 means 60 Hz).
+       int             iFrequency;
+/// Used for ADL_GLSYNC_PORT_BNC. It is ADL_GLSYNC_SIGNALTYPE_*   \ref define_glsync
+       int             iSignalType;
+/// Used for ADL_GLSYNC_PORT_RJ45PORT*. It is GL_Sync GPU Port index or ADL_GLSYNC_SIGNALSOURCE_*.  \ref define_glsync
+       int             iSignalSource;  
+
+} ADLGlSyncPortInfo, *LPADLGlSyncPortInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing GL-Sync port control settings.
+///
+/// This structure is used to configure the GL-Sync ports (RJ45s only)
+/// for Workstation Framelock/Genlock.
+/// \see define_glsync 
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLGlSyncPortControl
+{
+/// Port to control ADL_GLSYNC_PORT_RJ45PORT1 or ADL_GLSYNC_PORT_RJ45PORT2   \ref define_glsync
+       int             iPortType;
+/// Port control data ADL_GLSYNC_PORTCNTL_*   \ref define_glsync
+       int             iControlVector; 
+/// Source of the sync signal. Either GL_Sync GPU Port index or ADL_GLSYNC_SIGNALSOURCE_*   \ref define_glsync
+       int             iSignalSource;
+} ADLGlSyncPortControl;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing GL-Sync mode of a display.
+///
+/// This structure is used to get and set GL-Sync mode settings for a display connected to
+/// an adapter attached to a GL-Sync module for Workstation Framelock/Genlock.
+/// \see define_glsync 
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLGlSyncMode
+{
+/// Mode control vector. Bitfield of ADL_GLSYNC_MODECNTL_*   \ref define_glsync
+       int             iControlVector;                 
+/// Mode status vector. Bitfield of ADL_GLSYNC_MODECNTL_STATUS_*   \ref define_glsync
+       int             iStatusVector;
+/// Index of GL-Sync connector used to genlock the display/controller.
+       int             iGLSyncConnectorIndex;
+} ADLGlSyncMode, *LPADLGlSyncMode;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing GL-Sync mode of a display.
+///
+/// This structure is used to get and set GL-Sync mode settings for a display connected to
+/// an adapter attached to a GL-Sync module for Workstation Framelock/Genlock.
+/// \see define_glsync 
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLGlSyncMode2
+{
+/// Mode control vector. Bitfield of ADL_GLSYNC_MODECNTL_*   \ref define_glsync
+       int             iControlVector;                 
+/// Mode status vector. Bitfield of ADL_GLSYNC_MODECNTL_STATUS_*   \ref define_glsync
+       int             iStatusVector;
+/// Index of GL-Sync connector used to genlock the display/controller.
+       int             iGLSyncConnectorIndex;
+/// Index of the display to which this GLSync applies to.
+       int             iDisplayIndex;
+} ADLGlSyncMode2, *LPADLGlSyncMode2;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing the packet info of a display.
+///
+/// This structure is used to get and set the packet information of a display. 
+/// This structure is used by ADLDisplayDataPacket.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct  ADLInfoPacket
+{
+       char hb0;
+       char hb1;
+       char hb2;
+/// sb0~sb27
+       char sb[28]; 
+}ADLInfoPacket;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing the AVI packet info of a display.
+///
+/// This structure is used to get and set AVI the packet info of a display.
+/// This structure is used by ADLDisplayDataPacket.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLAVIInfoPacket  //Valid user defined data/
+{
+/// byte 3, bit 7
+   char bPB3_ITC;
+/// byte 5, bit [7:4].
+   char bPB5;             
+}ADLAVIInfoPacket;
+
+// Overdrive clock setting structure definition.
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing the Overdrive clock setting.
+///
+/// This structure is used to get the Overdrive clock setting.
+/// This structure is used by ADLAdapterODClockInfo.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLODClockSetting
+{
+/// Deafult clock
+       int iDefaultClock;
+/// Current clock
+       int iCurrentClock;
+/// Maximum clcok
+       int iMaxClock;
+/// Minimum clock
+       int iMinClock;
+/// Requested clcock
+       int iRequestedClock;
+/// Step
+       int iStepClock;
+} ADLODClockSetting;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing the Overdrive clock information.
+///
+/// This structure is used to get the Overdrive clock information.
+/// This structure is used by the ADL_Display_ODClockInfo_Get() function.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLAdapterODClockInfo
+{
+/// Size of the structure
+       int iSize;
+/// Flag \ref define_clockinfo_flags
+       int iFlags;
+/// Memory Clock
+       ADLODClockSetting sMemoryClock;
+/// Engine Clock
+       ADLODClockSetting sEngineClock;
+} ADLAdapterODClockInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing the Overdrive clock configuration.
+///
+/// This structure is used to set the Overdrive clock configuration.
+/// This structure is used by the ADL_Display_ODClockConfig_Set() function.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLAdapterODClockConfig
+{
+/// Size of the structure
+  int iSize;
+/// Flag \ref define_clockinfo_flags
+  int iFlags;
+/// Memory Clock
+  int iMemoryClock;
+/// Engine Clock
+  int iEngineClock;
+} ADLAdapterODClockConfig;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about current power management related activity.
+///
+/// This structure is used to store information about current power management related activity.
+/// This structure (Overdrive 5 interfaces) is used by the ADL_PM_CurrentActivity_Get() function.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLPMActivity
+{
+/// Must be set to the size of the structure
+       int iSize;
+/// Current engine clock.
+       int iEngineClock;
+/// Current memory clock.
+       int iMemoryClock;
+/// Current core voltage.
+       int iVddc;
+/// GPU utilization.
+       int iActivityPercent;
+/// Performance level index.
+       int iCurrentPerformanceLevel;
+/// Current PCIE bus speed.
+       int iCurrentBusSpeed;
+/// Number of PCIE bus lanes.
+       int iCurrentBusLanes;
+/// Maximum number of PCIE bus lanes.
+       int iMaximumBusLanes;
+/// Reserved for future purposes.
+       int iReserved;                                                          
+} ADLPMActivity;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about thermal controller.
+///
+/// This structure is used to store information about thermal controller.
+/// This structure is used by ADL_PM_ThermalDevices_Enum.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLThermalControllerInfo
+{
+/// Must be set to the size of the structure
+  int iSize;   
+/// Possible valies: \ref ADL_DL_THERMAL_DOMAIN_OTHER or \ref ADL_DL_THERMAL_DOMAIN_GPU.
+  int iThermalDomain;
+///    GPU 0, 1, etc.
+  int iDomainIndex;
+/// Possible valies: \ref ADL_DL_THERMAL_FLAG_INTERRUPT or \ref ADL_DL_THERMAL_FLAG_FANCONTROL
+  int iFlags;                                          
+} ADLThermalControllerInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about thermal controller temperature.
+///
+/// This structure is used to store information about thermal controller temperature. 
+/// This structure is used by the ADL_PM_Temperature_Get() function.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLTemperature
+{
+/// Must be set to the size of the structure
+  int iSize;   
+/// Temperature in millidegrees Celsius.
+  int iTemperature;  
+} ADLTemperature;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about thermal controller fan speed.
+///
+/// This structure is used to store information about thermal controller fan speed.
+/// This structure is used by the ADL_PM_FanSpeedInfo_Get() function.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLFanSpeedInfo
+{
+/// Must be set to the size of the structure
+  int iSize;   
+/// \ref define_fanctrl
+  int iFlags;
+/// Minimum possible fan speed value in percents.
+  int iMinPercent;
+/// Maximum possible fan speed value in percents.
+  int iMaxPercent;     
+/// Minimum possible fan speed value in RPM.
+  int iMinRPM;
+/// Maximum possible fan speed value in RPM.
+  int iMaxRPM;
+} ADLFanSpeedInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about fan speed reported by thermal controller.
+///
+/// This structure is used to store information about fan speed reported by thermal controller.
+/// This structure is used by the ADL_Overdrive5_FanSpeed_Get() and ADL_Overdrive5_FanSpeed_Set() functions.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLFanSpeedValue
+{
+/// Must be set to the size of the structure
+  int iSize;
+/// Possible valies: \ref ADL_DL_FANCTRL_SPEED_TYPE_PERCENT or \ref ADL_DL_FANCTRL_SPEED_TYPE_RPM
+  int iSpeedType;
+/// Fan speed value
+  int iFanSpeed;
+/// The only flag for now is: \ref ADL_DL_FANCTRL_FLAG_USER_DEFINED_SPEED
+  int iFlags;                          
+} ADLFanSpeedValue;
+
+////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing the range of Overdrive parameter.
+///
+/// This structure is used to store information about the range of Overdrive parameter.
+/// This structure is used by ADLODParameters.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLODParameterRange
+{
+/// Minimum parameter value.
+  int iMin;
+/// Maximum parameter value.
+  int iMax;    
+/// Parameter step value.
+  int iStep;   
+} ADLODParameterRange;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about Overdrive parameters.
+///
+/// This structure is used to store information about Overdrive parameters.
+/// This structure is used by the ADL_Overdrive5_ODParameters_Get() function.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLODParameters
+{
+/// Must be set to the size of the structure
+  int iSize;   
+/// Number of standard performance states.
+  int iNumberOfPerformanceLevels;
+/// Indicates whether the GPU is capable to measure its activity.
+  int iActivityReportingSupported;
+/// Indicates whether the GPU supports discrete performance levels or performance range.
+  int iDiscretePerformanceLevels;
+/// Reserved for future use.
+  int iReserved;       
+/// Engine clock range.
+  ADLODParameterRange sEngineClock;    
+/// Memory clock range.
+  ADLODParameterRange sMemoryClock;
+/// Core voltage range.
+  ADLODParameterRange sVddc;   
+} ADLODParameters;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about Overdrive level.
+///
+/// This structure is used to store information about Overdrive level.
+/// This structure is used by ADLODPerformanceLevels.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLODPerformanceLevel
+{
+/// Engine clock.
+  int iEngineClock;
+/// Memory clock.
+  int iMemoryClock;
+/// Core voltage.
+  int iVddc;
+} ADLODPerformanceLevel;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about Overdrive performance levels.
+///
+/// This structure is used to store information about Overdrive performance levels.
+/// This structure is used by the ADL_Overdrive5_ODPerformanceLevels_Get() and ADL_Overdrive5_ODPerformanceLevels_Set() functions.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLODPerformanceLevels
+{
+/// Must be set to sizeof( \ref ADLODPerformanceLevels ) + sizeof( \ref ADLODPerformanceLevel ) * (ADLODParameters.iNumberOfPerformanceLevels - 1)
+  int iSize;
+  int iReserved;
+/// Array of performance state descriptors. Must have ADLODParameters.iNumberOfPerformanceLevels elements.
+  ADLODPerformanceLevel aLevels [1];   
+} ADLODPerformanceLevels;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the proper CrossfireX chains combinations.
+///
+/// This structure is used to store information about the CrossfireX chains combination for a particular adapter.
+/// This structure is used by the ADL_Adapter_Crossfire_Caps(), ADL_Adapter_Crossfire_Get(), and ADL_Adapter_Crossfire_Set() functions.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLCrossfireComb
+{
+/// Number of adapters in this combination.
+  int iNumLinkAdapter;
+/// A list of ADL indexes of the linked adapters in this combination.
+  int iAdaptLink[3];
+} ADLCrossfireComb;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing CrossfireX state and error information.
+///
+/// This structure is used to store state and error information about a particular adapter CrossfireX combination.
+/// This structure is used by the ADL_Adapter_Crossfire_Get() function.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLCrossfireInfo
+{
+/// Current error code of this CrossfireX combination.
+  int iErrorCode;
+/// Current \ref define_crossfirestate
+  int iState;
+/// If CrossfireX is supported by this combination. The value is either \ref ADL_TRUE or \ref ADL_FALSE.
+  int iSupported;
+} ADLCrossfireInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Structure containing information about the BIOS.
+///
+/// This structure is used to store various information about the Chipset.  This 
+/// information can be returned to the user.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLBiosInfo
+{
+       char strPartNumber[ADL_MAX_PATH];       ///< Part number.
+       char strVersion[ADL_MAX_PATH];          ///< Version number.
+       char strDate[ADL_MAX_PATH];             ///< BIOS date in yyyy/mm/dd hh:mm format.
+} ADLBiosInfo, *LPADLBiosInfo;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Structure containing information about adapter location.
+///
+/// This structure is used to store information about adapter location.
+/// This structure is used by ADLMVPUStatus.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLAdapterLocation
+{
+/// PCI Bus number : 8 bits 
+       int iBus;
+/// Device number : 5 bits
+       int iDevice;
+/// Function number : 3 bits
+       int iFunction;
+} ADLAdapterLocation,ADLBdf;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Structure containing information about MultiVPU capabilities.
+///
+/// This structure is used to store information about MultiVPU capabilities.
+/// This structure is used by the ADL_Display_MVPUCaps_Get() function.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLMVPUCaps
+{
+/// Must be set to sizeof( ADLMVPUCaps ).
+  int iSize;
+/// Number of adapters.
+  int iAdapterCount;
+/// Bits set for all possible MVPU masters. \ref MVPU_ADAPTER_0 .. \ref MVPU_ADAPTER_3
+  int iPossibleMVPUMasters;
+/// Bits set for all possible MVPU slaves. \ref MVPU_ADAPTER_0 .. \ref MVPU_ADAPTER_3
+  int iPossibleMVPUSlaves;
+/// Registry path for each adapter. 
+  char cAdapterPath[ADL_DL_MAX_MVPU_ADAPTERS][ADL_DL_MAX_REGISTRY_PATH];
+} ADLMVPUCaps;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Structure containing information about MultiVPU status.
+///
+/// This structure is used to store information about MultiVPU status.
+/// Ths structure is used by the ADL_Display_MVPUStatus_Get() function.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLMVPUStatus
+{
+/// Must be set to sizeof( ADLMVPUStatus ).
+  int iSize;
+/// Number of active adapters.
+  int iActiveAdapterCount;
+/// MVPU status.
+  int iStatus;
+/// PCI Bus/Device/Function for each active adapter participating in MVPU.
+  ADLAdapterLocation aAdapterLocation[ADL_DL_MAX_MVPU_ADAPTERS];
+} ADLMVPUStatus;
+
+// Displays Manager structures
+
+///////////////////////////////////////////////////////////////////////////
+/// \brief Structure containing information about the activatable source.
+///
+/// This structure is used to store activatable source information
+/// This information can be returned to the user. 
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLActivatableSource 
+{ 
+       /// The Persistent logical Adapter Index. 
+    int iAdapterIndex; 
+       /// The number of Activatable Sources. 
+    int iNumActivatableSources; 
+       /// The bit mask identifies the number of bits ActivatableSourceValue is using. (Not currnetly used)
+       int iActivatableSourceMask;
+       /// The bit mask identifies the status.  (Not currnetly used)
+       int iActivatableSourceValue;
+} ADLActivatableSource, *LPADLActivatableSource; 
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Structure containing information about display mode.
+///
+/// This structure is used to store the display mode for the current adapter 
+/// such as X, Y positions, screen resolutions, orientation, 
+/// color depth, refresh rate, progressive or interlace mode, etc.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+
+typedef struct ADLMode
+{
+/// Adapter index.
+    int iAdapterIndex;
+/// Display IDs.
+    ADLDisplayID displayID;
+/// Screen position X coordinate.
+    int iXPos;
+/// Screen position Y coordinate.
+    int iYPos;
+/// Screen resolution Width.
+    int iXRes;
+/// Screen resolution Height.
+    int iYRes;
+/// Screen Color Depth. E.g., 16, 32.
+    int iColourDepth;
+/// Screen refresh rate. Could be fractional E.g. 59.97
+    float fRefreshRate;
+/// Screen orientation. E.g., 0, 90, 180, 270.
+    int iOrientation;
+/// Vista mode flag indicating Progressive or Interlaced mode.
+    int iModeFlag;
+/// The bit mask identifying the number of bits this Mode is currently using. It is the sum of all the bit definitions defined in \ref define_displaymode
+    int iModeMask;                     
+/// The bit mask identifying the display status. The detailed definition is in  \ref define_displaymode
+    int iModeValue;
+} ADLMode, *LPADLMode;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Structure containing information about display target information.
+///
+/// This structure is used to store the display target information.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDisplayTarget
+{
+       /// The Display ID.
+       ADLDisplayID displayID; 
+
+       /// The display map index identify this manner and the desktop surface.
+       int iDisplayMapIndex; 
+
+       /// The bit mask identifies the number of bits DisplayTarget is currently using. It is the sum of all the bit definitions defined in \ref ADL_DISPLAY_DISPLAYTARGET_PREFERRED.
+       int  iDisplayTargetMask; 
+
+       /// The bit mask identifies the display status. The detailed definition is in \ref ADL_DISPLAY_DISPLAYTARGET_PREFERRED.
+    int  iDisplayTargetValue; 
+
+} ADLDisplayTarget, *LPADLDisplayTarget;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the display SLS bezel Mode information.
+///
+/// This structure is used to store the display SLS bezel Mode information.  
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct tagADLBezelTransientMode
+{
+       /// Adapter Index
+    int iAdapterIndex;
+
+       /// SLS Map Index
+    int iSLSMapIndex;
+
+       /// The mode index
+    int iSLSModeIndex; 
+
+       /// The mode
+       ADLMode displayMode;
+
+       /// The number of bezel offsets belongs to this map 
+    int  iNumBezelOffset; 
+
+       /// The first bezel offset array index in the native mode array 
+    int  iFirstBezelOffsetArrayIndex; 
+
+    /// The bit mask identifies the bits this structure is currently using. It will be the total OR of all the bit definitions.
+    int  iSLSBezelTransientModeMask; 
+       
+    /// The bit mask identifies the display status. The detail definition is defined below.
+       int  iSLSBezelTransientModeValue; 
+       
+} ADLBezelTransientMode, *LPADLBezelTransientMode;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Structure containing information about the adapter display manner.
+///
+/// This structure is used to store adapter display manner information
+/// This information can be returned to the user. Alternatively, it can be used to access various driver calls to
+/// fetch various display device related display manner settings upon the user's request.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLAdapterDisplayCap
+{
+       /// The Persistent logical Adapter Index.
+    int iAdapterIndex; 
+       /// The bit mask identifies the number of bits AdapterDisplayCap is currently using. Sum all the bits defined in ADL_ADAPTER_DISPLAYCAP_XXX
+    int  iAdapterDisplayCapMask;
+       /// The bit mask identifies the status. Refer to ADL_ADAPTER_DISPLAYCAP_XXX
+    int  iAdapterDisplayCapValue; 
+} ADLAdapterDisplayCap, *LPADLAdapterDisplayCap;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about display mapping.
+///
+/// This structure is used to store the display mapping data such as display manner.
+/// For displays with horizontal or vertical stretch manner, 
+/// this structure also stores the display order, display row, and column data.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLDisplayMap
+{
+/// The current display map index. It is the OS desktop index. For example, if the OS index 1 is showing clone mode, the display map will be 1. 
+       int iDisplayMapIndex; 
+       
+/// The Display Mode for the current map
+       ADLMode displayMode; 
+
+/// The number of display targets belongs to this map\n
+       int iNumDisplayTarget; 
+       
+/// The first target array index in the Target array\n
+       int iFirstDisplayTargetArrayIndex; 
+       
+/// The bit mask identifies the number of bits DisplayMap is currently using. It is the sum of all the bit definitions defined in ADL_DISPLAY_DISPLAYMAP_MANNER_xxx.
+       int  iDisplayMapMask; 
+       
+///The bit mask identifies the display status. The detailed definition is in ADL_DISPLAY_DISPLAYMAP_MANNER_xxx.
+       int  iDisplayMapValue; 
+
+} ADLDisplayMap, *LPADLDisplayMap;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Structure containing information about the display device possible map for one GPU
+///
+/// This structure is used to store the display device possible map
+/// This information can be returned to the user. 
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLPossibleMap
+{
+       /// The current PossibleMap index. Each PossibleMap is assigned an index
+    int iIndex;
+       /// The adapter index identifying the GPU for which to validate these Maps & Targets
+       int iAdapterIndex;
+       /// Number of display Maps for this GPU to be validated
+    int iNumDisplayMap;   
+       /// The display Maps list to validate
+    ADLDisplayMap* displayMap;  
+       /// the number of display Targets for these display Maps
+    int iNumDisplayTarget;   
+       /// The display Targets list for these display Maps to be validated.
+    ADLDisplayTarget* displayTarget; 
+} ADLPossibleMap, *LPADLPossibleMap;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Structure containing information about display possible mapping.
+///
+/// This structure is used to store the display possible mapping's controller index for the current display.
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLPossibleMapping
+{
+    int iDisplayIndex;                         ///< The display index. Each display is assigned an index.
+       int iDisplayControllerIndex;    ///< The controller index to which display is mapped.
+       int iDisplayMannerSupported;    ///< The supported display manner.
+} ADLPossibleMapping, *LPADLPossibleMapping;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+/// \brief Structure containing information about the validated display device possible map result.
+///
+/// This structure is used to store the validated display device possible map result
+/// This information can be returned to the user. 
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLPossibleMapResult
+{
+       /// The current display map index. It is the OS Desktop index. For example, OS Index 1 showing clone mode. The Display Map will be 1. 
+    int iIndex; 
+       // The bit mask identifies the number of bits   PossibleMapResult is currently using. It will be the sum all the bit definitions defined in ADL_DISPLAY_POSSIBLEMAPRESULT_VALID.
+       int iPossibleMapResultMask;  
+       /// The bit mask identifies the possible map result. The detail definition is defined in ADL_DISPLAY_POSSIBLEMAPRESULT_XXX.
+       int iPossibleMapResultValue;   
+} ADLPossibleMapResult, *LPADLPossibleMapResult;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the display SLS Grid information.
+///
+/// This structure is used to store the display SLS Grid information.  
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLSLSGrid
+{
+/// The Adapter index.
+       int iAdapterIndex; 
+
+/// The grid index.
+       int  iSLSGridIndex;     
+       
+/// The grid row.
+       int  iSLSGridRow;              
+       
+/// The grid column.
+       int  iSLSGridColumn;    
+
+/// The grid bit mask identifies the number of bits DisplayMap is currently using. Sum of all bits defined in ADL_DISPLAY_SLSGRID_ORIENTATION_XXX
+       int  iSLSGridMask;      
+       
+/// The grid bit value identifies the display status. Refer to ADL_DISPLAY_SLSGRID_ORIENTATION_XXX
+       int  iSLSGridValue;     
+
+} ADLSLSGrid, *LPADLSLSGrid;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the display SLS Map information.
+///
+/// This structure is used to store the display SLS Map information.  
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLSLSMap
+{
+       /// The Adapter Index
+       int iAdapterIndex; 
+
+       /// The current display map index. It is the OS Desktop index. For example, OS Index 1 showing clone mode. The Display Map will be 1. 
+    int iSLSMapIndex; 
+
+       /// Indicate the current grid
+    ADLSLSGrid grid;  
+
+       /// OS surface index
+       int  iSurfaceMapIndex;
+
+        ///  Screen orientation. E.g., 0, 90, 180, 270 
+     int iOrientation;
+
+       /// The number of display targets belongs to this map 
+    int  iNumSLSTarget; 
+   
+       /// The first target array index in the Target array 
+    int  iFirstSLSTargetArrayIndex; 
+       /// The number of native modes belongs to this map
+       int  iNumNativeMode; 
+
+       /// The first native mode array index in the native mode array 
+    int  iFirstNativeModeArrayIndex; 
+
+       /// The number of bezel modes belongs to this map 
+       int  iNumBezelMode; 
+
+       /// The first bezel mode array index in the native mode array 
+    int  iFirstBezelModeArrayIndex; 
+
+       /// The number of bezel offsets belongs to this map 
+       int  iNumBezelOffset; 
+
+       /// The first bezel offset array index in the  
+    int  iFirstBezelOffsetArrayIndex; 
+
+       /// The bit mask identifies the number of bits DisplayMap is currently using. Sum all the bit definitions defined in ADL_DISPLAY_SLSMAP_XXX.
+    int  iSLSMapMask; 
+
+       /// The bit mask identifies the display map status. Refer to ADL_DISPLAY_SLSMAP_XXX 
+    int  iSLSMapValue;
+       
+      
+} ADLSLSMap, *LPADLSLSMap;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the display SLS Offset information.
+///
+/// This structure is used to store the display SLS Offset information.  
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLSLSOffset
+{
+       /// The Adapter Index
+       int iAdapterIndex; 
+
+       /// The current display map index. It is the OS Desktop index. For example, OS Index 1 showing clone mode. The Display Map will be 1. 
+    int iSLSMapIndex; 
+      
+       /// The Display ID.
+       ADLDisplayID displayID; 
+    
+       /// SLS Bezel Mode Index
+       int iBezelModeIndex;
+
+       /// SLS Bezel Offset X 
+       int iBezelOffsetX;  
+
+       /// SLS Bezel Offset Y
+       int iBezelOffsetY;  
+    
+       /// SLS Display Width 
+       int iDisplayWidth;  
+
+       /// SLS Display Height
+       int iDisplayHeight;  
+       
+       /// The bit mask identifies the number of bits Offset is currently using.
+       int iBezelOffsetMask; 
+      
+       /// The bit mask identifies the display status. 
+       int  iBezelffsetValue; 
+} ADLSLSOffset, *LPADLSLSOffset;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the display SLS Mode information.
+///
+/// This structure is used to store the display SLS Mode information.  
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLSLSMode
+{
+       /// The Adapter Index
+       int iAdapterIndex; 
+
+       /// The current display map index. It is the OS Desktop index. For example, OS Index 1 showing clone mode. The Display Map will be 1. 
+    int iSLSMapIndex; 
+
+       /// The mode index
+       int iSLSModeIndex; 
+
+       /// The mode for this map.
+    ADLMode displayMode; 
+
+       /// The bit mask identifies the number of bits Mode is currently using. 
+    int iSLSNativeModeMask; 
+       /// The bit mask identifies the display status. 
+       int iSLSNativeModeValue; 
+} ADLSLSMode, *LPADLSLSMode;
+
+
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the display Possible SLS Map information.
+///
+/// This structure is used to store the display Possible SLS Map information.  
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLPossibleSLSMap
+{
+       /// The current display map index. It is the OS Desktop index. 
+       /// For example, OS Index 1 showing clone mode. The Display Map will be 1. 
+    int iSLSMapIndex; 
+
+       /// Number of display map to be validated.
+    int iNumSLSMap;  
+
+       /// The display map list for validation
+    ADLSLSMap* lpSLSMap;  
+
+       /// the number of display map config to be validated.
+    int iNumSLSTarget;  
+
+       /// The display target list for validation.
+    ADLDisplayTarget* lpDisplayTarget; 
+} ADLPossibleSLSMap, *LPADLPossibleSLSMap;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the SLS targets.
+///
+/// This structure is used to store the SLS targets information.  
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLSLSTarget
+{
+       /// the logic adapter index
+    int iAdapterIndex; 
+
+       /// The SLS map index
+    int iSLSMapIndex; 
+
+       /// The target ID
+    ADLDisplayTarget displayTarget; 
+    
+       /// Target postion X in SLS grid
+       int iSLSGridPositionX; 
+
+       /// Target postion Y in SLS grid
+    int iSLSGridPositionY; 
+
+       /// The view size width, height and rotation angle per SLS Target 
+       ADLMode viewSize; 
+
+       /// The bit mask identifies the bits in iSLSTargetValue are currently used
+    int iSLSTargetMask; 
+
+       /// The bit mask identifies status info. It is for function extension purpose
+    int iSLSTargetValue; 
+
+} ADLSLSTarget, *LPADLSLSTarget;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about the Adapter offset stepping size.
+///
+/// This structure is used to store the Adapter offset stepping size information.  
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLBezelOffsetSteppingSize
+{
+       /// the logic adapter index
+    int iAdapterIndex; 
+
+       /// The SLS map index
+    int iSLSMapIndex; 
+
+       /// Bezel X stepping size offset
+       int iBezelOffsetSteppingSizeX; 
+
+       /// Bezel Y stepping size offset
+       int iBezelOffsetSteppingSizeY; 
+
+       /// Identifies the bits this structure is currently using. It will be the total OR of all the bit definitions.
+       int iBezelOffsetSteppingSizeMask; 
+
+       /// Bit mask identifies the display status.
+       int iBezelOffsetSteppingSizeValue; 
+
+} ADLBezelOffsetSteppingSize, *LPADLBezelOffsetSteppingSize;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about driver supported PowerExpress Config Caps
+///
+/// This structure is used to store the driver supported PowerExpress Config Caps
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLPXConfigCaps
+{
+    /// The Persistent logical Adapter Index.
+    int iAdapterIndex; 
+
+    /// The bit mask identifies the number of bits PowerExpress Config Caps is currently using. It is the sum of all the bit definitions defined in \ref ADL_PX_CONFIGCAPS_XXXX.
+    int  iPXConfigCapMask; 
+
+    /// The bit mask identifies the PowerExpress Config Caps value. The detailed definition is in \ref ADL_PX_CONFIGCAPS_XXXX.
+    int  iPXConfigCapValue; 
+
+} ADLPXConfigCaps, *LPADLPXConfigCaps;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about an application
+///
+/// This structure is used to store basic information of an application
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct _ADLApplicationData
+{
+       /// Path Name
+       char strPathName[ADL_MAX_PATH];
+       /// File Name
+       char strFileName[ADL_APP_PROFILE_FILENAME_LENGTH];
+       /// Creation timestamp
+       char strTimeStamp[ADL_APP_PROFILE_TIMESTAMP_LENGTH];
+       /// Version
+       char strVersion[ADL_APP_PROFILE_VERSION_LENGTH];
+}ADLApplicationData;
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information of a property of an application profile
+///
+/// This structure is used to store property information of an application profile
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct _PropertyRecord
+{
+       /// Property Name
+       char strName [ADL_APP_PROFILE_PROPERTY_LENGTH];
+       /// Property Type
+       ADLProfilePropertyType eType;
+       /// Data Size in bytes
+       int iDataSize;
+       /// Property Value, can be any data type
+       unsigned char uData[1];
+}PropertyRecord;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about an application profile
+///
+/// This structure is used to store information of an application profile
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct _ADLApplicationProfile
+{
+       /// Number of properties
+       int iCount;
+       /// Buffer to store all property records
+       PropertyRecord record[1];
+}ADLApplicationProfile;
+
+// @}
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about an OD5 Power Control feature
+///
+/// This structure is used to store information of an Power Control feature
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct ADLPowerControlInfo 
+{
+/// Minimum value.
+int iMinValue; 
+/// Maximum value.
+int iMaxValue;
+/// The minimum change in between minValue and maxValue.
+int iStepValue;  
+ } ADLPowerControlInfo;
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+///\brief Structure containing information about an controller mode
+///
+/// This structure is used to store information of an controller mode
+/// \nosubgrouping
+////////////////////////////////////////////////////////////////////////////////////////////
+typedef struct _ADLControllerMode
+{
+    /// This falg indicates actions that will be applied by set viewport
+    /// The value can be a combination of ADL_CONTROLLERMODE_CM_MODIFIER_VIEW_POSITION,
+    /// ADL_CONTROLLERMODE_CM_MODIFIER_VIEW_PANLOCK and ADL_CONTROLLERMODE_CM_MODIFIER_VIEW_SIZE
+    int iModifiers;            
+
+    /// Horizontal view starting position
+    int iViewPositionCx;       
+
+    /// Vertical view starting position
+    int iViewPositionCy;       
+
+    /// Horizontal left panlock position
+    int iViewPanLockLeft;      
+
+    /// Horizontal right panlock position
+    int iViewPanLockRight;     
+
+    /// Vertical top panlock position
+    int iViewPanLockTop;       
+
+    /// Vertical bottom panlock position
+    int iViewPanLockBottom;    
+
+    /// View resolution in pixels (width)
+    int iViewResolutionCx;     
+
+    /// View resolution in pixels (hight)
+    int iViewResolutionCy;     
+}ADLControllerMode;
+
+      
+#endif /* ADL_STRUCTURES_H_ */
+
diff --git a/src/lib/platform/nvidia/nv-edid.cpp b/src/lib/platform/nvidia/nv-edid.cpp
new file mode 100644 (file)
index 0000000..0c0bbd6
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#include "nv-edid.h"
+
+using namespace PLATFORM;
+
+uint16_t CNVEdidParser::GetPhysicalAddress(void)
+{
+  uint16_t iPA(0);
+
+#if !defined(__WINDOWS__)
+  FILE *fp = fopen("/proc/acpi/video/NGFX/HDMI/EDID", "r");
+
+  if (fp)
+  {
+    char buf[4096];
+    memset(buf, 0, sizeof(buf));
+    int iPtr(0);
+    char c(0);
+    while (c != EOF)
+    {
+      c = fgetc(fp);
+      if (c != EOF)
+        buf[iPtr++] = c;
+    }
+
+    iPA = CEDIDParser::GetPhysicalAddressFromEDID(buf, iPtr);
+    fclose(fp);
+  }
+#endif
+
+  return iPA;
+}
diff --git a/src/lib/platform/nvidia/nv-edid.h b/src/lib/platform/nvidia/nv-edid.h
new file mode 100644 (file)
index 0000000..81f10ce
--- /dev/null
@@ -0,0 +1,50 @@
+#pragma once
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#define HAS_NVIDIA_EDID_PARSER
+
+#include "../os.h"
+#include "../util/edid.h"
+
+namespace PLATFORM
+{
+  class CNVEdidParser
+  {
+  public:
+    CNVEdidParser(void) {};
+    virtual ~CNVEdidParser(void) {};
+
+    uint16_t GetPhysicalAddress(void);
+
+  };
+}
diff --git a/src/lib/platform/posix/os-edid.cpp b/src/lib/platform/posix/os-edid.cpp
new file mode 100644 (file)
index 0000000..1a346dc
--- /dev/null
@@ -0,0 +1,41 @@
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#include "../util/edid.h"
+
+using namespace PLATFORM;
+
+uint16_t CEDIDParser::GetPhysicalAddress(void)
+{
+  // TODO
+  return 0;
+}
diff --git a/src/lib/platform/posix/serversocket.cpp b/src/lib/platform/posix/serversocket.cpp
new file mode 100644 (file)
index 0000000..dce13d3
--- /dev/null
@@ -0,0 +1,152 @@
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#include "../os.h"
+#include "../sockets/tcp.h"
+#include "../sockets/serversocket.h"
+
+using namespace std;
+using namespace PLATFORM;
+
+bool CTcpServerSocket::Open(uint64_t UNUSED(iTimeoutMs))
+{
+  bool bReturn(false);
+  struct addrinfo *address(NULL), *addr(NULL);
+  if (!TcpResolveAddress("localhost", m_iPort, &m_iError, &address))
+  {
+    m_strError = strerror(m_iError);
+    return bReturn;
+  }
+
+  for(addr = address; !bReturn && addr; addr = addr->ai_next)
+  {
+    m_socket = TcpCreateSocket(addr, &m_iError);
+    if (m_socket != INVALID_SOCKET_VALUE)
+    {
+      bReturn = true;
+      break;
+    }
+    else
+    {
+      m_strError = strerror(m_iError);
+    }
+  }
+
+  if (bReturn)
+  {
+    m_iError = bind(m_socket, addr->ai_addr, addr->ai_addrlen);
+    if (m_iError)
+    {
+      m_strError = strerror(m_iError);
+      bReturn = false;
+    }
+  }
+
+  freeaddrinfo(address);
+
+  if (bReturn)
+  {
+    m_iError = listen(m_socket, 16);
+    if (m_iError)
+    {
+      m_strError = strerror(m_iError);
+      bReturn = false;
+    }
+  }
+
+  return bReturn;
+}
+
+void CTcpServerSocket::Close(void)
+{
+  if (IsOpen())
+    TcpSocketClose(m_socket);
+  m_socket = INVALID_SOCKET_VALUE;
+}
+
+void CTcpServerSocket::Shutdown(void)
+{
+  Close();
+}
+
+bool CTcpServerSocket::IsOpen(void)
+{
+  return m_socket != INVALID_SOCKET_VALUE;
+}
+
+CStdString CTcpServerSocket::GetError(void)
+{
+  CStdString strError;
+  strError = m_strError.IsEmpty() && m_iError != 0 ? strerror(m_iError) : m_strError;
+  return strError;
+}
+
+int CTcpServerSocket::GetErrorNumber(void)
+{
+  return m_iError;
+}
+
+CStdString CTcpServerSocket::GetName(void)
+{
+  CStdString strName("localhost");
+  return strName;
+}
+
+ISocket* CTcpServerSocket::Accept(void)
+{
+  struct sockaddr clientAddr;
+  unsigned int iClientLen(sizeof(clientAddr));
+  tcp_socket_t client = accept(m_socket, &clientAddr, &iClientLen);
+
+  if (client != INVALID_SOCKET_VALUE)
+  {
+    CTcpClientSocket *socket = new CTcpClientSocket(client);
+    return (ISocket*)socket;
+  }
+
+  m_strError = strerror(m_iError);
+  return NULL;
+}
+
+tcp_socket_t CTcpServerSocket::TcpCreateSocket(struct addrinfo* addr, int* iError)
+{
+  tcp_socket_t fdSock = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol);
+  if (fdSock == INVALID_SOCKET_VALUE)
+  {
+    *iError = errno;
+    return (tcp_socket_t)INVALID_SOCKET_VALUE;
+  }
+
+  TcpSetNoDelay(fdSock);
+
+  return fdSock;
+}
diff --git a/src/lib/platform/sockets/serversocket.h b/src/lib/platform/sockets/serversocket.h
new file mode 100644 (file)
index 0000000..edc7fcd
--- /dev/null
@@ -0,0 +1,90 @@
+#pragma once
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#include "socket.h"
+
+using namespace std;
+
+namespace PLATFORM
+{
+  class IServerSocket : public ISocket
+  {
+  public:
+    IServerSocket() : ISocket() {}
+
+    virtual ~IServerSocket(void) {}
+
+    virtual bool Open(uint64_t iTimeoutMs = 0) = 0;
+    virtual void Close(void) = 0;
+    virtual void Shutdown(void) = 0;
+    virtual bool IsOpen(void) = 0;
+    ssize_t      Write(void* data, size_t len) { (void) data; (void) len; return EINVAL; }
+    ssize_t      Read(void* data, size_t len, uint64_t iTimeoutMs = 0) { (void) data; (void) len; (void) iTimeoutMs; return EINVAL; }
+    virtual CStdString GetError(void) = 0;
+    virtual int GetErrorNumber(void) = 0;
+    virtual CStdString GetName(void) = 0;
+
+    virtual ISocket* Accept(void) = 0;
+  };
+
+  class CTcpServerSocket : public IServerSocket
+  {
+  public:
+    CTcpServerSocket(uint16_t iPort) :
+      IServerSocket(),
+      m_iPort(iPort),
+      m_socket(INVALID_SOCKET_VALUE),
+      m_iError(0) {}
+
+    virtual ~CTcpServerSocket(void) {}
+
+    virtual bool Open(uint64_t iTimeoutMs = 0);
+    virtual void Close(void);
+    virtual void Shutdown(void);
+    virtual bool IsOpen(void);
+    virtual CStdString GetError(void);
+    virtual int GetErrorNumber(void);
+    virtual CStdString GetName(void);
+
+    virtual ISocket* Accept(void);
+
+  protected:
+    virtual tcp_socket_t TcpCreateSocket(struct addrinfo* addr, int* iError);
+
+  protected:
+    uint16_t     m_iPort;
+    tcp_socket_t m_socket;
+    CStdString   m_strError;
+    int          m_iError;
+  };
+}
index ffc372ccacfcad10e7cb90a7d4c7aff94bfc5849..1693354ea329c42573633419903f6bccb9874e3f 100644 (file)
@@ -120,6 +120,48 @@ namespace PLATFORM
       uint16_t   m_iPort;
   };
 
+  class CTcpClientSocket : public CCommonSocket<tcp_socket_t>
+  {
+  public:
+    CTcpClientSocket(tcp_socket_t socket) :
+      CCommonSocket<tcp_socket_t>(socket, "tcpclient") {}
+
+    virtual ~CTcpClientSocket(void) {}
+
+    virtual bool Open(uint64_t iTimeoutMs = 0)
+    {
+      (void) iTimeoutMs;
+      return true;
+    }
+
+    virtual void Close(void)
+    {
+      TcpSocketClose(m_socket);
+      m_socket = INVALID_SOCKET_VALUE;
+    }
+
+    virtual void Shutdown(void)
+    {
+      TcpSocketShutdown(m_socket);
+      m_socket = INVALID_SOCKET_VALUE;
+    }
+
+    virtual ssize_t Write(void* data, size_t len)
+    {
+      return TcpSocketWrite(m_socket, &m_iError, data, len);
+    }
+
+    virtual ssize_t Read(void* data, size_t len, uint64_t iTimeoutMs = 0)
+    {
+      return TcpSocketRead(m_socket, &m_iError, data, len, iTimeoutMs);
+    }
+
+    virtual bool IsOpen(void)
+    {
+      return m_socket != INVALID_SOCKET_VALUE;
+    }
+  };
+
   class CTcpConnection : public CProtectedSocket<CTcpSocket>
   {
   public:
diff --git a/src/lib/platform/util/edid.h b/src/lib/platform/util/edid.h
new file mode 100644 (file)
index 0000000..1db4f99
--- /dev/null
@@ -0,0 +1,68 @@
+#pragma once
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#include "../os.h"
+#include "StdString.h"
+
+namespace PLATFORM
+{
+  class CEDIDParser
+  {
+  public:
+    static uint16_t GetPhysicalAddress(void);
+
+    static uint16_t GetPhysicalAddressFromEDID(unsigned char *data, size_t size)
+    {
+      return GetPhysicalAddressFromEDID((char *)data, size);
+    }
+
+    static uint16_t GetPhysicalAddressFromEDID(char *data, size_t size)
+    {
+      uint16_t iPA(0);
+
+      for (size_t iPtr = 0; iPtr < size - 4; iPtr++)
+      {
+        if (data[iPtr]     == 0x03 &&
+            data[iPtr + 1] == 0x0C &&
+            data[iPtr + 2] == 0x0)
+        {
+          //found the hdmi marker
+          iPA = (data[iPtr + 3] << 8) + data[iPtr + 4];
+          break;
+        }
+      }
+
+      return iPA;
+    }
+  };
+}
diff --git a/src/lib/platform/util/util.h b/src/lib/platform/util/util.h
new file mode 100644 (file)
index 0000000..2b85c63
--- /dev/null
@@ -0,0 +1,34 @@
+#pragma once
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#define DELETE_AND_NULL(t) while (t) { delete (t); (t) = NULL; }
diff --git a/src/lib/platform/windows/os-edid.cpp b/src/lib/platform/windows/os-edid.cpp
new file mode 100644 (file)
index 0000000..f9a1270
--- /dev/null
@@ -0,0 +1,94 @@
+/*
+ * This file is part of the libCEC(R) library.
+ *
+ * libCEC(R) is Copyright (C) 2011-2012 Pulse-Eight Limited.  All rights reserved.
+ * libCEC(R) is an original work, containing original code.
+ *
+ * libCEC(R) is a trademark of Pulse-Eight Limited.
+ *
+ * This program is dual-licensed; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ *
+ * Alternatively, you can license this library under a commercial license,
+ * please contact Pulse-Eight Licensing for more information.
+ *
+ * For more information contact:
+ * Pulse-Eight Licensing       <license@pulse-eight.com>
+ *     http://www.pulse-eight.com/
+ *     http://www.pulse-eight.net/
+ */
+
+#include "../util/edid.h"
+
+#include "windows.h"
+#include "setupapi.h"
+#include "initguid.h"
+#include "stdio.h"
+
+using namespace PLATFORM;
+
+static GUID MONITOR_GUID =  { 0x4D36E96E, 0xE325, 0x11CE, { 0xBF, 0xC1, 0x08, 0x00, 0x2B, 0xE1, 0x03, 0x18 } };
+
+uint16_t GetPhysicalAddressFromDevice(IN HDEVINFO hDevHandle, IN PSP_DEVINFO_DATA deviceInfoData)
+{
+  uint16_t iPA(0);
+
+  HKEY hDevRegKey = SetupDiOpenDevRegKey(hDevHandle, deviceInfoData, DICS_FLAG_GLOBAL, 0, DIREG_DEV, KEY_ALL_ACCESS);
+  if (hDevRegKey)
+  {
+    CHAR  regEntryName[128];
+    DWORD regEntryNameLength(128);
+    DWORD type;
+    LONG  retVal(0);
+
+    for (LONG ptr = 0; iPA == 0 && retVal != ERROR_NO_MORE_ITEMS; ptr++)
+    {
+      BYTE regEntryData[1024];
+      DWORD regEntryDataSize = sizeof(regEntryData);
+
+      retVal = RegEnumValue(hDevRegKey, ptr, &regEntryName[0], &regEntryNameLength, NULL, &type, regEntryData, &regEntryDataSize);
+
+      if (retVal == 0 && !strcmp(regEntryName,"EDID"))
+        iPA = CEDIDParser::GetPhysicalAddressFromEDID(regEntryData, regEntryDataSize);
+    }
+    RegCloseKey(hDevRegKey);
+  }
+
+  return iPA;
+}
+
+uint16_t CEDIDParser::GetPhysicalAddress(void)
+{
+  HDEVINFO hDevHandle;
+  uint16_t iPA(0);
+  SP_DEVINFO_DATA deviceInfoData;
+
+  hDevHandle = SetupDiGetClassDevsEx(&MONITOR_GUID, NULL, NULL, DIGCF_PRESENT, NULL,  NULL, NULL);
+  if (!hDevHandle)
+    return iPA;
+
+  for (int i=0; ERROR_NO_MORE_ITEMS != GetLastError(); i++)
+  {
+    memset(&deviceInfoData, 0, sizeof(SP_DEVINFO_DATA));
+    deviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA);
+
+    if (SetupDiEnumDeviceInfo(hDevHandle,i, &deviceInfoData))
+    {
+      iPA = GetPhysicalAddressFromDevice(hDevHandle, &deviceInfoData);
+    }
+  }
+
+  return iPA;
+}
index 34fd38730821fd78e7e2c2f6045ad29344d62bde..57f61974c725d9e7e54e461fbe5e83b146e03b57 100644 (file)
@@ -774,14 +774,19 @@ bool ProcessCommandR(ICECAdapter *parser, const string &command, string & UNUSED
 {
   if (command == "r")
   {
+    bool bReactivate = parser->IsLibCECActiveSource();
+
     PrintToStdOut("closing the connection");
     parser->Close();
 
     PrintToStdOut("opening a new connection");
     parser->Open(g_strPort.c_str());
 
-    PrintToStdOut("setting active source");
-    parser->SetActiveSource();
+    if (bReactivate)
+    {
+      PrintToStdOut("setting active source");
+      parser->SetActiveSource();
+    }
     return true;
   }