X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcec-config%2Fcec-config.cpp;h=c601afc3f9f573683e2dc2648ebac02dd55b998c;hb=b32ffd87ed707124e700477e8b2a10f6132de2c8;hp=d5f954eb7b5e2a4016ac55442fec033dde994c8c;hpb=3bafe3532bef1dd02331ccdfe735df8c8e427635;p=deb_libcec.git diff --git a/src/cec-config/cec-config.cpp b/src/cec-config/cec-config.cpp index d5f954e..c601afc 100644 --- a/src/cec-config/cec-config.cpp +++ b/src/cec-config/cec-config.cpp @@ -144,7 +144,6 @@ void EnableCallbacks(ICECAdapter *adapter) g_callbacks.CBCecLogMessage = &CecLogMessage; g_callbacks.CBCecKeyPress = &CecKeyPress; g_callbacks.CBCecCommand = &CecCommand; - g_callbacks.CBCecConfigurationChanged = NULL; adapter->EnableCallbacks(NULL, &g_callbacks); } @@ -235,11 +234,8 @@ int8_t FindPhysicalAddressPortNumber(void) if (input.empty()) return -1; - int8_t hdmiport = atoi(input.c_str()); - if (hdmiport < 1 || hdmiport > 15) - return -1; - - return hdmiport; + int hdmiport = atoi(input.c_str()); + return (hdmiport < 1 || hdmiport > 15) ? -1 : (int8_t)hdmiport; } cec_logical_address FindPhysicalAddressBaseDevice(void) @@ -262,7 +258,7 @@ cec_logical_address FindPhysicalAddressBaseDevice(void) uint16_t FindPhysicalAddress(void) { PrintToStdOut("=== Physical Address Configuration ===\n"); - uint16_t iAddress(0xFFFF); + uint16_t iAddress(CEC_INVALID_PHYSICAL_ADDRESS); PrintToStdOut("Do you want to let libCEC try to autodetect the address (y/n)?"); string input; @@ -284,22 +280,22 @@ uint16_t FindPhysicalAddress(void) else { iAddress = g_parser->GetDevicePhysicalAddress(g_primaryAddress); - if (iAddress == 0 || iAddress == 0xFFFF) + if (iAddress == 0 || iAddress == CEC_INVALID_PHYSICAL_ADDRESS) PrintToStdOut("Failed. Please enter the address manually, or restart this wizard and use different settings."); } } - if (iAddress == 0 || iAddress == 0xFFFF) + if (iAddress == 0 || iAddress == CEC_INVALID_PHYSICAL_ADDRESS) { - PrintToStdOut("Please enter the physical address (0000 - FFFF), followed by ."); + PrintToStdOut("Please enter the physical address (0001 - FFFE), followed by ."); getline(cin, input); cin.clear(); int iAddressTmp; if (sscanf(input.c_str(), "%x", &iAddressTmp) == 1) { - if (iAddressTmp < 0 || iAddressTmp > 0xFFFF) - iAddressTmp = 0xFFFF; + if (iAddressTmp <= CEC_PHYSICAL_ADDRESS_TV || iAddressTmp > CEC_MAX_PHYSICAL_ADDRESS) + iAddressTmp = CEC_INVALID_PHYSICAL_ADDRESS; iAddress = (uint16_t)iAddressTmp; } }