Skip to content

Commit

Permalink
Changes to support few more missing attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
shripad621git committed Jul 23, 2024
1 parent 7084a0c commit adf2bb3
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
25 changes: 25 additions & 0 deletions scripts/tools/generate_esp32_chip_factory_bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}


Expand Down Expand Up @@ -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/<ep> : number of supported modes for the endpoint
Expand Down Expand Up @@ -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',
Expand Down
1 change: 1 addition & 0 deletions src/platform/ESP32/ESP32Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions src/platform/ESP32/ESP32Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
7 changes: 6 additions & 1 deletion src/platform/ESP32/ESP32FactoryDataProvider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,12 @@ CHIP_ERROR ESP32FactoryDataProvider::GetHardwareVersion(uint16_t & hardwareVersi

CHIP_ERROR ESP32FactoryDataProvider::GetPartNumber(char * buf, size_t bufSize)
{
return GenericDeviceInstanceInfoProvider<ESP32Config>::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

Expand Down

0 comments on commit adf2bb3

Please sign in to comment.