Skip to content

Commit

Permalink
Fix rebooting
Browse files Browse the repository at this point in the history
  • Loading branch information
AlCutter committed Mar 15, 2024
1 parent 9d4cbd3 commit 3ecee8e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions trusted_os/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,12 @@ func (r *RPC) InstallApplet(b *rpc.FirmwareUpdate, _ *bool) error {
return err
}
r.Ctx.Stop()
<-r.Ctx.Done()
// This must be done in a go-routine because the ExecCtx.Stop() above can only be
// actioned once the RPC has returned.
go func() {
<-r.Ctx.Done()
r.Reboot(nil, nil)
}()

return r.Reboot(nil, nil)
}
Expand All @@ -292,8 +297,6 @@ var appletFirmwareBuffer []byte
// Reboot resets the system.
func (r *RPC) Reboot(_ *any, _ *bool) error {
log.Printf("SM rebooting")
// Reduce Watchdog timeout for a faster reboot:
imx6ul.WDOG2.Service(500)
usbarmory.Reset()

return nil
Expand Down

0 comments on commit 3ecee8e

Please sign in to comment.