From e462f837eaabff7c6f7b81907e2bca7a64efa26f Mon Sep 17 00:00:00 2001 From: bhanucbp <141142298+bhanucbp@users.noreply.github.com> Date: Wed, 11 Dec 2024 21:23:16 +0000 Subject: [PATCH] gh #44 L3 test case development Updated c test and python code to read the commands from yaml file --- host/tests/classes/hdmiCEC.py | 76 ++- host/tests/classes/hdmiCEC_testConfig.yml | 2 +- .../hdmiCEC_L3_Tests/hdmiCECHelperClass.py | 5 + .../hdmiCEC_L3_Tests/hdmiCECTestCommands.yml | 85 +++- .../hdmiCEC_test01_TransmitCECCommands.py | 35 +- .../hdmiCEC_test02_ReceiveCECCommands.py | 95 +++- profiles/sink/sink_hdmiCEC.yml | 135 +++++ src/test_l3_hdmi_cec_sink_driver.c | 480 +++++++----------- 8 files changed, 557 insertions(+), 356 deletions(-) diff --git a/host/tests/classes/hdmiCEC.py b/host/tests/classes/hdmiCEC.py index a7c3ab4..9cf3c24 100644 --- a/host/tests/classes/hdmiCEC.py +++ b/host/tests/classes/hdmiCEC.py @@ -21,12 +21,9 @@ # * #* ****************************************************************************** -import subprocess +import re import os import sys -from enum import Enum, auto -import re -import yaml # Add parent directory to the system path for module imports dir_path = os.path.dirname(os.path.realpath(__file__)) @@ -119,13 +116,13 @@ def terminate(self): """ result = self.utMenu.select(self.testSuite, "Close HDMI CEC") - def addLogicalAddress(self, logicalAddress:int): + def addLogicalAddress(self, logicalAddress:str='0'): """ Adding the logical address of a specific device. For now Sink to support only the logical address 0. Args: - logicalAddress (int): The Logical address of the DUT. This will be fixed to zero for a sink device for now. + logicalAddress (str): The Logical address of the DUT. This will be fixed to zero for a sink device for now. Returns: None @@ -134,7 +131,7 @@ def addLogicalAddress(self, logicalAddress:int): { "query_type": "direct", "query": "Enter Logical Address:", - "input": str(logicalAddress) + "input": logicalAddress } ] result = self.utMenu.select(self.testSuite, "Add Logical Address", promptWithAnswers) @@ -162,7 +159,7 @@ def getLogicalAddress(self): int: Logical address of the device. """ result = self.utMenu.select( self.testSuite, "Get Logical Address") - connectionStatusPattern = r"Result HdmiCecGetLogicalAddress\(IN:handle:[.*\], OUT:logicalAddress:[.*\]) HDMI_CEC_STATUS:[.*\])" + connectionStatusPattern = r"Result HdmiCecGetLogicalAddress\(IN:handle:\[0x[0-9A-F]+\], OUT:logicalAddress:\[([0-9A-Fa-f]+)\]\)" logicalAddress = self.searchPattern(result, connectionStatusPattern) return logicalAddress @@ -183,7 +180,7 @@ def getPhysicalAddress(self): return physicalAddress - def cecTransmitCmd(self, destLogicalAddress:int, cecCommand:int, cecData:list=None): + def cecTransmitCmd(self, destLogicalAddress:str, cecCommand:str, cecData:list=None): """ Transmit/Broadcast the CEC command and data to the respective destination. @@ -198,12 +195,12 @@ def cecTransmitCmd(self, destLogicalAddress:int, cecCommand:int, cecData:list=No { "query_type": "direct", "query": "Enter a valid Destination Logical Address:", - "input": str(destLogicalAddress) + "input": destLogicalAddress }, { "query_type": "direct", "query": "Enter CEC Command (in hex):", - "input": str(cecCommand) + "input": cecCommand }, ] @@ -218,6 +215,63 @@ def cecTransmitCmd(self, destLogicalAddress:int, cecCommand:int, cecData:list=No result = self.utMenu.select( self.testSuite, "Transmit CEC Command",promptWithAnswers) + def readCallbackDetails (self): + """ + Parses the callback logs from the device. + + Args: + None. + + Returns: + dict: A dictionary with two keys: + - "Received": A list of dictionaries containing details about received opcodes. + - "Response": A list of dictionaries containing details about sent response opcodes. + Each dictionary contains the following keys: + - "Opcode" (str): The opcode value in hexadecimal. + - "Description" (str): A textual description of the opcode. + - "Initiator" (str): The initiator address in hexadecimal. + - "Destination" (str): The destination address in hexadecimal. + - "Data" (list): The data associated with the opcode. + """ + result = { + "Received": [], + "Response": [] + } + callbackLogs = self.testSession.read_all() + + received_pattern = re.compile( + r"Received Opcode: \[([^\]]+)\] \[([^\]]+)\] Initiator: \[([^\]]+)\], Destination: \[([^\]]+)\] Data: \[(.*?)\]" + ) + sent_pattern = re.compile( + r"Sent Response Opcode: \[([^\]]+)\] \[([^\]]+)\] Initiator: \[([^\]]+)\], Destination: \[([^\]]+)\] Data: \[(.*?)\]" + ) + + def parse_data_field(data_field): + # Split the data field into an array of hex values + return ["0x" + value.strip() for value in data_field.split(":")] + + for match in received_pattern.finditer(callbackLogs): + opcode, description, initiator, destination, data = match.groups() + result["Received"].append({ + "Opcode": opcode, + "Description": description, + "Initiator": initiator, + "Destination": destination, + "Data": parse_data_field(data) + }) + + for match in sent_pattern.finditer(callbackLogs): + opcode, description, initiator, destination, data = match.groups() + result["Response"].append({ + "Opcode": opcode, + "Description": description, + "Initiator": initiator, + "Destination": destination, + "Data": parse_data_field(data) + }) + + return result + def __del__(self): """ Cleans up and de-initializes the hdmi cec helper by stopping the test menu. diff --git a/host/tests/classes/hdmiCEC_testConfig.yml b/host/tests/classes/hdmiCEC_testConfig.yml index 40ac032..00f7ba5 100644 --- a/host/tests/classes/hdmiCEC_testConfig.yml +++ b/host/tests/classes/hdmiCEC_testConfig.yml @@ -26,7 +26,7 @@ hdmicec: #List of artifacts folders, test class copies the content of folder to the target device workspace - "../../../bin/" # exectute command, this will appended with the target device workspace path - execute: "run.sh" + execute: "run.sh -p sink_hdmiCEC.yml" type: UT-C # C (UT-C Cunit) / C++ (UT-G (g++ ut-core gtest backend)) suites: 0: diff --git a/host/tests/hdmiCEC_L3_Tests/hdmiCECHelperClass.py b/host/tests/hdmiCEC_L3_Tests/hdmiCECHelperClass.py index 478f421..abba8d4 100755 --- a/host/tests/hdmiCEC_L3_Tests/hdmiCECHelperClass.py +++ b/host/tests/hdmiCEC_L3_Tests/hdmiCECHelperClass.py @@ -69,6 +69,11 @@ def __init__(self, testName:str, qcId:str, log:logModule=None ): self.targetWorkspace = self.cpe.get("target_directory") self.targetWorkspace = os.path.join(self.targetWorkspace, self.moduleName) + self.testCECCommands = os.path.join(dir_path, "hdmiCECTestCommands.yml") + hdmicec = ConfigRead(self.testCECCommands, self.moduleName) + self.cecCommands = hdmicec.fields.get(self.testName) + self.hdmiCECController = self.dut.hdmiCECController + # def testDownloadAssets(self): # """ # Downloads the test artifacts listed in the test setup configuration. diff --git a/host/tests/hdmiCEC_L3_Tests/hdmiCECTestCommands.yml b/host/tests/hdmiCEC_L3_Tests/hdmiCECTestCommands.yml index ecf469e..7b62b96 100644 --- a/host/tests/hdmiCEC_L3_Tests/hdmiCECTestCommands.yml +++ b/host/tests/hdmiCEC_L3_Tests/hdmiCECTestCommands.yml @@ -1,15 +1,72 @@ -hdmiCEC: +hdmicec: test01_TransmitCECCommands: - - command: "0x04" # Image View on - payload: - responses: - - command: "0x36" # Standby - payload: - responses: - - command: "0x9F" # Get CEC version - payload: - responses: - - type: "Get CEC Version" - loop_devices: false # Apply this response to all devices in the device map - payload: "" # Response pattern with placeholders - description: "Device request for CEC version" \ No newline at end of file + - command: "0x82" # Active Soruce + payload: ["0x00", "0x00"] + type: "Broadcast" + - command: "0x90" # "Report power status + payload: ["0x00"] + type: "Direct" + response: null + - command: "0x47" # Give OSD Name + payload: ['0x52', '0x44', '0x4b', '0x20', '0x56', '0x54', '0x53', '0x20', '0x44', '0x65', '0x76', '0x69', '0x63', '0x65'] + type: "Direct" + response: null + test02_ReceiveCECCommands: + - command: "0x04" # Image View on + payload: + type: "Direct" + response: null + - command: "0x85" # Request Active source + payload: + type: "Broadcast" + response: + type: "Broadcast" + command: "0x82" + update_payload: true + payload: ["0x00", "0x00"] + description: "Active Soruce" + - command: "0x91" # Get Menu Language + payload: + type: "Direct" + response: + type: "Broadcast" + command: "0x32" + update_payload: false + payload: ["0x65", "0x6E", "0x67"] + description: "Set Menu Language" + - command: "0x8C" # Give Vendor ID + payload: + type: "Direct" + response: + type: "Broadcast" + command: "0x87" + update_payload: false + payload: ["0x00", "0x00","0x01"] + description: "Device Vendor Id" + - command: "0x8F" # Give power status + payload: + type: "Direct" + response: + type: "Direct" + command: "0x90" + update_payload: false + payload: ["0x00"] + description: "Report power status" + - command: "0x9F" # Get CEC version + payload: + type: "Direct" + response: + type: "Direct" + command: "0x9E" + update_payload: false + payload: ["0x05"] + description: "Device request for CEC version" + - command: "0x46" # Give OSD Name + payload: + type: "Direct" + response: + type: "Direct" + command: "0x47" + update_payload: false + payload: ['0x52', '0x44', '0x4b', '0x20', '0x56', '0x54', '0x53', '0x20', '0x44', '0x65', '0x76', '0x69', '0x63', '0x65'] + description: "Device request OSD name" diff --git a/host/tests/hdmiCEC_L3_Tests/hdmiCEC_test01_TransmitCECCommands.py b/host/tests/hdmiCEC_L3_Tests/hdmiCEC_test01_TransmitCECCommands.py index fb4c648..12488c2 100755 --- a/host/tests/hdmiCEC_L3_Tests/hdmiCEC_test01_TransmitCECCommands.py +++ b/host/tests/hdmiCEC_L3_Tests/hdmiCEC_test01_TransmitCECCommands.py @@ -50,11 +50,8 @@ def __init__(self, log:logModule=None): # Class variables self.testName = "test01_TransmitCECCommands" self.qcID = '1' - self.sourceLogicalAddress = 0 - - self.testCECCommands = os.path.join(dir_path, "hdmiCECTestCommands.yml") - hdmicec = ConfigRead(self.testCECCommands, "hdmiCEC") - self.cecCommands = hdmicec.fields.get(self.testName) + self.tvLogicalAddress = '0' + self.broadcastAddress = 'f' super().__init__(self.testName, self.qcID, log) @@ -74,29 +71,41 @@ def testFunction(self): self.testhdmiCEC.initialise() # Add the logical Address. - self.testhdmiCEC.addLogicalAddress(self.sourceLogicalAddress) + self.testhdmiCEC.addLogicalAddress(self.tvLogicalAddress) + + # Get the logical Address. + deviceLogicalAddress = self.testhdmiCEC.getLogicalAddress() - self.cecDevices = self.cecAdapter.listDevices() + self.cecDevices = self.hdmiCECController.listDevices() + finalResult = True for device in self.cecDevices: logicalAddress = device["logical address"] # To bypass sending the message to TV - if logicalAddress == 0 or logicalAddress == 14: + if logicalAddress == '0' or logicalAddress == 'f': continue for command in self.cecCommands: + result = False cec = command.get("command") payload = command.get("payload") + type = command.get("type") + + destinationLogicalAddress = logicalAddress + if type == "Broadcast": + destinationLogicalAddress = self.broadcastAddress # Transmit Standby command to a specific destination address - self.testhdmiCEC.cecTransmitCmd(logicalAddress, cec, payload) + self.testhdmiCEC.cecTransmitCmd(destinationLogicalAddress, cec, payload) + + self.log.stepStart(f'HdmiCecTx Source: {deviceLogicalAddress} Destination: {destinationLogicalAddress} CEC OPCode: {cec} Payload: {payload}') - self.log.stepStart(f'HdmiCecTx Source: {self.sourceLogicalAddress} Destination: {logicalAddress} CEC OPCode: {cec} Payload: {payload}') + result = self.hdmiCECController.checkTransmitStatus(deviceLogicalAddress, destinationLogicalAddress, cec, payload) - result = self.cecAdapter.checkTransmitStatus(self.sourceLogicalAddress, logicalAddress, cec, payload) + self.log.stepResult(result, f'HdmiCecTx Source: {deviceLogicalAddress} Destination: {destinationLogicalAddress} CEC OPCode: {cec} Payload: {payload}') - self.log.stepResult(result, f'HdmiCecTx Source: {self.sourceLogicalAddress} Destination: {logicalAddress} CEC OPCode: {cec} Payload: {payload}') + finalResult &= result # Remove the Logical Address self.testhdmiCEC.removeLogicalAddress() @@ -104,7 +113,7 @@ def testFunction(self): # Terminate dsAudio Module self.testhdmiCEC.terminate() - return result + return finalResult if __name__ == '__main__': summerLogName = os.path.splitext(os.path.basename(__file__))[0] + "_summery" diff --git a/host/tests/hdmiCEC_L3_Tests/hdmiCEC_test02_ReceiveCECCommands.py b/host/tests/hdmiCEC_L3_Tests/hdmiCEC_test02_ReceiveCECCommands.py index cec862b..329e4de 100644 --- a/host/tests/hdmiCEC_L3_Tests/hdmiCEC_test02_ReceiveCECCommands.py +++ b/host/tests/hdmiCEC_L3_Tests/hdmiCEC_test02_ReceiveCECCommands.py @@ -50,14 +50,37 @@ def __init__(self, log:logModule=None): # Class variables self.testName = "test02_ReceiveCECCommands" self.qcID = '2' - self.sourceLogicalAddress = 0 - - self.testCECCommands = os.path.join(dir_path, "hdmiCECTestCommands.yml") - hdmicec = ConfigRead(self.testCECCommands, "hdmiCEC") - self.cecCommands = hdmicec.fields.get(self.testName) + self.tvLogicalAddress = '0' + self.broadcastAddress = 'f' super().__init__(self.testName, self.qcID, log) + def testVerifyReceivedData(self, callbackData:dict, initiatorLogicalAddress:int, destinationLogicalAddress:int, opCode:str, payload:list): + """ + Verifies the received callback data. + + Args: + callbackData(dict): callback data received + initiatorLogicalAddress(int): Initiator logical address + destinationLogicalAddress(int): Destination logical address + opCode (str): opcode sent + payload (str): Payload Sent + Returns: + bool: Final result of the test. + """ + result = False + for received in callbackData["Received"]: + if (received["Initiator"] == initiatorLogicalAddress and + received["Destination"] == destinationLogicalAddress and + received["Opcode"] == opCode): + result = True + if payload: + for rec, sent in zip(received["Data"][2:], payload): + if rec != sent: + result = False + break + return result + def testFunction(self): """ The main test function that Transmits the Stanby Command and checks the ACK and validates it. @@ -74,29 +97,59 @@ def testFunction(self): self.testhdmiCEC.initialise() # Add the logical Address. - self.testhdmiCEC.addLogicalAddress(self.sourceLogicalAddress) + self.testhdmiCEC.addLogicalAddress(self.tvLogicalAddress) + + # Get the logical Address. + deviceLogicalAddress = self.testhdmiCEC.getLogicalAddress() - self.cecDevices = self.cecAdapter.listDevices() + if deviceLogicalAddress is None: + self.log.error("Failed to get the device logical address") + return False - for device in self.cecDevices: - logicalAddress = device["logical address"] + self.cecAdaptor = self.hdmiCECController.adaptorDetails - # To bypass sending the message to TV - if logicalAddress == 0 or logicalAddress == 14: - continue + if self.cecAdaptor is None: + return False - for command in self.cecCommands: - cec = command.get("command") - payload = command.get("payload") + cecAdapterLogicalAddress = self.cecAdaptor["logical address"] - # Transmit Standby command to a specific destination address - self.testhdmiCEC.cecTransmitCmd(logicalAddress, cec, payload) + finalResult = True + for command in self.cecCommands: + result = False + cecOpcode = command.get("command") + payload = command.get("payload") + response = command.get("response") + type = command.get("type") - self.log.stepStart(f'HdmiCecTx Source: {self.sourceLogicalAddress} Destination: {logicalAddress} CEC OPCode: {cec} Payload: {payload}') + destinationLogicalAddress = deviceLogicalAddress + if type == "Broadcast": + destinationLogicalAddress = self.broadcastAddress - result = self.cecAdapter.checkTransmitStatus(self.sourceLogicalAddress, logicalAddress, cec, payload) + self.log.stepStart(f'Send Test: {cecAdapterLogicalAddress} Destination: {destinationLogicalAddress} CEC OPCode: {cecOpcode} Payload: {payload}') - self.log.stepResult(result, f'HdmiCecTx Source: {self.sourceLogicalAddress} Destination: {logicalAddress} CEC OPCode: {cec} Payload: {payload}') + self.hdmiCECController.sendMessage(cecAdapterLogicalAddress, destinationLogicalAddress, cecOpcode, payload) + + callbackData = self.testhdmiCEC.readCallbackDetails() + + result = self.testVerifyReceivedData(callbackData, cecAdapterLogicalAddress, destinationLogicalAddress, cecOpcode, payload) + + finalResult &= result + + self.log.stepResult(result, f'Send Test: {cecAdapterLogicalAddress} Destination: {destinationLogicalAddress} CEC OPCode: {cecOpcode} Payload: {payload}') + + if response: + destinationLogicalAddress = cecAdapterLogicalAddress + if response.get("type") == "Broadcast": + destinationLogicalAddress = self.broadcastAddress + + cecOpcode = response.get("command") + payload = response.get("payload") + + self.log.stepStart(f'Response Test: {deviceLogicalAddress} Destination: {destinationLogicalAddress} CEC OPCode: {cecOpcode} Payload: {payload}') + result = self.hdmiCECController.checkTransmitStatus(deviceLogicalAddress, destinationLogicalAddress, cecOpcode, payload) + self.log.stepResult(result, f'Response Test: {cecAdapterLogicalAddress} Destination: {destinationLogicalAddress} CEC OPCode: {cecOpcode} Payload: {payload}') + + finalResult &= result # Remove the Logical Address self.testhdmiCEC.removeLogicalAddress() @@ -104,7 +157,7 @@ def testFunction(self): # Terminate dsAudio Module self.testhdmiCEC.terminate() - return result + return finalResult if __name__ == '__main__': summerLogName = os.path.splitext(os.path.basename(__file__))[0] + "_summery" diff --git a/profiles/sink/sink_hdmiCEC.yml b/profiles/sink/sink_hdmiCEC.yml index 323bf59..b4a6d9a 100644 --- a/profiles/sink/sink_hdmiCEC.yml +++ b/profiles/sink/sink_hdmiCEC.yml @@ -4,3 +4,138 @@ hdmicec: features: extendedEnumsSupported: false + + cec_responses: + - command: "0x00" # Feature Abort + payload: + type: "Direct" + response: + type: "Direct" + command: "0x9E" + update_payload: true + payload: ["0x00", "0x00"] + description: "Feature Abort Reason" + - command: "0x04" # Image View on + payload: + type: "Direct" + response: null + - command: "0x0D" # Text View On + payload: + type: "Direct" + response: null + - command: "0x32" # Set Menu Language + payload: + type: "Broadcast" + response: null + - command: "0x36" # Standby + payload: + type: "Both" + response: null + - command: "0x46" # Give OSD Name + payload: + type: "Direct" + response: + type: "Direct" + command: "0x47" + update_payload: false + payload: ["0x52", "0x44", "0x4b", "0x20", "0x56", "0x54", "0x53", "0x20", "0x44", "0x65", "0x76", "0x69", "0x63", "0x65"] + description: "Device request OSD name" + - command: "0x47" # report OSD Name + payload: + type: "Direct" + response: null + - command: "0x64" # Set OSD String + payload: + type: "Direct" + response: null + - command: "0x82" # Active source + payload: + type: "Broadcast" + response: null + - command: "0x83" # Give Physical Address + payload: + type: "Direct" + response: + type: "Broadcast" + command: "0x84" + update_payload: true + payload: ["0x00", "0x00", "0x00"] + description: "Report Physical Address" + - command: "0x84" # Report Physical address + payload: + type: "Broadcast" + response: null + - command: "0x85" # Request Active source + payload: + type: "Broadcast" + response: + type: "Broadcast" + command: "0x82" + update_payload: true + payload: ["0x00", "0x00"] + description: "Active Soruce" + - command: "0x87" # Device Vendor ID + payload: + type: "Broadcast" + response: null + - command: "0x8C" # Give Vendor ID + payload: + type: "Direct" + response: + type: "Broadcast" + command: "0x87" + update_payload: false + payload: ["0x00", "0x00", "0x01"] + description: "Device Vendor Id" + - command: "0x8F" # Give power status + payload: + type: "Direct" + response: + type: "Direct" + command: "0x90" + update_payload: false + payload: ["0x00"] + description: "Report power status" + - command: "0x90" # Power Status + payload: + type: "Direct" + response: null + - command: "0x91" # Get Menu Language + payload: + type: "Direct" + response: + type: "Broadcast" + command: "0x32" + update_payload: false + payload: ["0x65", "0x6E", "0x67"] + description: "Set Menu Language" + - command: "0x9E" # CEC Version + response: null + - command: "0x9F" # Get CEC version + payload: + type: "Direct" + response: + type: "Direct" + command: "0x9E" + update_payload: false + payload: ["0x05"] + description: "Device request for CEC version" + - command: "0xA7" # Request Latency + payload: + type: "Broadcast" + response: + type: "Broadcast" + command: "0xA8" + update_payload: true + # 100msec video delay ((number of milliseconds/2) + 1) + # 200msec audio delay ((number of milliseconds/2) + 1) + # (Bits 1-0) : Audio Ouput Compensated (0 - N/A, 1 - TV audio output is delay compensated, 2 - TV audio output is NOT delay compensated, 3 - TV audio output is Par delay compensated) + # (Bit 2) : 0 - normal latency, 1 - low latency + # Bit(7-3) : Reserved + payload: ["0x00", "0x00", "0x65", "0x00", "0x33"] + description: "Report Physical Address" + - command: "0xA8" # Report Physical Address + payload: + type: "Broadcast" + response: null + diff --git a/src/test_l3_hdmi_cec_sink_driver.c b/src/test_l3_hdmi_cec_sink_driver.c index 799dcf4..c2f71c7 100644 --- a/src/test_l3_hdmi_cec_sink_driver.c +++ b/src/test_l3_hdmi_cec_sink_driver.c @@ -68,52 +68,97 @@ #define HDMI_CEC_MAX_PAYLOAD 128 #define HDMI_CEC_MAX_OSDNAME 15 +#define HDMI_CEC_KVP_SIZE 128 +#define HDMI_CEC_TYPE_SIZE 16 #define UT_LOG_MENU_INFO UT_LOG_INFO -// CEC command map table and supporting function typedef struct { - uint8_t cecCommand; // CEC command code - const char* commandName; // Human-readable command name - int32_t dataLength; // Number of data bytes required for the command + uint8_t cecCommand; // CEC command code + const char* commandName; // Human-readable command name + int32_t dataLength; // Number of data bytes required for the command } CecCommandMap; -CecCommandMap cecCommandTable[] = +typedef struct cecResponse { + uint8_t cecCommand; //CEC opcode + uint32_t payloadSize; //CEC payload size + uint8_t type[UT_KVP_MAX_ELEMENT_SIZE]; //Type of the opcode Broadcast/ Direct + uint8_t payload[HDMI_CEC_MAX_PAYLOAD]; //CEC Payload +} cecResponse_t; + +CecCommandMap cecCommandTable[] = { {0x00, "Feature Abort", 2}, {0x04, "Image View On", 0}, + {0x05, "Tuner Step Increment", 0}, + {0x06, "Tuner Step Decrement", 0}, + {0x07, "Tuner Device Status", 8}, + {0x08, "Give Tuner Device Status", 0}, + {0x09, "Record On", 8}, + {0x0A, "Record Status", 8}, + {0x0B, "Record Off", 0}, {0x0D, "Text View On", 0}, - {0x20, "Active Source", 2}, - {0x32, "Inactive Source", 2}, - {0x36, "Request Active Source", 0}, - {0x41, "Standby", 0}, + {0x0F, "Record TV Screen", 0}, + {0x1A, "Give Deck Status", 0}, + {0x1B, "Deck Status", 1}, + {0x32, "Set Menu Language", 3}, + {0x33, "Clear Analog Timer", 0}, + {0x34, "Set Analog Timer", 8}, + {0x35, "Timer Status", 3}, + {0x36, "Standby", 0}, + {0x41, "Play", 0}, + {0x42, "Deck Control", 1}, + {0x43, "Timer Cleared Status", 1}, {0x44, "User Control Pressed", 1}, {0x45, "User Control Released", 0}, {0x46, "Give OSD Name", 0}, - {0x47, "Set OSD Name", 15}, - {0x82, "Routing Change", 4}, - {0x83, "Routing Information", 2}, - {0x86, "Report Physical Address", 3}, - {0x87, "Request Active Source", 0}, + {0x47, "Set OSD Name", 14}, + {0x64, "Set OSD String", 14}, + {0x67, "Set Timer Program Title", 14}, + {0x70, "System Audio Mode Request", 2}, + {0x71, "Give Audio Status", 0}, + {0x72, "Set System Audio Mode", 1}, + {0x7A, "Report Audio Status", 1}, + {0x7D, "Give System Audio Mode Status", 0}, + {0x7E, "System Audio Mode Status", 1}, + {0x80, "Routing Change", 4}, + {0x81, "Routing Information", 2}, + {0x82, "Active Source", 2}, + {0x83, "Give Physical Address", 0}, + {0x84, "Report Physical Address", 3}, + {0x85, "Request Active Source", 0}, + {0x86, "Set Stream Path", 2}, + {0x87, "Device Vendor ID", 3}, + {0x89, "Vendor Command", 14}, + {0x8A, "Vendor Remote Button Down", 1}, + {0x8B, "Vendor Remote Button Up", 0}, {0x8C, "Give Device Vendor ID", 0}, - {0x89, "Device Vendor ID", 3}, - {0x90, "Vendor Command", 16}, - {0x91, "Vendor Command with ID", 16}, - {0x92, "Give Device Power Status", 0}, - {0x93, "Report Power Status", 1}, + {0x8D, "Menu Request", 1}, + {0x8E, "Menu Status", 1}, + {0x8F, "Give Device Power Status", 0}, + {0x90, "Report Power Status", 1}, + {0x91, "Get Menu Language", 0}, + {0x92, "Select Analog Service", 4}, + {0x93, "Select Digital Service", 4}, + {0x97, "Set Digital Timer", 6}, + {0x99, "Clear Digital Timer", 0}, + {0x9A, "Set Audio Rate", 1}, + {0x9D, "Inactive Source", 2}, {0x9E, "CEC Version", 1}, {0x9F, "Get CEC Version", 0}, - {0xA0, "Get Menu Language", 0}, - {0xA1, "Set Menu Language", 3}, - {0xA5, "Report Physical Address", 3}, - {0xA6, "Request Short Audio Descriptor", 1}, - {0xC0, "Report Audio Status", 1}, - {0xC1, "Give Audio Status", 0}, - {0xC2, "Set System Audio Mode", 1}, - {0xC3, "Report Audio Descriptor", 1}, - {0xC4, "Set Audio Rate", 1}, - // Add more commands as needed + {0xA0, "Vendor Command With ID", 17}, + {0xA1, "Clear External Timer", 0}, + {0xA2, "Set External Timer", 9}, + {0xA7, "Request Current Latency", 2}, + {0xA8, "Report Current Latency", 5}, + {0xC0, "Initiate ARC", 0}, + {0xC1, "Report ARC Initiated", 0}, + {0xC2, "Report ARC Terminated", 0}, + {0xC3, "Request ARC Initiation", 0}, + {0xC4, "Request ARC Termination", 0}, + {0xC5, "Terminate ARC", 0}, + {0xFF, "Abort", 0} }; typedef enum HDMI_CEC_DEVICE_TYPE_T @@ -200,19 +245,8 @@ static int32_t gHandle = 0; static int32_t gLogicalAddress = -1; static uint32_t gPhysicalAddress = -1; static uint8_t *gPhysicalAddressBytes; -static HDMI_CEC_DEVICE_TYPE gDeviceType = HDMI_CEC_TV; -static HDMI_CEC_POWER_STATUS gPowerStatus = HDMI_CEC_ON; -static uint8_t gDeviceVendorID[] = {0x00, 0x00, 0x01}; // Example Vendor ID: 0x000001 -static uint8_t gCECVersion = 0x05; // CEC Version: 1.4 (0x05) -static uint8_t gAudioDelay = (100/2) + 1; //100msec audio delay ((number of milliseconds/2) + 1) -static uint8_t gVideoDelay = (200/2) + 1; //100msec video delay ((number of milliseconds/2) + 1) static uint8_t gBroadcastAddress = 0xF; -//(Bits 1-0) : Audio Ouput Compensated (0 - N/A, 1 - TV audio output is delay compensated, 2 - TV audio output is NOT delay compensated, 3 - TV audio output is Par delay compensated) -//(Bit 2) : 0 - normal latency, 1 - low latency -//Bit(7-3) : Reserved -uint8_t gLatencyFlag = 0x00; - /** * @brief CEC Command with data size mapping function. * @@ -222,7 +256,6 @@ uint8_t gLatencyFlag = 0x00; */ static int32_t getCecCommandInfo(uint8_t cecCommand, const char** commandName, int32_t* dataLength) { - UT_LOG_INFO("In %s(IN: cecCommand: [0x%02X])\n", __FUNCTION__, cecCommand); int32_t tableSize = sizeof(cecCommandTable) / sizeof(CecCommandMap); @@ -232,324 +265,179 @@ static int32_t getCecCommandInfo(uint8_t cecCommand, const char** commandName, i { *commandName = cecCommandTable[i].commandName; *dataLength = cecCommandTable[i].dataLength; - UT_LOG_INFO("Out %s(OUT: commandName: [%s], OUT: dataLength: [%d])\n", __FUNCTION__, *commandName, *dataLength); return 0; // Command found } } - UT_LOG_INFO("Out %s(OUT: Command not found)\n", __FUNCTION__); return -1; // Command not found } -static void handleImageViewOn() -{ - UT_LOG_INFO("Image View On command received.\n"); - // Perform any device-specific action for "Image View On" if needed. - UT_LOG_INFO("Image View On processed.\n"); -} - -static void handleActiveSource(uint8_t *buf, int32_t len) -{ - if (len >= 4) - { - uint16_t physicalAddress = (buf[2] << 8) | buf[3]; // Combine bytes to form the physical address - UT_LOG_INFO("Active Source command received. Physical Address: [0x%04X]\n", physicalAddress); - // Process Active Source as needed. - } - else - { - UT_LOG_ERROR("Active Source command received with insufficient data.\n"); - } -} - -static void handleGivePhysicalAddress(int32_t handle, uint8_t initiator, uint8_t destination, uint8_t *pPhysicalAddress, HDMI_CEC_DEVICE_TYPE deviceType) +/** + * @brief This function clears the stdin buffer. + * + * This function clears the stdin buffer. + */ +static void readAndDiscardRestOfLine(FILE *in) { - uint8_t response[] = { (destination << 4) | initiator, 0x84, (pPhysicalAddress[3] << 4) | pPhysicalAddress[2], (pPhysicalAddress[1] << 4 ) | pPhysicalAddress[0], deviceType}; - int32_t result; - HdmiCecTx(handle, response, sizeof(response), &result); - UT_LOG_INFO("Reported Physical Address response sent with result: %d\n", result); + int32_t c; + while ((c = fgetc(in)) != EOF && c != '\n'); } -static void handleReportPhysicalAddress(uint8_t *buf, int32_t len) +static void readInt(int32_t *value) { - if (len >= 5) - UT_LOG_INFO("Reported Physical Address: 0x%02X:0x%02X:0x%02X:0x%02X, Type: %s\n", (buf[2] >> 4) & 0x0F, buf[2] & 0x0F, (buf[3] >> 4) & 0x0F, buf[3] & 0x0F, UT_Control_GetMapString(cecDeviceType_mapTable, buf[4])); - else - UT_LOG_ERROR("Reported Physical command received with insufficient data.\n"); + scanf("%d", value); + readAndDiscardRestOfLine(stdin); } -static void handleGetCECVersion(int32_t handle, uint8_t initiator, uint8_t destination, uint8_t version) +static void readHex(int32_t *value) { - uint8_t response[] = { (destination << 4) | initiator, 0x9E, version }; - int32_t result; - HdmiCecTx(handle, response, sizeof(response), &result); - UT_LOG_INFO("CEC Version response sent with result: %d\n", result); + scanf("%x", value); + readAndDiscardRestOfLine(stdin); } -static void handleCECVersion(uint8_t *buf, int32_t len) +static bool getCommandResponse(uint8_t opcode, cecResponse_t *pResponse) { - if (len >= 3) - UT_LOG_INFO("Received CEC Version: %x\n", buf[2]); - else - UT_LOG_ERROR("CEC Version command received with insufficient data.\n"); -} + uint32_t numCommands = 0; + char key_string[HDMI_CEC_KVP_SIZE] = {0}; -static void handleGiveDeviceVendorID(int32_t handle, uint8_t initiator, uint8_t destination, uint8_t *pDeviceVendorId) -{ - uint8_t response[] = { (destination << 4) | initiator, 0x87, pDeviceVendorId[0], pDeviceVendorId[1], pDeviceVendorId[2]}; - int32_t result; - HdmiCecTx(handle, response, sizeof(response), &result); - UT_LOG_INFO("Device Vendor ID response sent with result: %d\n", result); -} + memset(pResponse, 0, sizeof(cecResponse_t)); -static void handleDeviceVendorID(uint8_t *buf, int32_t len) -{ - if (len >= 5) - UT_LOG_INFO("Received Device Vendor ID: %x%x%x\n", buf[2], buf[3], buf[4]); - else - UT_LOG_ERROR("Give Device vendor ID command received with insufficient data.\n"); -} + numCommands = UT_KVP_PROFILE_GET_LIST_COUNT("hdmicec/cec_responses"); -static void handleStandby() -{ - UT_LOG_INFO("Standby command received. Initiating standby actions.\n"); - // Implement device-specific standby actions here, such as turning off the display. -} + for(uint32_t i = 0; i < numCommands; i++) + { + uint8_t command; + uint8_t found; -static void handleGiveDeviceInfo(int32_t handle, uint8_t initiator, uint8_t destination) -{ - uint8_t response[] = { (destination << 4) | initiator, 0xA1, 'V', 'T', 'S', ' ', 'D', 'e', 'v', 'i', 'c', 'e' }; // Device Info: "VTS Device" - int32_t result; - HdmiCecTx(handle, response, sizeof(response), &result); - UT_LOG_INFO("Device Info response sent with result: %d\n", result); -} + snprintf(key_string, HDMI_CEC_KVP_SIZE, "hdmicec/cec_responses/%d/command" , i); + command = UT_KVP_PROFILE_GET_UINT8(key_string); -static void handleOsdDisplay(uint8_t *buf, int32_t len) -{ - if (len > 3) - { - uint8_t buffer[HDMI_CEC_MAX_OSDNAME] = {0}; - uint8_t *temp = buffer; - UT_LOG_INFO("OSD Display Control: %d", buf[2]); - for (int32_t i = 3; i < len; i++) + if(command != opcode) { - int32_t len = 0; - len = snprintf(temp, HDMI_CEC_MAX_OSDNAME, "%c", buf[i]); - temp += len; + continue; } - UT_LOG_INFO("OSD Display message received: %s", buffer); - } - else - { - UT_LOG_ERROR("OSD Display message received with insufficient data.\n"); - } -} + snprintf(key_string, HDMI_CEC_KVP_SIZE, "hdmicec/cec_responses/%d/response/command" , i); + found = ut_kvp_fieldPresent(ut_kvp_profile_getInstance(), key_string); -static void handleGiveOSDName(int32_t handle, uint8_t initiator, uint8_t destination) -{ - uint8_t response[] = { (destination << 4) | initiator, 0x47, 'V', 'T', 'S', ' ', 'D', 'e', 'v', 'i', 'c', 'e' }; // OSD Name: "VTS Device" - int32_t result; - HdmiCecTx(handle, response, sizeof(response), &result); - UT_LOG_INFO("OSD Name response sent with result: %d sourc/destination:0x%2x\n", result,response[0]); -} - -static void handleSetOSDName(uint8_t *buf, int32_t len) -{ - if (len > 2) - { - uint8_t buffer[HDMI_CEC_MAX_OSDNAME] = {0}; - uint8_t *temp = buffer; - for (int32_t i = 2; i < len; i++) + if(found) { - int32_t len = 0; - len = snprintf(temp, HDMI_CEC_MAX_OSDNAME, "%c", buf[i]); - temp += len; - } - UT_LOG_INFO("OSD Name received: %s", buffer); - } - else - { - UT_LOG_ERROR("OSD Name message received with insufficient data.\n"); - } -} + pResponse->cecCommand = UT_KVP_PROFILE_GET_UINT8(key_string); -static void handleGivePowerStatus(int32_t handle, uint8_t initiator, uint8_t destination, HDMI_CEC_POWER_STATUS powerStatus) -{ - uint8_t response[] = { (destination << 4) | initiator, 0x90, powerStatus }; - int32_t result; - HdmiCecTx(handle, response, sizeof(response), &result); - UT_LOG_INFO("Power Status response sent with result: %d\n", result); -} + snprintf(key_string, HDMI_CEC_KVP_SIZE, "hdmicec/cec_responses/%d/response/type" , i); + UT_KVP_PROFILE_GET_STRING(key_string, pResponse->type); -static void handleReportPowerStatus(uint8_t *buf, int32_t len) -{ - if (len >= 3) - { - UT_LOG_INFO("Power Status: %s\n", UT_Control_GetMapString(cecPowerStatus_mapTable, buf[2])); - } - else - { - UT_LOG_ERROR("Power Status received with insufficient data.\n"); - } -} + snprintf(key_string, HDMI_CEC_KVP_SIZE, "hdmicec/cec_responses/%d/response/payload" , i); + pResponse->payloadSize = UT_KVP_PROFILE_GET_LIST_COUNT(key_string); -static void handleFeatureAbort(uint8_t *buf, int32_t len) -{ - if (len >= 4) - { - UT_LOG_INFO("Feature Abort: Opcode: 0x%02X, Reason: %s\n", buf[2], UT_Control_GetMapString(cecFeatureAbortReason_mapTable, buf[3])); - } - else - { - UT_LOG_ERROR("Feature Abort received with insufficient data.\n"); + for(uint8_t j = 0; j < pResponse->payloadSize; j++) + { + snprintf(key_string, HDMI_CEC_KVP_SIZE, "hdmicec/cec_responses/%d/response/payload/%d" , i, j); + pResponse->payload[j] = UT_KVP_PROFILE_GET_UINT8(key_string); + } + return true; + } } + return false; } -static void sendFeatureAbort(int32_t handle, uint8_t initiator, uint8_t destination, uint8_t opcode, uint8_t reason) +static void sendResponse(int32_t handle, uint8_t initiator, uint8_t destination, + uint8_t *buf, int32_t len, cecResponse_t *pCecResponse) { - uint8_t response[] = { (destination << 4) | initiator, 0x00, opcode, reason }; // Abort with reason - int32_t result; - HdmiCecTx(handle, response, sizeof(response), &result); - UT_LOG_WARNING("Feature Abort sent for opcode: 0x%02X with reason: 0x%02X, result: %d\n", opcode, reason, result); -} + uint8_t prBuffer[HDMI_CEC_MAX_PAYLOAD] = {0}; + uint8_t response[HDMI_CEC_MAX_PAYLOAD] = {0}; -static void handleSetMenuLanguage(uint8_t *buf, int32_t len) -{ - if (len >= 5) + if (pCecResponse->payloadSize) { - UT_LOG_INFO("OSD Menu Language received: %c%c%c", buf[2], buf[2], buf[3]); - } - else - { - UT_LOG_ERROR("OSD Menu Language received with insufficient data"); - } -} - -static void handleCurrentLatency(int32_t handle, uint8_t *buf, int32_t len, uint8_t *pPhysicalAddress, uint8_t videoDelay, uint8_t audioDelay, uint8_t latency) -{ - uint8_t response[] = {(gLogicalAddress << 4) | gBroadcastAddress, 0xA8, buf[2], buf[3], videoDelay, latency, audioDelay}; - - int32_t result; + int32_t result; + const char* commandName; + int32_t expectedDataLength; - if (len >= 4) - { - if (buf[2] == (pPhysicalAddress[3] << 4) | pPhysicalAddress[2] && - buf[3] == (pPhysicalAddress[1] << 4) | pPhysicalAddress[0]) + if (!strcmp(pCecResponse->type, "Direct")) + { + response[0] = (destination << 4) | initiator; + } + else { - response[4] = videoDelay; - response[5] = latency; - response[6] = audioDelay; + //Send braodcast message + response[0] = (gLogicalAddress << 4) | gBroadcastAddress; + } + response[1] = pCecResponse->cecCommand; - HdmiCecTx(handle, response, sizeof(response), &result); + for (int32_t index = 0; index < pCecResponse->payloadSize; index++) + { + response[index + 2] = pCecResponse->payload[index]; } - } - else - { - UT_LOG_ERROR("Latency query received with insufficient data.\n"); - } -} + { + uint8_t *temp = prBuffer; + // Log each byte received in the buffer + for (int32_t index = 0; index < pCecResponse->payloadSize + 2; index++) + { + int32_t len = 0; + len = snprintf(temp, HDMI_CEC_MAX_PAYLOAD, "%02X:", response[index]); + temp += len; + } + prBuffer[strlen(prBuffer)-1] = '\0'; -static void handleRequestActiveSource(int32_t handle, uint8_t *pPhysicalAddress) -{ - uint8_t response[] = { (gLogicalAddress << 4) | gBroadcastAddress, 0x82, (pPhysicalAddress[3] << 4) | pPhysicalAddress[2], (pPhysicalAddress[1] << 4 ) | pPhysicalAddress[0]}; - int32_t result; - HdmiCecTx(handle, response, sizeof(response), &result); - UT_LOG_INFO("Requested Active Sources response sent with result: %d\n", result); -} + } -/** - * @brief This function clears the stdin buffer. - * - * This function clears the stdin buffer. - */ -static void readAndDiscardRestOfLine(FILE *in) -{ - int32_t c; - while ((c = fgetc(in)) != EOF && c != '\n'); -} + HdmiCecTx(handle, response, pCecResponse->payloadSize + 2, &result); -static void readInt(int32_t *value) -{ - scanf("%d", value); - readAndDiscardRestOfLine(stdin); -} + getCecCommandInfo(pCecResponse->cecCommand, &commandName, &expectedDataLength); -static void readHex(int32_t *value) -{ - scanf("%x", value); - readAndDiscardRestOfLine(stdin); + UT_LOG_INFO("Sent Response Opcode: [0x%02X] [%s] Initiator: [%x], Destination: [%x] Data: [%s]\n", + pCecResponse->cecCommand, commandName, destination, initiator, prBuffer); + } } static void onRxDataReceived(int32_t handle, void *callbackData, uint8_t *buf, int32_t len) { UT_LOG_INFO("In %s(IN: handle: [%p], IN: callbackData: [%p], IN: buf: [%p], IN: len: [%d])\n", __FUNCTION__, handle, callbackData, buf, len); + const char* commandName; + int32_t expectedDataLength; + if ((handle != 0) && (callbackData != NULL) && (len > 0)) { // Parse the command uint8_t initiator = (buf[0] >> 4) & 0xF; // Extract initiator address uint8_t destination = buf[0] & 0xF; // Extract destination address uint8_t opcode; // Command opcode + cecResponse_t cecResponse = {0}; // cec response + uint8_t prBuffer[HDMI_CEC_MAX_PAYLOAD] = {0}; + bool result = false; + if( len == 1) { - UT_LOG_INFO("Received Ping message Initiator: [0x%02X], Destination: [0x%02X]", initiator, destination); - UT_LOG_INFO("Out %s\n", __FUNCTION__); - return; + UT_LOG_INFO("Received Ping message Initiator: [%x], Destination: [%x]", initiator, destination); + goto exit; } opcode = buf[1]; - UT_LOG_INFO("Initiator: [0x%02X], Destination: [0x%02X], Opcode: [0x%02X]", initiator, destination, opcode); - if (len > 2) + if(getCecCommandInfo(opcode, &commandName, &expectedDataLength) != 0) + { + UT_LOG_WARNING("CEC command 0x%02X is not recognized", opcode); + goto exit; + } + { - char buffer[HDMI_CEC_MAX_PAYLOAD] = {0}; - uint8_t *temp = buffer; + uint8_t *temp = prBuffer; // Log each byte received in the buffer - for (int32_t index = 2; index < len; index++) + for (int32_t index = 0; index < len; index++) { int32_t len = 0; - len = snprintf(temp, HDMI_CEC_MAX_PAYLOAD, "0x%02X, ", buf[index]); + len = snprintf(temp, HDMI_CEC_MAX_PAYLOAD, "%02X:", buf[index]); temp += len; } - buffer[strlen(buffer)-2] = '\0'; - UT_LOG_INFO("Payload: [%s]", buffer); + prBuffer[strlen(prBuffer)-1] = '\0'; } - // Handle each opcode with its corresponding function - switch (opcode) - { - // CEC Commands no response sent - case 0x00: handleFeatureAbort(buf, len); break; - case 0x04: handleImageViewOn(); break; - case 0x32: handleSetMenuLanguage(buf, len); break; - case 0x82: handleActiveSource(buf, len); break; - case 0x84: handleReportPhysicalAddress(buf, len); break; - case 0x87: handleDeviceVendorID(buf, len); break; - case 0x36: handleStandby(); break; - case 0x64: handleOsdDisplay(buf, len); break; - case 0x90: handleReportPowerStatus(buf, len); break; - case 0x9E: handleCECVersion(buf, len); break; - case 0x47: handleSetOSDName(buf, len); break; - - // CEC commands with response - case 0x83: handleGivePhysicalAddress(handle, initiator, destination, gPhysicalAddressBytes, gDeviceType); break; - case 0x8F: handleGivePowerStatus(handle, initiator, destination, gPowerStatus); break; - case 0x8C: handleGiveDeviceVendorID(handle, initiator, destination, gDeviceVendorID); break; - case 0x9F: handleGetCECVersion(handle, initiator, destination, gCECVersion); break; - case 0x46: handleGiveOSDName(handle, initiator, destination); break; - - // Broadcasting CEC commands with response - case 0x85: handleRequestActiveSource(handle, gPhysicalAddressBytes); break; - case 0xA7: handleCurrentLatency(handle, buf, len, gPhysicalAddressBytes, gVideoDelay, gAudioDelay, gLatencyFlag); break; - default: - UT_LOG_WARNING("Unhandled opcode: [0x%02X]\n", opcode); - sendFeatureAbort(handle, initiator, destination, opcode, 0x04); // Feature Abort: Unrecognized opcode - break; - } + UT_LOG_INFO("Received Opcode: [0x%02X] [%s] Initiator: [%x], Destination: [%x] Data: [%s]\n", opcode, commandName, initiator, destination, prBuffer); + + result = getCommandResponse(opcode, &cecResponse); - // Clear the buffer after processing - memset(buf, 0, len); + sendResponse(handle, initiator, destination, buf, len, &cecResponse); } else { @@ -567,7 +455,7 @@ static void onRxDataReceived(int32_t handle, void *callbackData, uint8_t *buf, i UT_LOG_ERROR("Error: Invalid length.\n"); } } - +exit: UT_LOG_INFO("Out %s\n", __FUNCTION__); } @@ -653,17 +541,17 @@ void test_l3_hdmi_cec_sink_hal_AddLogicalAddress(void) int32_t getLogicalAddress = -1; UT_LOG_MENU_INFO("Enter Logical Address:"); - readInt(&logicalAddress); + readHex(&logicalAddress); /* Check that logical address should be valid one */ - UT_LOG_INFO("Calling HdmiCecAddLogicalAddress(IN:handle:[0x%0X], IN:logicalAddress:[%d]", gHandle, logicalAddress); + UT_LOG_INFO("Calling HdmiCecAddLogicalAddress(IN:handle:[0x%0X], IN:logicalAddress:[%x]", gHandle, logicalAddress); status = HdmiCecAddLogicalAddress(gHandle, logicalAddress); - UT_LOG_INFO("Result HdmiCecAddLogicalAddress (IN:handle:[0x%0X], IN:logicalAddress:[%d]) HDMI_CEC_STATUS[%s]",gHandle,logicalAddress,UT_Control_GetMapString(cecError_mapTable,status)); + UT_LOG_INFO("Result HdmiCecAddLogicalAddress (IN:handle:[0x%0X], IN:logicalAddress:[%x]) HDMI_CEC_STATUS[%s]",gHandle,logicalAddress,UT_Control_GetMapString(cecError_mapTable,status)); assert(status == HDMI_CEC_IO_SUCCESS); UT_LOG_INFO("Calling HdmiCecGetLogicalAddress(IN:handle:[0x%0X], OUT:logicalAddress:[])", gHandle); status = HdmiCecGetLogicalAddress(gHandle, &getLogicalAddress); - UT_LOG_INFO("Result HdmiCecGetLogicalAddress(IN:handle:[0x%0X], OUT:logicalAddress:[%d]) HDMI_CEC_STATUS:[%s])", gHandle, getLogicalAddress, UT_Control_GetMapString(cecError_mapTable,status)); + UT_LOG_INFO("Result HdmiCecGetLogicalAddress(IN:handle:[0x%0X], OUT:logicalAddress:[%x]) HDMI_CEC_STATUS:[%s])", gHandle, getLogicalAddress, UT_Control_GetMapString(cecError_mapTable,status)); assert(status == HDMI_CEC_IO_SUCCESS); assert(logicalAddress == getLogicalAddress); @@ -701,7 +589,7 @@ void test_l3_hdmi_cec_sink_hal_GetLogicalAddress(void) UT_LOG_INFO("Calling HdmiCecGetLogicalAddress(IN:handle:[0x%0X], OUT:logicalAddress:[])", gHandle); status = HdmiCecGetLogicalAddress(gHandle, &logicalAddress); - UT_LOG_INFO("Result HdmiCecGetLogicalAddress(IN:handle:[0x%0X], OUT:logicalAddress:[%d]) HDMI_CEC_STATUS:[%s])", gHandle, logicalAddress, UT_Control_GetMapString(cecError_mapTable,status)); + UT_LOG_INFO("Result HdmiCecGetLogicalAddress(IN:handle:[0x%0X], OUT:logicalAddress:[%x]) HDMI_CEC_STATUS:[%s])", gHandle, logicalAddress, UT_Control_GetMapString(cecError_mapTable,status)); assert(status == HDMI_CEC_IO_SUCCESS); UT_LOG_INFO("Out %s\n", __FUNCTION__); @@ -743,7 +631,7 @@ void test_l3_hdmi_cec_sink_hal_TransmitHdmiCecCommand(void) { // Reading inputs from the user or test framework UT_LOG_MENU_INFO("Enter a valid Destination Logical Address: "); - readInt(&destinationLogicalAddress); + readHex(&destinationLogicalAddress); UT_LOG_MENU_INFO("Enter CEC Command (in hex): "); readHex(&cecCommand); @@ -917,8 +805,8 @@ int32_t test_register_hdmicec_hal_sink_l3_tests(void) { return -1; } - // List of test function names and strings + // List of test function names and strings UT_add_test( pSuite, "Init HDMI CEC", test_l3_hdmi_cec_sink_hal_Init); UT_add_test( pSuite, "Add Logical Address", test_l3_hdmi_cec_sink_hal_AddLogicalAddress); UT_add_test( pSuite, "Get Logical Address", test_l3_hdmi_cec_sink_hal_GetLogicalAddress);