From: Lars Op den Kamp Date: Thu, 9 Feb 2012 22:31:58 +0000 (+0100) Subject: cec-config: use the new LibCecInitialise() X-Git-Tag: upstream/2.2.0~1^2~35^2~124 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=c7dc6e28e6a7dbbb685b4788fd77774e34196717;p=deb_libcec.git cec-config: use the new LibCecInitialise() --- diff --git a/src/cec-config/cec-config.cpp b/src/cec-config/cec-config.cpp index b026864..7b69bf8 100644 --- a/src/cec-config/cec-config.cpp +++ b/src/cec-config/cec-config.cpp @@ -59,6 +59,7 @@ CCondition g_keyCondtion; cec_user_control_code g_lastKey = CEC_USER_CONTROL_CODE_UNKNOWN; ICECCallbacks g_callbacks; +libcec_configuration g_config; ICECAdapter * g_parser; cec_logical_address g_primaryAddress; @@ -184,11 +185,18 @@ bool ProcessConsoleCommand(string &input) bool OpenConnection(cec_device_type type = CEC_DEVICE_TYPE_RECORDING_DEVICE) { - cec_device_type_list types; - types.clear(); - types.add(type); + g_config.Clear(); + snprintf(g_config.strDeviceName, 13, "CEC-config"); + g_config.callbackParam = NULL; + g_config.clientVersion = CEC_CLIENT_VERSION_1_5_0; + g_callbacks.CBCecLogMessage = &CecLogMessage; + g_callbacks.CBCecKeyPress = &CecKeyPress; + g_callbacks.CBCecCommand = &CecCommand; + g_config.callbacks = &g_callbacks; - g_parser = CreateParser(types); + g_config.deviceTypes.add(type); + + g_parser = LibCecInitialise(&g_config); if (!g_parser) return false; @@ -206,12 +214,7 @@ bool OpenConnection(cec_device_type type = CEC_DEVICE_TYPE_RECORDING_DEVICE) strPort = devices[0].comm; } - EnableCallbacks(g_parser); - - // start with HDMI1 on the TV - g_parser->SetHDMIPort(CECDEVICE_TV, 1); PrintToStdOut("opening a connection to the CEC adapter..."); - if (!g_parser->Open(strPort.c_str())) { PrintToStdOut("unable to open the device on port %s", strPort.c_str());