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

api/firmware: prevent sleep on macOS during long running queries #111

Merged
merged 1 commit into from
Sep 19, 2024

Conversation

benma
Copy link
Contributor

@benma benma commented Sep 19, 2024

When doing long interactions on the device, e.g. recovering from 24 words, and macOS goes to sleep, USB interaction would be slowed down and the workflow would be aborted.

This commit prevents this from happening by preventing macOS from going to sleep during such an interaction.

The alternative was to expose callbacks here and let the BitBoxApp (and other users) implement the callbacks, but it seems like every app that uses this lib would want this. In case not, we add a build flag if not desired.

When doing long interactions on the device, e.g. recovering from 24
words, and macOS goes to sleep, USB interaction would be slowed down
and the workflow would be aborted.

This commit prevents this from happening by preventing macOS from
going to sleep during such an interaction.

The alternative was to expose callbacks here and let the
BitBoxApp (and other users) implement the callbacks, but it seems like
every app that uses this lib would want this. In case not, we add a
build flag if not desired.
@benma benma requested a review from thisconnect September 19, 2024 12:27
@benma
Copy link
Contributor Author

benma commented Sep 19, 2024

@thisconnect you can test by setting the screensaver time to 1min in the macOS settings under "Lock screen", then running for example

go run cmd/playground/main.go with a connected BB02. When the unlock screen appears, macOS should not go to sleep until you exit.

Copy link
Collaborator

@thisconnect thisconnect left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tested works for me

@benma benma merged commit 88d5934 into BitBoxSwiss:master Sep 19, 2024
3 checks passed
@benma benma deleted the preventsleep branch September 19, 2024 13:53
benma added a commit to benma/bitbox-wallet-app that referenced this pull request Sep 19, 2024
To prevent USB communication interruptions when e.g. recovering from
24 words.

See BitBoxSwiss/bitbox02-api-go#111

```
go get github.com/BitBoxSwiss/bitbox02-api-go@88d5934
go mod tidy
go mod vendor
```
benma added a commit to benma/bitbox-wallet-app that referenced this pull request Sep 24, 2024
To prevent USB communication interruptions when e.g. recovering from
24 words.

See BitBoxSwiss/bitbox02-api-go#111

```
go get github.com/BitBoxSwiss/bitbox02-api-go@b5eea13
go mod tidy
go mod vendor
```
benma added a commit to benma/bitbox-wallet-app that referenced this pull request Sep 25, 2024
To prevent USB communication interruptions when e.g. recovering from
24 words.

See BitBoxSwiss/bitbox02-api-go#111

```
go get github.com/BitBoxSwiss/bitbox02-api-go@a2115fe
go mod tidy
go mod vendor
```
benma added a commit to benma/bitbox-wallet-app that referenced this pull request Sep 25, 2024
To prevent USB communication interruptions when e.g. recovering from
24 words.

See BitBoxSwiss/bitbox02-api-go#111

```
go get github.com/BitBoxSwiss/bitbox02-api-go@a2115fe
go mod tidy
go mod vendor
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants