diff --git a/scripts/tools/generate_esp32_chip_factory_bin.py b/scripts/tools/generate_esp32_chip_factory_bin.py index c778b7c141ab7b..b19748ca31b197 100755 --- a/scripts/tools/generate_esp32_chip_factory_bin.py +++ b/scripts/tools/generate_esp32_chip_factory_bin.py @@ -194,6 +194,21 @@ class Product_Color_Enum(Enum): 'encoding': 'u32', 'value': None, }, + 'part-number': { + 'type': 'data', + 'encoding': 'string', + 'value': None, + }, + 'product-label': { + 'type': 'data', + 'encoding': 'string', + 'value': None, + }, + 'product-url': { + 'type': 'data', + 'encoding': 'string', + 'value': None, + }, } @@ -350,6 +365,12 @@ def populate_factory_data(args, spake2p_params): FACTORY_DATA['product-finish']['value'] = Product_Finish_Enum[args.product_finish].value if args.product_color: FACTORY_DATA['product-color']['value'] = Product_Color_Enum[args.product_color].value + if args.part_number: + FACTORY_DATA['part-number']['value'] = args.part_number + if args.product_url: + FACTORY_DATA['product-url']['value'] = args.product_url + if args.product_label: + FACTORY_DATA['product-label']['value'] = args.product_label # SupportedModes are stored as multiple entries # - sm-sz/ : number of supported modes for the endpoint @@ -528,6 +549,10 @@ def any_base_int(s): return int(s, 0) parser.add_argument("--product-color", type=str, choices=product_color_choices, help='Product colors choices for product appearance') + parser.add_argument("--part-number", type=str, help='human readable product number') + parser.add_argument("--product-label", type=str, help='human readable product label') + parser.add_argument("--product-url", type=str, help='link to product specific web page') + parser.add_argument('-s', '--size', type=any_base_int, default=0x6000, help='The size of the partition.bin, default: 0x6000') parser.add_argument('--target', default='esp32', diff --git a/src/platform/ESP32/ESP32Config.cpp b/src/platform/ESP32/ESP32Config.cpp index 162fff1f323587..c94de5c04b85b2 100644 --- a/src/platform/ESP32/ESP32Config.cpp +++ b/src/platform/ESP32/ESP32Config.cpp @@ -79,6 +79,7 @@ const ESP32Config::Key ESP32Config::kConfigKey_SupportedLocaleSize = { kConfig const ESP32Config::Key ESP32Config::kConfigKey_RotatingDevIdUniqueId = { kConfigNamespace_ChipFactory, "rd-id-uid" }; const ESP32Config::Key ESP32Config::kConfigKey_ProductFinish = { kConfigNamespace_ChipFactory, "product-finish" }; const ESP32Config::Key ESP32Config::kConfigKey_ProductColor = { kConfigNamespace_ChipFactory, "product-color" }; +const ESP32Config::Key ESP32Config::kConfigKey_PartNumber = { kConfigNamespace_ChipFactory, "part-number" }; const ESP32Config::Key ESP32Config::kConfigKey_LocationCapability = { kConfigNamespace_ChipFactory, "loc-capability" }; // Keys stored in the chip-config namespace diff --git a/src/platform/ESP32/ESP32Config.h b/src/platform/ESP32/ESP32Config.h index 546c593387db72..218f2354b2b358 100644 --- a/src/platform/ESP32/ESP32Config.h +++ b/src/platform/ESP32/ESP32Config.h @@ -75,6 +75,7 @@ class ESP32Config static const Key kConfigKey_ProductId; static const Key kConfigKey_ProductName; static const Key kConfigKey_ProductLabel; + static const Key kConfigKey_PartNumber; static const Key kConfigKey_ProductURL; static const Key kConfigKey_SupportedCalTypes; static const Key kConfigKey_SupportedLocaleSize; diff --git a/src/platform/ESP32/ESP32FactoryDataProvider.cpp b/src/platform/ESP32/ESP32FactoryDataProvider.cpp index b6120ff4e66857..ace2a087de144b 100644 --- a/src/platform/ESP32/ESP32FactoryDataProvider.cpp +++ b/src/platform/ESP32/ESP32FactoryDataProvider.cpp @@ -278,7 +278,12 @@ CHIP_ERROR ESP32FactoryDataProvider::GetHardwareVersion(uint16_t & hardwareVersi CHIP_ERROR ESP32FactoryDataProvider::GetPartNumber(char * buf, size_t bufSize) { - return GenericDeviceInstanceInfoProvider::GetPartNumber(buf, bufSize); + CHIP_ERROR err = ESP32Config::ReadConfigValueStr(ESP32Config::kConfigKey_PartNumber, buf, bufSize, bufSize); + if (err == CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND) + { + return CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND; + } + return err; } #endif // CHIP_DEVICE_CONFIG_ENABLE_DEVICE_INSTANCE_INFO_PROVIDER