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
}
@unevenmango
Copy link

The command
$ pactl load-module module-alsa-sink device=hw:1,1
works great. but i cant get the permanent fix to work

@AlexandrLucas
Copy link
Author

AlexandrLucas commented Jan 10, 2022

Can confirm @unevenmango, adding that line in /etc/pulse/default.pa has stopped working for me on a fresh 20.04 install. Not sure why.

A quick workaround is to include the magic command into the startup script at the end of ~/.profile (in case the headset is always plugged in, otherwise the x server will crash on startup)

@danbaggs
Copy link

danbaggs commented Jan 11, 2022

Alex, this command works fine for me, but the device=hw: number keeps changing when i disconnect / reconnect the device (I use the headset on my Xbox as well).

Is there a way for use some other naming method for the device?

I'm a Linux noob, but I've managed to create a symlink for the headset called "ASTRO_A20".

I tried device=ASTRO_A20, but got no joy.

@AlexandrLucas
Copy link
Author

@unevenmango , @baggage494 Had to reinstall Ubuntu again today and did a better fix for the A20 problem. Have a look at the updated gist, if it's still relevant to you.

@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