feat(ghaf-killswitch): Shell application to list, block and unblock#1340
Merged
brianmcgillion merged 3 commits intotiiuae:mainfrom Sep 3, 2025
Merged
feat(ghaf-killswitch): Shell application to list, block and unblock#1340brianmcgillion merged 3 commits intotiiuae:mainfrom
brianmcgillion merged 3 commits intotiiuae:mainfrom
Conversation
kajusnau
reviewed
Aug 27, 2025
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR introduces a new ghaf-killswitch shell application that provides a unified interface for managing PCI device blocking and unblocking operations in the Ghaf system. The tool allows users to list supported devices (mic and net), block/unblock microphones and network devices, and includes help functionality.
Key changes:
- Adds a new shell script package for managing PCI device suspension/resumption
- Integrates the killswitch tool into the microvm host environment for x86_64 systems
- Provides commands to block/unblock microphone and network devices via PCI hotplug operations
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/pkgs-by-name/ghaf-killswitch/package.nix | New shell application package implementing the killswitch functionality |
| packages/own-pkgs-overlay.nix | Adds ghaf-killswitch to the package overlay and reorganizes ghaf-installer entry |
| modules/microvm/host/microvm-host.nix | Integrates the killswitch tool into the host environment for x86_64 systems |
Comments suppressed due to low confidence (1)
packages/pkgs-by-name/ghaf-killswitch/package.nix:1
- The array expansion
${devices[*]}creates a space-separated string which could lead to false matches if device names contain substrings of other device names. Use a proper array iteration instead:for device in \"${devices[@]}\"; do [[ \"$device\" == \"$2\" ]] && found=true; done
# Copyright 2025 TII (SSRC) and the Ghaf contributors
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
6b3ac56 to
37a4667
Compare
37a4667 to
39bdd29
Compare
Collaborator
Author
|
PR ready for review. |
kajusnau
requested changes
Sep 2, 2025
39bdd29 to
4e6add5
Compare
hotplug package can support PCI and USB devices attach and detach functionality. Signed-off-by: Vunny Sodhi <vunny.sodhi@unikie.com>
* Assign a unique `id` based on `dev.name` for each `usb-host` device. This allows the devices to be referenced in QEMU (e.g. for hotplug, unplug or QMP operations) * Blacklist system76 Integrated camera for chrome-vm Signed-off-by: Vunny Sodhi <vunny.sodhi@unikie.com>
This PR introduces a new ghaf-killswitch shell application that provides a unified interface for managing PCI device blocking and unblocking operations. The tool allows users to list supported devices, block/unblock microphones and network devices and includes help functionality. Signed-off-by: Vunny Sodhi <vunny.sodhi@unikie.com>
4e6add5 to
e72f134
Compare
|
Tested on Lenovo-X1 (
|
kajusnau
approved these changes
Sep 3, 2025
brianmcgillion
approved these changes
Sep 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Changes
ghaf-killswitchshell application that provides a unified interface for managing PCI device blocking and unblocking operations. The tool allows users to list supported devices, block/unblock microphones and network devices, and includes help functionality.idto usb-host devicesThe current
ghaf-killswitchshell script available inghaf-hostand supports block/unblock of below devices.audio-vm.net-vm.business-vm.Note:
There are hardware kill switch for internal camera specific to system76
Combination Fn+F10 to toggle enabling/disabling the camera. When disabled, it does not appear on the USB bus, so this probably disconnects it, logically. The state (on or off) is preserved across reboots and power cycles.
https://support.system76.com/articles/webcam/
Test Steps added below.
Improvements
1. Internal camera need to be added for kill-switch.2. Kill-switch state is not yet persistent across system reboots. --> Can be taken up in later PR
3. Audio Widget flickering seen in
menu-barofgui-vmwhenmicis blocked . --> Can be taken up in later PRType of Change
Related Issues / Tickets
Checklist
make-checksand it passesTesting Instructions
Applicable Targets
aarch64aarch64x86_64x86_64x86_64Installation Method
nixos-rebuild ... switchTest Steps To Verify:
Please test suspend/resume test cases thoroughly and steps to test shell app as below:
Login to
ghaf-hostRun
ghaf-killswitchwith sudo rights to check supported devices for kill-switchTo block Microphone run
After which all microphone devices will be removed and it can be verified by login to
audio-vmTo block WLAN run
After which WiFi connection will be terminated and it can be verified by login to
net-vmor fromGUITo block Internal camera run
After which internal camera will be removed from
business-vmand it can be verified by login tobusiness-vmTo start using back devices run