Denis Shulyaka wrote:
> 2017-07-18 8:47 GMT+02:00 Clemens Ladisch:
> > > Does ALSA provide any general interface for the userspace applications
> > > that indicates the SPDIF source sample rate?
> >
> > Yes, but the USB audio driver does not implement it because the USB
> > audio specification does not define such an interface between the driver
> > and the device.
> What could I use if I had a non-USB sound card with SPDIF-in?

There would be a mixer control "IEC958 Capture Default" associated with
the PCM device (i.e., not a real mixer control visible in alsamixer),
containing the channel status bits; the "IEC958 Capture Mask" control
defines which bits are valid.

> > At the moment, you have to write the code yourself.  But if you've
> > tested it, we would be interested in integrating it into the kernel
> > driver.
> The below program outputs the current SPDIF-In sample rate of my card.

The HID interface is managed by another driver.  The kernel driver
already knows how to write to these registers with a control request
instead (see below).  Could you check if a control read request works,
or if the response still goes through the HID pipe?


static int snd_usb_cm106_write_int_reg(struct usb_device *dev, int reg, u16 
        u8 buf[4];
        buf[0] = 0x20;
        buf[1] = value & 0xff;
        buf[2] = (value >> 8) & 0xff;
        buf[3] = reg;
        return snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), 
                               USB_DIR_OUT | USB_TYPE_CLASS | 
                               0, 0, &buf, 4);

Check out the vibrant tech community on one of the world's most
engaging tech sites,!
Alsa-user mailing list

Reply via email to