Skip to content

Instantly share code, notes, and snippets.

@AlexandrLucas
Last active December 14, 2022 19:45
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
}
@RoberlandRicardo
Copy link

I'm getting Failure: Module initialization failed, have a solution?

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