Draft
Conversation
bjyoungblood
commented
Mar 13, 2023
| defp do_scs(:reply, 0x76, _), do: 0x12 | ||
| defp do_scs(:command, 0x77, _), do: 0x13 | ||
| defp do_scs(:reply, 0x78, _), do: 0x14 | ||
| defp do_scs(:command, id, true) when id in [0x60, 0x64, 0x65, 0x66, 0x67], do: 0x15 |
Member
Author
There was a problem hiding this comment.
I think this was the most critical change to get things to work -- commands with no data payload need to use SCS 0x15.
It would have been nice to calculate this based on the actual payload length, but that was a bigger refactor than I wanted to do, and there are a fixed number of commands with no payload.
bjyoungblood
commented
Mar 13, 2023
Comment on lines
+126
to
+136
| def next_command( | ||
| %{ | ||
| security?: true, | ||
| install_mode?: true, | ||
| secure_channel: %{established?: true, scbkd?: true}, | ||
| address: address | ||
| } = device | ||
| ) do | ||
| command = Command.new(address, KEYSET, key: device.scbk) | ||
| {device, command} | ||
| end |
Member
Author
There was a problem hiding this comment.
Where I got hung up on this PR was trying to decide how much install mode Jeff should be responsible for. This is the basic logic implemented in this PR in pseudocode:
if Jeff.add_device was called with a non-nil SCBK:
Try to establish a secure channel with the given SCBK
If secure channel is successful:
Done
# Else if install mode is not allowed:
# I was planning to implement this case, but I removed it
# because of the same issue in the on failure case below
# (not having a way to signal that a device is not working
# properly)
Else:
Try to connect with the install mode SCBK
On success:
Issue a KEYSET command to set the SCBK on the device
Restart the secure channel with the new SCBK
On failure:
TODO -- what _should_ happen here? We don't currently
have a way to indicate that a device isn't working
as expected
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.