Sound card support



  • Hi all,

    the past week I installed an USB audio card into a Neuron M103 and, after a bit of tinkering (e.g. disabling the internal audio card), it all worked fine:

    $ cat /proc/asound/cards 
     1 [Audio          ]: USB-Audio - USB Audio
                          Generic USB Audio at usb-3f980000.usb-1.3, high speed
    

    Now I need to do the same change on an Axon M205 but I discovered the sound drivers and modules seem to not be installed as they are part of the standard kernel. The /proc/asound directory does not even exist.


  • administrators

    Hi @ntd,
    the kernel for Axons is a stock kernel provided by Debian. Can you check how your USB audio card is detected? Unplug it (if already plugged in) and then plug it again and run these commands (the lsusb will need usbutils package)

    # dmesg
    # lsusb
    

    The problem probably lies in missing audio subsystem, which we ofcourse omitted. You can try following any Debian tutorial for installing ALSA or PulseAudio.

    Is this answer sufficient for you?

    Best regards,
    Martin



  • Hi @Martin-Kudláček,

    AFAIK the hardware is detected properly:

    # dmesg 
    [ 4789.159932] usb 5-1: new high-speed USB device number 2 using ehci-platform
    [ 4790.663103] input: Generic USB Audio as /devices/platform/soc/1c1d000.usb/usb5/5-1/5-1:1.3/0003:0BDA:4809.0001/input/input2
    [ 4790.720706] hid-generic 0003:0BDA:4809.0001: input,hiddev96,hidraw0: USB HID v1.11 Device [Generic USB Audio] on usb-1c1d000.usb-1/input3
    # lsusb 
    Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 005 Device 003: ID 0bda:4809 Realtek Semiconductor Corp. 
    Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Bus 009 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    

    My problem is the ALSA installation:

    # apt update
    ...
    # apt install alsa-base
    Reading package lists... Done
    Building dependency tree       
    Reading state information... Done
    Package alsa-base is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    
    E: Package 'alsa-base' has no installation candidate
    

    The system is a stock UniPian with very few customizations (created a user, added some packages, configured network and SSH and a few more)... nothing sound-related though.

    Further investigation shows the sound driver is provided by linux-image-4.9.0-9-arm64 but the active kernel is 4.14.42:

    # apt-file search snd-usb-audio
    linux-image-4.9.0-9-arm64: /lib/modules/4.9.0-9-arm64/kernel/sound/usb/snd-usb-audio.ko
    linux-image-4.9.0-9-arm64-dbg: /usr/lib/debug/lib/modules/4.9.0-9-arm64/kernel/sound/usb/snd-usb-audio.ko
    # uname -a
    Linux sicur19a 4.14.52 #37 SMP Mon Nov 5 12:29:14 CET 2018 aarch64 GNU/Linux
    

    Not sure what to do now... I would try to install and enable the stock kernel (4.9.0) but I was fearing unintended consequences. Let me know it this is not a problem.


  • administrators

    @ntd Downgrading of the kernel could work, but it is never the correct solution, since you will not receive updates.

    The alsa-base image is not the correct one: https://packages.debian.org/search?suite=all&searchon=names&keywords=alsa-base

    The preffered sound system in Debian is PulseAudio, so try following this information: https://wiki.debian.org/PulseAudio

    Best regards,
    Martin



  • @martin-kudláček said in Sound card support:

    Downgrading of the kernel could work, but it is never the correct solution, since you will not receive updates.

    But this is not a downgrade: linux-image-4.9.0-9-arm64 is the default kernel of Debian Stretch. The 4.14.52 kernel is provided by your package (axon-kernel), that is by default UniPian does not use the stock Stretch kernel image. I suppose this was due for some reason and I'd like to know if I can just ignore those reasons and use the default kernel.

    Regardling pulseaudio I cannot see how it can work without the proper sound kernel module loaded. I just tried anyway (it is quite tricky because the info provided expects a running desktop environment) and the result is no card found:

    $ pactl list cards 
    $
    

  • administrators

    Hi @ntd,
    I don't have any USB sound card here at the moment, but I googled "headless pulseaudio" and so far this tutorial looks OK:

    https://askubuntu.com/questions/28176/how-do-i-run-pulseaudio-in-a-headless-server-installation

    The only change I did is in the first command, to which I added --no-install-recommends and it omitted the GUI stuff:

    sudo apt-get install libasound2 libasound2-plugins alsa-utils alsa-oss --no-install-recommends

    Again, changing kernel in embedded devices is the latest thing you should do. And I am sorry for the misinformation about the stock kernel vs. kernel provided in axon-kernel package, you are correct.

    Martin



  • @martin-kudláček said in Sound card support:

    https://askubuntu.com/questions/28176/how-do-i-run-pulseaudio-in-a-headless-server-installation

    Yes, this is exactly what I followed before writing the previous post. The only sink listed is a dummy output that I suppose you see too:

    $ pacmd list-sinks
    1 sink(s) available.
      * index: 0
    	name: <auto_null>
    	driver: <module-null-sink.c>
            ...
    	properties:
    		device.description = "Dummy Output"
    		device.class = "abstract"
    		device.icon_name = "audio-card"
    

    As stated above I'm pretty sure this is because of the sound kernel modules not loaded.

    An alternative approach would be to install the 4.9.0 image without enabling it and try to force-load the needed sound modules with the current kernel. Do you think it is worth a try?

    Don't be mistaken: I really appreciate your help so far and I know this could be considered a kind of corner case.



  • I would be really interested in the configuration used to build the axon-kernel, so I could try to rebuild the kernel and include the modules I need. Is there a place where I can get it?



  • I managed to get what I need by compiling a new (hopefully) compatible set of modules and installing by hands only the needed ones. Here are the steps I followed, executed directly on the AXON as root:

    v=$(uname -r)
    
    cd /usr/src
    wget https://cdn.kernel.org/pub/linux/kernel/v4.x/linux-$v.tar.xz
    tar xf linux-$v.tar.xz
    cd linux-$v
    gzip -dc /proc/config.gz > .config
    apt install libncurses5-dev bc
    
    # Customize the kernel to your needs. In my case I enabled the
    # snd-usb-audio module that, in cascade, enabled other sound stuff.
    make menuconfig
    
    # Build and install *only* the new modules.
    make modules
    mkdir -p /lib/modules/$v/kernel/sound/usb
    cp sound/usb/*.ko /lib/modules/$v/kernel/sound/usb/
    cp sound/core/snd-*.ko /lib/modules/$v/kernel/sound/core/
    depmod
    
    # Not strictly needed, but forbidding future axon-kernel upgrades
    # could avoid potential hard-to-debug problems.
    apt-mark hold axon-kernel