Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure we log the full generated setup payload in chip-tool. #21207

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ CHIP_ERROR SetupPayloadGenerateQRCodeCommand::Run()

std::string code;
ReturnErrorOnFailure(generator.payloadBase38RepresentationWithAutoTLVBuffer(code));
// CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE includes various prefixes we don't
// control (timestamps, process ids, etc). Let's assume (hope?) that
// those prefixes use up no more than half the total available space.
constexpr size_t chunkSize = CHIP_CONFIG_LOG_MESSAGE_MAX_SIZE / 2;
while (code.size() > chunkSize)
{
ChipLogProgress(chipTool, "QR Code: %s", code.substr(0, chunkSize).c_str());
code = code.substr(chunkSize);
}
ChipLogProgress(chipTool, "QR Code: %s", code.c_str());

return CHIP_NO_ERROR;
Expand Down