Skip to content

Instantly share code, notes, and snippets.

@AlexandrLucas
Last active July 23, 2025 16:19
Show Gist options
  • Save AlexandrLucas/b61d59ae98720a405c33c65f69870bc8 to your computer and use it in GitHub Desktop.
Save AlexandrLucas/b61d59ae98720a405c33c65f69870bc8 to your computer and use it in GitHub Desktop.
Enabling Astro A20 on Ubuntu 20.04

Description

The Astro A20 headphones are NOT being registered as an output device on Ubuntu 20.04, even though the built-in mic is registered correctly as an input device.

Fix

Append the function below to your ~/.bashrc and then you can simply type in a20 in the terminal whenever you need to connect your A20 headset.
It checks to make sure the headset is plugged in and uses a regex to automatically detect the card number, which often changes. The device number on the other hand seems to be always "1" (at least for me). If you want to connect the headset at startup, simply copy the function body (what's inside the curly brackets) to ~/.profile.

# Astro A20 headphones
a20() {
    if (aplay -l | grep -q 'Astro A20') then
        pactl load-module module-alsa-sink device=hw:"$(aplay -l | grep -oPm1 'card \K[\d\+]*?(?=: A20)')",1
    else
        echo "A20 not found"
    fi
}
@XavierBit
Copy link

XavierBit commented Jul 23, 2025

Hi!
I really don't want to wake the dead, but I'm very grateful I found this post. I still use A20 headphones and recently switched to a Debian based distro, Linux Mint.

Although this helped me to get onto the right track, I had to have a persistent sink name to connect it to the correct outputs. I came up with this solution which seems to work:

#!/bin/bash
# Astro A20 registration function (PipeWire compatible)
a20() {
    if aplay -l | grep -q 'Astro A20'; then
        CARD=$(aplay -l | grep -oPm1 'card \K[\d]+(?=: A20)')
        if pactl list sinks short | grep -q '^AstroA20'; then
            echo "AstroA20 sink already loaded"
        else
            pactl load-module module-alsa-sink device=hw:"${CARD}",1 sink_name=AstroA20 sink_properties=device.description="Astro A20"
        fi
    else
        echo "A20 not found"
    fi
}

If you want to use this in a startup script (Startup Applications in Mint) , calling the function 'a20' directly and silent on startup, you just have to add :

# Call the function
a20

This should always create a sink called 'Astro'.

I hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment