X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcec-config%2Fcec-config.cpp;h=c601afc3f9f573683e2dc2648ebac02dd55b998c;hb=b32ffd87ed707124e700477e8b2a10f6132de2c8;hp=5dbb9c8de19f6226ff26c8ee646cde7e48915bc7;hpb=ed80116ed77c2a7247465b39d39bc50a6bc1b190;p=deb_libcec.git diff --git a/src/cec-config/cec-config.cpp b/src/cec-config/cec-config.cpp index 5dbb9c8..c601afc 100644 --- a/src/cec-config/cec-config.cpp +++ b/src/cec-config/cec-config.cpp @@ -258,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; @@ -280,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; } }