From 3faa52382019383a94f0216bca6d71b75be2f546 Mon Sep 17 00:00:00 2001 From: Ben Grande Date: Wed, 17 Jan 2024 15:11:23 +0100 Subject: [PATCH] feat: usb devices in sys-audio Introduces support for USB connected devices such as Bluetooth and camera, microphone as well as their integrated versions. --- salt/sys-audio/README.md | 17 +++++++++++++++-- .../sys-audio/files/admin/policy/default.policy | 3 +++ salt/sys-audio/install-bluetooth.sls | 3 ++- salt/sys-audio/install-client.sls | 5 +++++ 4 files changed, 25 insertions(+), 3 deletions(-) diff --git a/salt/sys-audio/README.md b/salt/sys-audio/README.md index b8c25be..eccc0fa 100644 --- a/salt/sys-audio/README.md +++ b/salt/sys-audio/README.md @@ -15,8 +15,8 @@ Audio operations in Qubes OS. Creates the named disposable "disp-sys-audio" qube for providing audio operations such as microphone and speakers to and from qubes. By default, you -can use wired USB audio, but if you want, you can install the necessary -packages for bluetooth with the provided state. +can use the builtin stereo, JACK and USB , but if you want, you can install +the necessary packages for bluetooth with the provided state. ## Installation @@ -74,3 +74,16 @@ will fail. To be able to use the device again: - Restart the audio server `disp-sys-audio`; - Restart the audio client; and - Attach the device to the audio client; + +### How to use USB devices, Bluetooth, Camera and Microphone + +Bluetooth and Camera are normally integrated in laptops, but they still are +USB devices internally. They will be held by `(disp-)sys-usb` or +`(disp-)sys-net`, else `dom0`. + +Built-in microphones on the other hand, are directly attached to `dom0`. + +To use these devices, you have to attach them to their respective qubes: + +- audio server: Bluetooth; and +- audio client: cameras, speakers, microphones. diff --git a/salt/sys-audio/files/admin/policy/default.policy b/salt/sys-audio/files/admin/policy/default.policy index 6db5624..6c20803 100644 --- a/salt/sys-audio/files/admin/policy/default.policy +++ b/salt/sys-audio/files/admin/policy/default.policy @@ -8,6 +8,9 @@ ## Do not modify this file, create a new policy with with a lower number in the ## file name instead. For example `30-user.policy`. +## Literal name 'sys-usb' in case user has not installed from our formula. +admin.vm.device.usb.Available * disp-{{ sls_path }} sys-usb allow target=dom0 +admin.vm.device.usb.Available * disp-{{ sls_path }} @tag:usbvm allow target=dom0 admin.vm.device.mic.Available * disp-{{ sls_path }} @adminvm allow target=dom0 admin.Events * disp-{{ sls_path }} disp-{{ sls_path }} allow target=dom0 diff --git a/salt/sys-audio/install-bluetooth.sls b/salt/sys-audio/install-bluetooth.sls index 2d280a7..d10e2ed 100644 --- a/salt/sys-audio/install-bluetooth.sls +++ b/salt/sys-audio/install-bluetooth.sls @@ -21,6 +21,7 @@ include: - skip_suggestions: True - pkgs: - blueman - - linux-firmware + - libspa-0.2-bluetooth + - firmware-iwlwifi {% endif -%} diff --git a/salt/sys-audio/install-client.sls b/salt/sys-audio/install-client.sls index 07e6e90..ac0bd1b 100644 --- a/salt/sys-audio/install-client.sls +++ b/salt/sys-audio/install-client.sls @@ -6,6 +6,10 @@ SPDX-License-Identifier: AGPL-3.0-or-later {% if grains['nodename'] != 'dom0' -%} +## qubes-usb-proxy required for integrated camera (USB internally). +include: + - sys-usb.install-client-proxy + "{{ slsdotpath }}-client-updated": pkg.uptodate: - refresh: True @@ -18,6 +22,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later - pkgs: - pipewire-qubes - pipewire-pulse + - pipewire-libcamera - wireplumber - rtkit