diff --git a/.SRCINFO b/.SRCINFO index dc172c642580e..f188088f95282 100644 --- a/.SRCINFO +++ b/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = fcp-support-git pkgdesc = Focusrite Control Protocol user-space driver for Scarlett 4th Gen big models (16i16, 18i16, 18i20) pkgver = r21.edae476 - pkgrel = 1 + pkgrel = 2 url = https://github.com/geoffreybennett/fcp-support install = fcp-support-git.install arch = x86_64 @@ -19,6 +19,7 @@ pkgbase = fcp-support-git depends = libcap optdepends = alsa-scarlett-gui-git: GUI for controlling Focusrite interfaces optdepends = scarlett4-firmware: Firmware files for Scarlett 4th Gen (required for first-time setup) + optdepends = polkit: Passwordless start/stop of fcp-server for audio group users (recommended) provides = fcp-support conflicts = fcp-support source = git+https://github.com/geoffreybennett/fcp-support.git diff --git a/PKGBUILD b/PKGBUILD index 71d5887ec941b..d6ffcdb44f502 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -3,7 +3,7 @@ pkgname=fcp-support-git _pkgname=fcp-support pkgver=r21.edae476 -pkgrel=1 +pkgrel=2 pkgdesc="Focusrite Control Protocol user-space driver for Scarlett 4th Gen big models (16i16, 18i16, 18i20)" arch=('x86_64' 'i686') url="https://github.com/geoffreybennett/fcp-support" @@ -25,6 +25,7 @@ makedepends=( optdepends=( 'alsa-scarlett-gui-git: GUI for controlling Focusrite interfaces' 'scarlett4-firmware: Firmware files for Scarlett 4th Gen (required for first-time setup)' + 'polkit: Passwordless start/stop of fcp-server for audio group users (recommended)' ) provides=("$_pkgname") conflicts=("$_pkgname") @@ -54,4 +55,40 @@ package() { make install \ PREFIX=/usr \ DESTDIR="$pkgdir" + + # Install systemd drop-in to fix StopWhenUnneeded issue + # The upstream service has StopWhenUnneeded=yes which causes systemd to stop + # the service immediately after udev starts it, breaking reliability + install -Dm644 /dev/stdin \ + "$pkgdir/usr/lib/systemd/system/fcp-server@.service.d/arch.conf" <<'EOF' +# Arch Linux package override for fcp-server auto-stop issue +# See: https://github.com/geoffreybennett/fcp-support/issues +# +# The upstream service has StopWhenUnneeded=yes which conflicts with udev-based +# activation. This override keeps the service running while the device is connected. + +[Unit] +# Keep service running while device is connected +StopWhenUnneeded=no + +[Service] +# Always restart on crash +Restart=always +RestartSec=3 +EOF + + # Install polkit rule to allow audio group to manage fcp-server without password + # This enables alsa-scarlett-gui to auto-start the server seamlessly + install -Dm644 /dev/stdin \ + "$pkgdir/usr/share/polkit-1/rules.d/50-fcp-server.rules" <<'EOF' +// Allow audio group members to start/stop fcp-server without authentication +// This enables seamless integration with alsa-scarlett-gui +polkit.addRule(function(action, subject) { + if (action.id == "org.freedesktop.systemd1.manage-units" && + action.lookup("unit").match(/^fcp-server@[0-9]+\.service$/) && + subject.isInGroup("audio")) { + return polkit.Result.YES; + } +}); +EOF } diff --git a/fcp-support-git.install b/fcp-support-git.install index 109481cf517aa..41e032ec243d9 100644 --- a/fcp-support-git.install +++ b/fcp-support-git.install @@ -26,6 +26,11 @@ post_install() { echo " sudo usermod -a -G audio \$USER" echo " (then log out and back in)" echo "" + echo "==> Package improvements in this version:" + echo " - Fixed auto-stop issue (service now stays running reliably)" + echo " - Added polkit rule (audio group can manage fcp-server without password)" + echo " - Better integration with alsa-scarlett-gui" + echo "" echo "==> Install 'alsa-scarlett-gui-git' for a graphical interface:" echo " yay -S alsa-scarlett-gui-git" echo "" @@ -33,6 +38,12 @@ post_install() { echo " Install scarlett4-firmware package and run:" echo " fcp-tool --update-firmware" echo "" + echo "==> Troubleshooting:" + echo " If service doesn't auto-start, manually start it:" + echo " systemctl start fcp-server@" + echo " (find card number with: aplay -l)" + echo " View logs: journalctl -u 'fcp-server@*' -f" + echo "" } post_upgrade() {