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

Skip infotainment handshake on BLE wake #254

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
13 changes: 12 additions & 1 deletion cmd/tesla-control/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,20 @@ func configureFlags(c *cli.Config, commandName string, forceBLE bool) error {
return ErrUnknownCommand
}
c.Flags = cli.FlagBLE
if (forceBLE && commandName == "wake") || info.requiresAuth {
bleWake := forceBLE && commandName == "wake"
if bleWake || info.requiresAuth {
// Wake commands are special. When sending a wake command over the Internet, infotainment
// cannot authenticate the command because it's asleep. When sending the command over BLE,
// VCSEC _does_ authenticate the command before poking infotainment.
c.Flags |= cli.FlagPrivateKey | cli.FlagVIN
}
if bleWake {
// Normally, clients send out two handshake messages in parallel in order to reduce latency.
// One handshake with VCSEC, one handshake with infotainment. However, if we're sending a
// BLE wake command, then infotainment is (presumably) asleep, and so we should only try to
// handshake with VCSEC.
c.DomainNames = []string{"VCSEC"}
}
if !info.requiresFleetAPI {
c.Flags |= cli.FlagVIN
}
Expand Down
Loading