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;
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_config.deviceTypes.add(type);
- g_parser = CreateParser(types);
+ g_parser = LibCecInitialise(&g_config);
if (!g_parser)
return false;
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());
return 1;
bool bAddressOk(false);
- uint16_t iAddress(0xFFF);
+ uint16_t iAddress(0xFFFF);
while (!bAddressOk)
{
iAddress = FindPhysicalAddress();
}
PrintToStdOut("=== USB-CEC Adapter Configuration Summary ===\n");
+ bool bHasAudiosystem = g_parser->IsActiveDevice(CECDEVICE_AUDIOSYSTEM);
+
PrintToStdOut("Physical address: %4X", iAddress);
g_parser->StandbyDevices();