nix-community / hardware-mnt-reform

NixOS overrides for the MNT Reform laptop [maintainer=@jollheef]
https://mntre.com
15 stars 2 forks source link

Speakers not working #12

Open dmorn opened 2 years ago

dmorn commented 2 years ago

My audio configuration is

  # to ensure pipewire is the only one handling audio devices,
  # recommended in the documention
  sound.enable = false;
  hardware.pulseaudio.enable = false;

  services = {
    pipewire = {
      enable = true;
      wireplumber.enable = true;
      alsa.enable = true;
      pulse.enable = true;
      jack.enable = true;
    };
  };

When I play something with mpv for example, pavucontrol shows some load. Audio is never emitted though, either with headphones or from speakers. I tried also w/o pipewire (i.e. hardware.pulseaudio.enable = true; sound.enable = true; removing pipewire) with the same result.

There is something on dmesg that catches my attention

[    1.774232] ALSA device list:
[    1.774237]   No soundcards found.

Isn't it supposed to detect the WM8960 chip?

dmorn commented 2 years ago

This is my lock

{
  "nodes": {
    "nixpkgs": {
      "locked": {
        "lastModified": 1655278232,
        "narHash": "sha256-H6s7tnHYiDKFCcLADS4sl1sUq0dDJuRQXCieguk/6SA=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "8b538fcb329a7bc3d153962f17c509ee49166973",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "nixos-22.05",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "nixpkgs_2": {
      "locked": {
        "lastModified": 1650728030,
        "narHash": "sha256-VfCYsC/0mZQlQqsXf5o5Cib1ncJQ5l7WHN7hEIMmZNw=",
        "owner": "NixOS",
        "repo": "nixpkgs",
        "rev": "5fb3a179605141bfa4c9c423f9b1c33658b059c8",
        "type": "github"
      },
      "original": {
        "owner": "NixOS",
        "ref": "release-21.11",
        "repo": "nixpkgs",
        "type": "github"
      }
    },
    "reform": {
      "inputs": {
        "nixpkgs": "nixpkgs_2"
      },
      "locked": {
        "lastModified": 1650823819,
        "narHash": "sha256-DK54EWZnYnXQ94JazqLYjwyHdkVbVyw81ZuO8ffdIyM=",
        "owner": "nix-community",
        "repo": "hardware-mnt-reform",
        "rev": "ea814bccdcb713042f6ef4a93dcf3ebcfe2b04dd",
        "type": "github"
      },
      "original": {
        "owner": "nix-community",
        "repo": "hardware-mnt-reform",
        "type": "github"
      }
    },
    "root": {
      "inputs": {
        "nixpkgs": "nixpkgs",
        "reform": "reform"
      }
    }
  },
  "root": "root",
  "version": 7
}
jollheef commented 2 years ago

Isn't it supposed to detect the WM8960 chip?

I don't use audio in my setup, so I'm not aware. I'll take a look when I'll have a time.

dmorn commented 2 years ago

@jollheef how would you tackle the problem roughly? I might be helpful with some guidance!

jollheef commented 2 years ago

At first, I would check /sys/class/sound/, if there are no real devices, then the kernel is configured incorrectly. If there is something, then I would start to play from bare alsa.

dmorn commented 2 years ago

An update,

> cat /sys/class/sound/card0/id
wm8960audio
jfrederickson commented 1 year ago

I've been trying to troubleshoot this a bit today, here's where I've gotten so far.

ALSA finds the card:

[nix-shell:~]$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: wm8960audio [wm8960-audio], device 0: HiFi wm8960-hifi-0 [HiFi wm8960-hifi-0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

speaker-test on this card fails with an I/O error:

[nix-shell:~]$ speaker-test -c 2 -D plughw:0,0

speaker-test 1.2.5.1

Playback device is plughw:0,0
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 24 to 131072
Period size range from 12 to 16383
Using max buffer size 131072
Periods = 4
was set period_size = 8192
was set buffer_size = 131072
 0 - Front Left
Write error: -5,Input/output error
xrun_recovery failed: -5,Input/output error
Transfer failed: Input/output error
lykso commented 8 months ago

@jfrederickson I had the same problem and just figured out a fix for it yesterday. I've got an updated flake with the fix, a more recent kernel, and a more recent NixOS over on Codeberg.

The trouble seems to be that the official alsa-utils' udev rules never get read in for some reason. The workaround until I can figure out the root cause is to just put those udev rules in the flake itself.