Asus UX390 add a pulseaudio configuration

Hello!

I have the problem described here

https://wiki.archlinux.org/title/ASUS_Zenbook_UX390

But I have no idea about how to “nixify” it properly. Any tip for me?

Thanks a lot

Not really an answer to your question, but I recommend using Pipewire with Pulseaudio emulation. That might even work out-of-the-box. See Headphone volume resets itself to 100% - #2 by hmenke for a configuration example.

I tried with pipewire first and the problem was there as well. But in the meantime I learned a lot more and I fixed other issues. So I will try again to see what I will end up with.

In the meantime, if somebody knows how to convert that guide to nix, please feel free to asnwer!! Thanks @hmenke !

I had a look and it seems like the ALSA card profiles are baked into Pipewire (and Pulseaudio). So you will have to rebuild Pipewire with a patch:

ASUS_Zenbook_UX390.patch

--- a/spa/plugins/alsa/mixer/paths/analog-output.conf.common
+++ b/spa/plugins/alsa/mixer/paths/analog-output.conf.common
@@ -134,12 +134,20 @@
 ;                                      # numbering schemes, so we can't hardcode the full jack name in our configuration
 ;                                      # files.
 
+[Element Master]
+switch = mute
+volume = ignore
+
 [Element PCM]
 switch = mute
 volume = merge
 override-map.1 = all
 override-map.2 = all-left,all-right
 
+[Element LFE]
+switch = mute
+volume = ignore
+
 [Element External Amplifier]
 switch = select
 

/etc/nixos/configuration.nix

{
  hardware.pulseaudio.enable = false;
  security.rtkit.enable = true;
  services.pipewire = {
    enable = true;
    package = pkgs.pipewire.overrideAttrs ({ patches ? [], ... }: {
      patches = [ ./ASUS_Zenbook_UX390.patch ] ++ patches;
    });
    alsa.enable = true;
    alsa.support32Bit = true;
    pulse.enable = true;
  };
}

hey!! Thank you for your help! Unfortunately it does not look like it is working. I still get even 100% or 0% volume.

I am not really an expert here, I think the default Card is wrong

$ amixer
Simple mixer control 'Master',0
  Capabilities: pvolume pswitch pswitch-joined
  Playback channels: Front Left - Front Right
  Limits: Playback 0 - 65536
  Mono:
  Front Left: Playback 0 [0%] [on]
  Front Right: Playback 0 [0%] [on]
Simple mixer control 'Capture',0
  Capabilities: cvolume cswitch cswitch-joined
  Capture channels: Front Left - Front Right
  Limits: Capture 0 - 65536
  Front Left: Capture 26213 [40%] [on]
  Front Right: Capture 26213 [40%] [on]