cpal icon indicating copy to clipboard operation
cpal copied to clipboard

usb audio output device not found

Open m4b opened this issue 3 years ago • 2 comments

I cannot enumerate usb audio output devices on linux with alsa, either on an archlinux x86 laptop or a raspberry pi. aplay -L returns e.g.:

... snip
hdmi:CARD=PCH,DEV=4
    HDA Intel PCH, HDMI 4
    HDMI Audio Output
usbstream:CARD=PCH
    HDA Intel PCH
    USB Stream Output

and enumeration with example and my own code only shows the last hdmi dev=4 device, e.g.:

  19. "hdmi:CARD=PCH,DEV=4"
    Error getting supported input configs: DeviceNotAvailable
    Default output stream config:
      SupportedStreamConfig { channels: 2, sample_rate: SampleRate(44100), buffer_size: Range { min: 8, max: 1048576 }, sample_format: I16 }

is there something I'm missing here?

m4b avatar Jul 08 '22 00:07 m4b

The alsa crate finds this device, similar to another (fixed) issue, this code works as expected:

use std::ffi::CString;

fn main() {
    for card in alsa::card::Iter::new() {
        println!("Card {}", card.unwrap().get_name().unwrap());
        let iface = CString::new("pcm");

        for device in
            alsa::device_name::HintIter::new(Some(&card.unwrap()), &iface.unwrap()).unwrap()
        {
            println!("Device {}", device.name.unwrap());
        }
    }
}

finds the usbstream device:

Card HDA Intel PCH
Device sysdefault:CARD=PCH
Device front:CARD=PCH,DEV=0
Device surround21:CARD=PCH,DEV=0
Device surround40:CARD=PCH,DEV=0
Device surround41:CARD=PCH,DEV=0
Device surround50:CARD=PCH,DEV=0
Device surround51:CARD=PCH,DEV=0
Device surround71:CARD=PCH,DEV=0
Device hdmi:CARD=PCH,DEV=0
Device hdmi:CARD=PCH,DEV=1
Device hdmi:CARD=PCH,DEV=2
Device hdmi:CARD=PCH,DEV=3
Device hdmi:CARD=PCH,DEV=4
Device usbstream:CARD=PCH

m4b avatar Jul 08 '22 01:07 m4b

Did you find a solution for that?

simonwep avatar Oct 17 '23 16:10 simonwep