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

Fixes for open pairing window on chip-tool #9806

Merged

Conversation

cecille
Copy link
Contributor

@cecille cecille commented Sep 17, 2021

Problem

It looks like the previous version would generate a random nodeid
and then attempt to open the pairing window on that. Issue #9550
indicates a general failure to send commands after provisioning,
but it actually looks like the open pairing window command is the
only one affected. Issue speculates that PersistDevice was not
called, but I confirmed that PersistDevice IS called. However,
the data for a randomly generated node id would not be present
so the symptoms may match.

We also need to connect to the device before sending the open
pairing window command as it is a standard cluster command.

Change overview

Don't generate random id for open pairing window call.
Added calls to connect to the device before opening the pairing window.

Testing

Tested command sequence on chip-tool using lightning app on linux
./chip-tool pairing onnetwork 0 20202021 3840 fc00::a 5540
./chip-tool onoff on 1
./chip-tool pairing open-commissioning-window 0 5000 1 3840
./chip-tool pairing onnetwork 0 20202021 3840 fc00::a 5540
./chip-tool onoff on 1

It looks like the previous version would generate a random nodeid
and then attempt to open the pairing window on that. Issue project-chip#9550
indicates a general failure to send commands after provisioning,
but it actually looks like the open pairing window command is the
only one affected. Issue speculates that PersistDevice was not
called, but confirmed that PersistDevice IS called. However,
the data for a randomly generated node id would not be present
so the symptoms may match.

We also need to connect to the device before sending the open
pairing windo command as it is a standard cluster command. Added
calls to connect to the device before opening the pairing window.

Test:
./chip-tool pairing onnetwork 0 20202021 3840 fc00::a 5540
./chip-tool onoff on 1
./chip-tool pairing open-commissioning-window 0 5000 1 3840
./chip-tool pairing onnetwork 0 20202021 3840 fc00::a 5540
./chip-tool onoff on 1
@todo
Copy link

todo bot commented Sep 17, 2021

Ideally we'd just ask for an operational cert for the commissionnee

// TODO: Ideally we'd just ask for an operational cert for the commissionnee
// and get the node from that, but the APIs are not set up that way yet.
NodeId randomId;
ReturnErrorOnFailure(Controller::ExampleOperationalCredentialsIssuer::GetRandomOperationalNodeId(&randomId));
ChipLogProgress(Controller, "Generated random node id: 0x" ChipLogFormatX64, ChipLogValueX64(randomId));
ReturnErrorOnFailure(GetExecContext()->storage->SetRemoteNodeId(randomId));
GetExecContext()->remoteId = randomId;
#else // CONFIG_PAIR_WITH_RANDOM_ID
// Use the default id, not whatever happens to be in our storage, since this


This comment was generated by todo based on a TODO comment in 1803014 in #9806. cc @cecille.

@franck-apple franck-apple added this to the Test Event 6 milestone Sep 17, 2021
@woody-apple
Copy link
Contributor

@saurabhst ?

@woody-apple woody-apple merged commit fdf98ba into project-chip:master Sep 20, 2021
@andy31415
Copy link
Contributor

I believe this is already in TE6

@cecille cecille deleted the chip_tool_open_pairing_window branch September 24, 2021 14:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants