diff --git a/examples/chef/chef.py b/examples/chef/chef.py index e8cfe07501ffe4..fb86d45d3e96e2 100755 --- a/examples/chef/chef.py +++ b/examples/chef/chef.py @@ -321,6 +321,8 @@ def main() -> int: help="specifies the Vendor ID. Default is 0xFFF1", metavar="VID", default=0xFFF1) parser.add_option("-p", "--pid", dest="pid", type=int, help="specifies the Product ID. Default is 0x8000", metavar="PID", default=0x8000) + parser.add_option("-P", "--pname", dest="pname", type=str, metavar="PRODUCT_NAME", + help="specifies the Product Name. Default is TEST_PRODUCT", default="TEST_PRODUCT") parser.add_option("", "--rpc_console", help="Opens PW RPC Console", action="store_true", dest="do_rpc_console") parser.add_option("-y", "--tty", help="Enumerated USB tty/serial interface enumerated for your physical device. E.g.: /dev/ACM0", @@ -626,6 +628,7 @@ def main() -> int: f.write(textwrap.dedent(f"""\ set(CONFIG_DEVICE_VENDOR_ID {options.vid}) set(CONFIG_DEVICE_PRODUCT_ID {options.pid}) + set(CONFIG_DEVICE_PRODUCT_NAME \"{options.pname}\") set(CONFIG_ENABLE_PW_RPC {"1" if options.do_rpc else "0"}) set(SAMPLE_NAME {options.sample_device_type_name}) set(CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING \"{sw_ver_string}\")""")) @@ -716,7 +719,7 @@ def main() -> int: 'chip_shell_cmd_server = false', 'chip_build_libshell = true', 'chip_config_network_layer_ble = false', - f'target_defines = ["CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID={options.vid}", "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID={options.pid}", "CONFIG_ENABLE_PW_RPC={int(options.do_rpc)}"]', + f'target_defines = ["CHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID={options.vid}", "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID={options.pid}", "CONFIG_ENABLE_PW_RPC={int(options.do_rpc)}", "CHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME=\\"{str(options.pname)}\\""]', ]) uname_resp = shell.run_cmd("uname -m", return_cmd_output=True) @@ -763,6 +766,7 @@ def main() -> int: if sw_ver_string: linux_args.append( f'chip_device_config_device_software_version_string = "{sw_ver_string}"') + with open(f"{_CHEF_SCRIPT_PATH}/linux/args.gni", "w") as f: f.write("\n".join(linux_args)) with open(f"{_CHEF_SCRIPT_PATH}/linux/sample.gni", "w") as f: diff --git a/examples/chef/esp32/CMakeLists.txt b/examples/chef/esp32/CMakeLists.txt index 50b6dc0da3de7d..f4ea7c13eefede 100644 --- a/examples/chef/esp32/CMakeLists.txt +++ b/examples/chef/esp32/CMakeLists.txt @@ -37,11 +37,15 @@ endif() set(CMAKE_EXPORT_COMPILE_COMMANDS ON) include(${CMAKE_CURRENT_LIST_DIR}/../project_include.cmake) -message(STATUS "Product ID " ${CONFIG_DEVICE_PRODUCT_ID}) message(STATUS "Vendor ID " ${CONFIG_DEVICE_VENDOR_ID}) +message(STATUS "Product ID " ${CONFIG_DEVICE_PRODUCT_ID}) +message(STATUS "Product Name " ${CONFIG_DEVICE_PRODUCT_NAME}) message(STATUS "SW Version String" ${CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING}) -idf_build_set_property(COMPILE_OPTIONS "-DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID=${CONFIG_DEVICE_PRODUCT_ID}" APPEND) idf_build_set_property(COMPILE_OPTIONS "-DCHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID=${CONFIG_DEVICE_VENDOR_ID}" APPEND) +idf_build_set_property(COMPILE_OPTIONS "-DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID=${CONFIG_DEVICE_PRODUCT_ID}" APPEND) +if(NOT ${CONFIG_DEVICE_PRODUCT_NAME} STREQUAL "") + idf_build_set_property(COMPILE_OPTIONS "-DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME=\"${CONFIG_DEVICE_PRODUCT_NAME}\"" APPEND) +endif() if(NOT ${CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING} STREQUAL "") idf_build_set_property(COMPILE_OPTIONS "-DCHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING}\"" APPEND) endif() diff --git a/examples/chef/nrfconnect/CMakeLists.txt b/examples/chef/nrfconnect/CMakeLists.txt index a5473bed795eca..4249001f35a0ec 100644 --- a/examples/chef/nrfconnect/CMakeLists.txt +++ b/examples/chef/nrfconnect/CMakeLists.txt @@ -27,14 +27,18 @@ get_filename_component(GEN_DIR ${CHEF}/out/${SAMPLE_NAME}/zap-generated REALPATH set(CONF_FILE prj.conf) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID=${CONFIG_DEVICE_PRODUCT_ID}") set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_DEVICE_CONFIG_DEVICE_VENDOR_ID=${CONFIG_DEVICE_VENDOR_ID}") +set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_ID=${CONFIG_DEVICE_PRODUCT_ID}") +if(NOT ${CONFIG_DEVICE_PRODUCT_NAME} STREQUAL "") + set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_DEVICE_CONFIG_DEVICE_PRODUCT_NAME=\"${CONFIG_DEVICE_PRODUCT_NAME}\"") +endif() set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_PLATFORM_NRFCONNECT=1") if(NOT ${CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING} STREQUAL "") set(CHIP_CFLAGS "${CHIP_CFLAGS} -DCHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING=\"${CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING}\"") endif() -message(STATUS "Product ID " ${CONFIG_DEVICE_PRODUCT_ID}) message(STATUS "Vendor ID " ${CONFIG_DEVICE_VENDOR_ID}) +message(STATUS "Product ID " ${CONFIG_DEVICE_PRODUCT_ID}) +message(STATUS "Product Name " ${CONFIG_DEVICE_PRODUCT_NAME}) message(STATUS "SW Version String" ${CHIP_DEVICE_CONFIG_DEVICE_SOFTWARE_VERSION_STRING}) # Set Kconfig root files that will be processed as a first Kconfig for used child images. @@ -67,6 +71,7 @@ target_include_directories(app PRIVATE ${CHEF} ${GEN_DIR}/../ ${CHIP_ROOT}/src + ${CHIP_ROOT}/examples/shell/shell_common/include ${NRFCONNECT_COMMON}/util/include ${NRFCONNECT_COMMON}/app/include ) diff --git a/src/include/platform/internal/GenericConfigurationManagerImpl.ipp b/src/include/platform/internal/GenericConfigurationManagerImpl.ipp index 0367f01318c88b..ca7d27ae47b332 100644 --- a/src/include/platform/internal/GenericConfigurationManagerImpl.ipp +++ b/src/include/platform/internal/GenericConfigurationManagerImpl.ipp @@ -699,6 +699,19 @@ void GenericConfigurationManagerImpl::LogDeviceConfig() ChipLogProgress(DeviceLayer, " Product Id: %u (0x%X)", productId, productId); } + { + char productName[ConfigurationManager::kMaxProductNameLength + 1]; + err = deviceInstanceInfoProvider->GetProductName(productName, sizeof(productName)); + if (CHIP_NO_ERROR == err) + { + ChipLogProgress(DeviceLayer, " Product Name: %s", productName); + } + else + { + ChipLogError(DeviceLayer, " Product Name: n/a (%" CHIP_ERROR_FORMAT ")", err.Format()); + } + } + { uint16_t hardwareVer; if (deviceInstanceInfoProvider->GetHardwareVersion(hardwareVer) != CHIP_NO_ERROR)