A command-line tool for querying Linux audio hardware capabilities and managing HDA codec jack retasking.
- Hardware Discovery: Enumerate all ALSA sound cards and their PCM devices
- Capability Detection: Query sample rates, bit depths, and channel counts supported by each device
- HDA Codec Information: Display pin configurations including jack colors, locations, and connector types
- Retasking Detection: Identify pins that have been retasked from their original BIOS configuration
- Boot Override Generation: Create firmware patch files for persistent jack retasking
# Basic usage - show all cards and capabilities
docker run -it --rm \
--device /dev/snd \
-v /proc/asound:/host/asound:ro \
-v /sys/class/sound:/host/sys/class/sound:ro \
ghcr.io/scyto/alsa-capabilitiesCard 0: HDA Intel PCH
ID: PCH
Driver: snd_hda_intel
Path: /devices/pci0000:00/0000:00:1f.3
HDA Codec: Realtek ALC892
Pin Configuration:
+--------+----------------+----------+-----------+-------------+
| Node | Function | Location | Color | Connector |
+--------+----------------+----------+-----------+-------------+
| 0x14 | Line Out | Rear | Green | 1/8" |
| 0x15 | HP Out | Front | Green | 1/8" |
| 0x18 | Mic In | Rear | Pink | 1/8" |
| 0x1a | Line In | Rear | Blue | 1/8" |
| 0x1b | Line Out | Rear | Orange | 1/8" |
+--------+----------------+----------+-----------+-------------+
Playback Devices:
hw:0,0 - ALC892 Analog
Rates: 44100, 48000, 96000, 192000
Formats: S16_LE, S32_LE
Channels: 2, 4, 6, 8
HDA codecs allow changing the function of audio jacks. For example, you can convert a "Line In" jack to a "Line Out" for additional speaker outputs.
docker run -it --rm \
--device /dev/snd \
-v /proc/asound:/host/asound:ro \
-v /sys/class/sound:/host/sys/class/sound:ro \
ghcr.io/scyto/alsa-capabilities \
--generate-boot-override=0:0 --pin=blue:line-out --dry-rundocker run -it --rm \
--device /dev/snd \
-v /proc/asound:/host/asound:ro \
-v /sys/class/sound:/host/sys/class/sound:ro \
-v $(pwd):/output \
ghcr.io/scyto/alsa-capabilities \
--generate-boot-override=0:0 --pin=blue:line-out --output=/outputYou can reference pins by:
- Color:
--pin=blue:line-out(physical jack color) - Current role:
--pin=line-in:line-out(current function) - Node ID:
--pin=0x1a:line-out(hex address)
| Role | Description |
|---|---|
line-out |
Stereo line-level output |
hp-out |
Headphone output (with amplification) |
line-in |
Stereo line-level input |
mic |
Microphone input (with preamp) |
speaker |
Internal speaker output |
spdif-out |
Digital optical/coaxial output |
disabled |
Disable the jack |
See docs/pin-retasking.md for a complete step-by-step guide.
Usage: AlsaCapabilities.Console [options]
Options:
-v, --verbose Show detailed output including raw formats
--retask-info Show HDA jack retasking information
--generate-boot-override=CARD:CODEC
Generate boot override files for persistent retasking
--pin=SELECTOR:ROLE Set pin configuration (use with --generate-boot-override)
--dry-run Show what would be generated without writing files
--output=DIR Output directory for boot override files (default: /tmp)
-h, --help Show this help message
- .NET 8.0 SDK
- Linux with ALSA (for runtime)
dotnet build AlsaCapabilities.slndotnet run --project AlsaCapabilities.Consoledocker build -t alsa-capabilities .alsa-capabilities/
├── AlsaNative/ # Core library
│ ├── AlsaInterop.cs # P/Invoke bindings to libasound
│ ├── HdaCodecReader.cs # /proc/asound codec parsing
│ ├── HdaRetasker.cs # Boot override generation
│ ├── SysfsReader.cs # /sys/class/sound parsing
│ ├── PinConfigBuilder.cs # HDA pin config construction
│ └── Models/ # Data models
├── AlsaCapabilities.Console/ # CLI application
│ └── Program.cs
├── docs/
│ └── pin-retasking.md # Retasking guide
└── Dockerfile
The tool uses direct P/Invoke calls to libasound.so.2 to query hardware parameters, avoiding dependencies on command-line tools like aplay or arecord.
Pin configurations are read from /proc/asound/cardN/codec#M which contains the 32-bit pin default values encoding:
- Device type (Line Out, HP Out, Mic In, etc.)
- Location (Rear, Front, Internal)
- Color (Green, Pink, Blue, Orange, etc.)
- Connector type (1/8", RCA, Optical)
The tool compares current pin configs (from /proc/asound) with original BIOS configs (from /sys/class/sound/hwCxDy/init_pin_configs) to identify retasked pins.
Persistent retasking uses the kernel's snd-hda-intel patch= mechanism:
hda-jack-retask.conf- modprobe configurationhda-jack-retask.fw- firmware patch with new pin configs
| Mount | Purpose |
|---|---|
--device /dev/snd |
Access to ALSA devices |
-v /proc/asound:/host/asound:ro |
HDA codec information |
-v /sys/class/sound:/host/sys/class/sound:ro |
Sysfs device info, original pin configs |
-v $(pwd):/output |
Output directory for generated files |
MIT License - See LICENSE file for details.