control: ucm: add ioctl to retrieve full card components

The fixed-size components field in SNDRV_CTL_IOCTL_CARD_INFO can be too
small on systems with many audio devices. The kernel [1] will provide a
new ioctl to read the full string while truncating the original in
card_info if it grows too big. Make sure alsa-lib can read the full
string if the original is truncated.

[1] https://lore.kernel.org/all/20260303145815.9930-1-mstrozek@opensource.cirrus.com/

Signed-off-by: Maciej Strozek <mstrozek@opensource.cirrus.com>
This commit is contained in:
Maciej Strozek 2026-02-19 13:46:20 +00:00
parent 75ed5f05ba
commit 22c3701630
4 changed files with 61 additions and 6 deletions

View file

@ -101,7 +101,6 @@
#define _snd_pcm_sw_params snd_pcm_sw_params
#define _snd_pcm_status snd_pcm_status
#define _snd_ctl_card_info snd_ctl_card_info
#define _snd_ctl_elem_id snd_ctl_elem_id
#define _snd_ctl_elem_list snd_ctl_elem_list
#define _snd_ctl_elem_info snd_ctl_elem_info
@ -226,6 +225,20 @@
#include "seq_midi_event.h"
#include "list.h"
/* V2 structure - increased components string from 128 bytes to 512 bytes */
struct _snd_ctl_card_info {
int card; /* card number */
int pad; /* reserved for future (was type) */
unsigned char id[16]; /* ID of card (user selectable) */
unsigned char driver[16]; /* Driver name */
unsigned char name[32]; /* Short name of soundcard */
unsigned char longname[80]; /* name + info text about soundcard */
unsigned char reserved_[16]; /* reserved for future (was ID of mixer) */
unsigned char mixername[80]; /* visual mixer identification */
char components[512];
};
struct _snd_async_handler {
enum {
SND_ASYNC_HANDLER_GENERIC,