如果系统插入了USB AUDIO设备,那么内核里面就已经知道这个设备的一些参数,
我想把这些参数取出来,以后打开时候用,
现在只知道,cat /proc/asound/card2/stream0 是可以取到,有没有什么标准的方法去那设备信息?
Capture:
Status: Stop
Interface 1
Altset 1
Format: S16_LE
Channels: 1
Endpoint: 6 IN (ASYNC)
Rates: 16000
Data packet interval: 1000 us
Interface 1
Altset 2
Format: S16_LE
Channels: 1
Endpoint: 6 IN (ASYNC)
Rates: 24000
Data packet interval: 1000 us
Interface 1
Altset 3
Format: S16_LE
Channels: 1
Endpoint: 6 IN (ASYNC)
Rates: 32000
Data packet interval: 1000 us
Interface 1
Altset 4
Format: S16_LE
Channels: 1
Endpoint: 6 IN (ASYNC)
Rates: 48000
Data packet interval: 1000 us
struct audioformat {
struct list_head list;
u64 formats; /* ALSA format bits */
unsigned int channels; /* # channels */
unsigned int fmt_type; /* USB audio format type (1-3) */
unsigned int frame_size; /* samples per frame for non-audio */
int iface; /* interface number */
unsigned char altsetting; /* corresponding alternate setting */
unsigned char altset_idx; /* array index of altenate setting */
unsigned char attributes; /* corresponding attributes of cs endpoint */
unsigned char endpoint; /* endpoint */
unsigned char ep_attr; /* endpoint attributes */
unsigned char datainterval; /* log_2 of data packet interval */
unsigned int maxpacksize; /* max. packet size */
unsigned int rates; /* rate bitmasks */
unsigned int rate_min, rate_max; /* min/max rates */
unsigned int nr_rates; /* number of rate table entries */
unsigned int *rate_table; /* rate table */
unsigned char clock; /* associated clock */
};
我想把这些参数取出来,以后打开时候用,
现在只知道,cat /proc/asound/card2/stream0 是可以取到,有没有什么标准的方法去那设备信息?
Capture:
Status: Stop
Interface 1
Altset 1
Format: S16_LE
Channels: 1
Endpoint: 6 IN (ASYNC)
Rates: 16000
Data packet interval: 1000 us
Interface 1
Altset 2
Format: S16_LE
Channels: 1
Endpoint: 6 IN (ASYNC)
Rates: 24000
Data packet interval: 1000 us
Interface 1
Altset 3
Format: S16_LE
Channels: 1
Endpoint: 6 IN (ASYNC)
Rates: 32000
Data packet interval: 1000 us
Interface 1
Altset 4
Format: S16_LE
Channels: 1
Endpoint: 6 IN (ASYNC)
Rates: 48000
Data packet interval: 1000 us
struct audioformat {
struct list_head list;
u64 formats; /* ALSA format bits */
unsigned int channels; /* # channels */
unsigned int fmt_type; /* USB audio format type (1-3) */
unsigned int frame_size; /* samples per frame for non-audio */
int iface; /* interface number */
unsigned char altsetting; /* corresponding alternate setting */
unsigned char altset_idx; /* array index of altenate setting */
unsigned char attributes; /* corresponding attributes of cs endpoint */
unsigned char endpoint; /* endpoint */
unsigned char ep_attr; /* endpoint attributes */
unsigned char datainterval; /* log_2 of data packet interval */
unsigned int maxpacksize; /* max. packet size */
unsigned int rates; /* rate bitmasks */
unsigned int rate_min, rate_max; /* min/max rates */
unsigned int nr_rates; /* number of rate table entries */
unsigned int *rate_table; /* rate table */
unsigned char clock; /* associated clock */
};