标签:录音 系统默认 code span int else auto http new
Platform: Rockchip
OS: Android 7.1.2
Kernel: 4.4
1.问题描述:当插上USB mic录音设备开机时,系统没有声音。开机后再接上USB mic,此时声音就正常。
2.问题分析:
接着usb mic开机时,MT100:/ # cat /proc/asound/cards
cat /proc/asound/cards
0 [Device ]: USB-Audio - USB Audio Device
USB Audio Device at usb-ff540000.usb-1.1, full speed
1 [rockchipes8323c]: rockchip_es8323 - rockchip,es8323-codec
rockchip,es8323-codec
开机后再接usb mic时,MT100:/ # cat /proc/asound/cards
cat /proc/asound/cards
0 [rockchipes8323c]: rockchip_es8323 - rockchip,es8323-codec
rockchip,es8323-codec
1 [Device ]: USB-Audio - USB Audio Device
USB Audio Device at usb-ff540000.usb-1.1, full speed
可见,这种情况是由于USB声卡被优先挂载,导致系统声卡不出声音。
3.解决方案:将usb声卡注册顺序延后
diff --git a/sound/usb/card.c b/sound/usb/card.c old mode 100644 new mode 100755 index 83336bb..f3323ed --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -83,6 +83,11 @@ static int device_setup[SNDRV_CARDS]; /* device parameter for this card */ static bool ignore_ctl_error; static bool autoclock = true; +#define CONFIG_SND_RK_SOC +#ifdef CONFIG_SND_RK_SOC +#define USB_AUDIO_CARD_NUM 3 +#endif + module_param_array(index, int, NULL, 0444); MODULE_PARM_DESC(index, "Index value for the USB audio adapter."); module_param_array(id, charp, NULL, 0444); @@ -369,9 +374,14 @@ static int snd_usb_audio_create(struct usb_interface *intf, dev_err(&dev->dev, "unknown device speed %d\n", snd_usb_get_speed(dev)); return -ENXIO; } - - err = snd_card_new(&intf->dev, index[idx], id[idx], THIS_MODULE, + + #ifdef CONFIG_SND_RK_SOC + err = snd_card_new(&intf->dev, USB_AUDIO_CARD_NUM, id[idx], THIS_MODULE, + 0, &card); + #else + err = snd_card_new(&intf->dev, index[idx], id[idx], THIS_MODULE, 0, &card); + #endif if (err < 0) { dev_err(&dev->dev, "cannot create card instance %d\n", idx); return err;
加上以上修改,即可解决此问题。
usb声卡注册的设备号固定注册为3,不占用系统默认的0即可。
标签:录音 系统默认 code span int else auto http new
原文地址:https://www.cnblogs.com/wmc245376374/p/14838836.html