X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fcec-config%2Fcec-config.cpp;h=b7a278beb354f6d598b184b2dd1bef41a6e6c017;hb=86393878734d316e04319c739dd45fc90c50bef8;hp=456369180c069a9a66122ef720314cf38249cab5;hpb=be54289b785d3318dd644223cacb9f281f3e2d3d;p=deb_libcec.git diff --git a/src/cec-config/cec-config.cpp b/src/cec-config/cec-config.cpp index 4563691..b7a278b 100644 --- a/src/cec-config/cec-config.cpp +++ b/src/cec-config/cec-config.cpp @@ -228,13 +228,18 @@ bool OpenConnection(cec_device_type type = CEC_DEVICE_TYPE_RECORDING_DEVICE) int8_t FindPhysicalAddressPortNumber(void) { - PrintToStdOut("Enter the HDMI port number to which you connected your CEC adapter, followed by . Only port 1, 2, 3 or 4 are supported. Anything else will cancel this wizard."); + PrintToStdOut("Enter the HDMI port number to which you connected your CEC adapter, followed by . Valid ports are in the range 1-15. Anything else will cancel this wizard."); string input; getline(cin, input); cin.clear(); - if (input.empty() || (input != "1" && input != "2" && input != "3" && input != "4")) + if (input.empty()) return -1; - return (int8_t)atoi(input.c_str()); + + int8_t hdmiport = atoi(input.c_str()); + if (hdmiport < 1 || hdmiport > 15) + return -1; + + return hdmiport; } cec_logical_address FindPhysicalAddressBaseDevice(void)