Skip to content

Commit

Permalink
Skip infotainment handshake on BLE wake
Browse files Browse the repository at this point in the history
If we're sending a wake command over BLE, then infotainment is probably
sleeping and we should skip trying to handshake with it.
  • Loading branch information
Seth Terashima authored and sethterashima committed Jun 13, 2024
1 parent 0d9d955 commit 664a028
Showing 1 changed file with 12 additions and 1 deletion.
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

0 comments on commit 664a028

Please sign in to comment.