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

Shutdown #3234

Merged
merged 2 commits into from
Mar 12, 2025
Merged

Shutdown #3234

merged 2 commits into from
Mar 12, 2025

Conversation

benma
Copy link
Contributor

@benma benma commented Mar 11, 2025

First commit is from #3230

Unfortunately the Comments before the `-extra-plugins` without
line-break delimiter made it a separate command. The `-` in Makefile
means `extra-plugins` is executed ignoring errors. This combination
made CI pass without Wayland plugins actually being deployed.

Fixes BitBoxSwiss#3229.
@benma benma requested a review from Beerosagos March 11, 2025 13:09
@benma benma force-pushed the shutdown branch 2 times, most recently from ed20ced to 46b944a Compare March 11, 2025 13:41
Our hidraw udev rule:

```
KERNEL=="hidraw*", SUBSYSTEM=="hidraw", ATTRS{idVendor}=="03eb",
ATTRS{idProduct}=="2403", TAG+="uaccess", TAG+="udev-acl",
SYMLINK+="bitbox02-%n"
```

creates `/dev/bitbox02-N` symlinks (one per HID interface).

The BitBoxApp uses libusb (default backend of karalabe/hid), not
hidraw. However, when a device is opened, the corresponding symlink is
removed, and restored when it is closed (presumably to ensure
exclusive access). Howewer, we never closed the opened devices when
the app closed, leading to the symlink being missing afterwards. This
resulted in apps that use hidraw not being able to connect after the
BitBoxApp connected first, like Sparrow.

This commit calls the backend shutdown on app close, also closing the
opened devices.
Copy link
Collaborator

@Beerosagos Beerosagos left a comment

Choose a reason for hiding this comment

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

tACK 👍

@@ -363,8 +363,9 @@ func Shutdown() {

log := logging.Get().WithGroup("server")
if globalShutdown != nil {
log.Info("Shutdown about to be called")
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: is this still needed, or is it a debug leftover?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought it's a helpful line anyway in case Shutdown gets stuck for whatever reason

@benma benma merged commit 945c7c3 into BitBoxSwiss:master Mar 12, 2025
10 checks passed
@benma benma deleted the shutdown branch March 12, 2025 10:18
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