alsa-ucm-pinephone-pmos: prefer the earpiece over the "internal speaker"

This commit is contained in:
Colin 2024-05-27 14:13:56 +00:00
parent 04bbf54385
commit f38d2d52d2
2 changed files with 11 additions and 1 deletions

View File

@ -37,7 +37,9 @@ in
# - headphones work
# - "internal earpiece" works
# - "internal speaker" is silent (maybe hardware issue)
packageUnwrapped = pkgs.alsa-ucm-pinephone-pmos; #< TODO: plumb `preferEarpiece`
packageUnwrapped = pkgs.alsa-ucm-pinephone-pmos.override {
inherit (cfg.config) preferEarpiece;
};
sandbox.enable = false; #< only provides $out/share/alsa

View File

@ -1,7 +1,9 @@
# see: https://gitlab.com/postmarketOS/pmaports/-/tree/master/device/main/device-pine64-pinephone/
# - APKBUILD and ucm/ files
{ alsa-ucm-conf
, lib
, fetchFromGitLab
, preferEarpiece ? false
}:
let
pmaports = fetchFromGitLab {
@ -20,5 +22,11 @@ in alsa-ucm-conf.overrideAttrs (upstream: {
mkdir -p $out/share/alsa/ucm2/conf.d/simple-card
ln -sf $out/share/alsa/ucm2/PinePhone/PinePhone.conf \
$out/share/alsa/ucm2/conf.d/simple-card/PinePhone.conf
'' + lib.optionalString preferEarpiece ''
# decrease the priority of the internal speaker so that sounds are routed
# to the earpiece by default.
# this is just personal preference.
substituteInPlace $out/share/alsa/ucm2/PinePhone/{HiFi.conf,VoiceCall.conf} \
--replace-fail 'PlaybackPriority 300' 'PlaybackPriority 100'
'';
})