build+tools: fw_content.conf 填 audiod/audio CLI md5; 新增诊断工具 sndprobe(PCM设备探测)/tonepcm2(HW_REFINE能力探测+写计时时钟验证) — 无声定位用。M2.90(0.7.85) 已打包 504bc74b 回验0diff
This commit is contained in:
1 parent
ade0a57353
commit
942bdece78
4 files changed
+249
-2
No files matched your search
@@ -0,0 +1,39 @@
|
||||
/* sndprobe.c — 探测 /dev/snd/pcmC0D{p,c}* 的 SNDRV_PCM_IOCTL_INFO(id/name/subs),
|
||||
* 定位 R3 Pro II 耳机输出到底在哪个 PCM 设备。静态 mipsel,只读不写参数。 */
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sound/asound.h>
|
||||
|
||||
int main(void)
|
||||
{
|
||||
static const char *devs[] = {
|
||||
"/dev/snd/pcmC0D0p", "/dev/snd/pcmC0D1p", "/dev/snd/pcmC0D0c", "/dev/snd/pcmC0D1c",
|
||||
};
|
||||
for (int i = 0; i < 4; i++) {
|
||||
int fd = open(devs[i], O_RDWR | O_NONBLOCK);
|
||||
if (fd < 0) { printf("%s: open fail\n", devs[i]); continue; }
|
||||
struct snd_pcm_info info;
|
||||
memset(&info, 0, sizeof info);
|
||||
if (ioctl(fd, SNDRV_PCM_IOCTL_INFO, &info) == 0)
|
||||
printf("%s: card=%d dev=%d sub=%d id=\"%s\" name=\"%s\" subname=\"%s\" subs=%u/%u\n",
|
||||
devs[i], info.card, info.device, info.subdevice,
|
||||
info.id, info.name, info.subname, info.subdevices_avail, info.subdevices_count);
|
||||
else
|
||||
printf("%s: INFO ioctl fail\n", devs[i]);
|
||||
close(fd);
|
||||
}
|
||||
/* 控制设备:看卡名 */
|
||||
int cf = open("/dev/snd/controlC0", O_RDONLY);
|
||||
if (cf >= 0) {
|
||||
struct snd_ctl_card_info ci;
|
||||
memset(&ci, 0, sizeof ci);
|
||||
if (ioctl(cf, SNDRV_CTL_IOCTL_CARD_INFO, &ci) == 0)
|
||||
printf("controlC0: id=\"%s\" driver=\"%s\" name=\"%s\" longname=\"%s\"\n",
|
||||
ci.id, ci.driver, ci.name, ci.longname);
|
||||
close(cf);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in new issue
Block a user