• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

hardware/libaudio


Commit MetaInfo

Revisão7b7bf0207ad99efc5d287d64bc7aac6dd3402640 (tree)
Hora2017-09-13 17:10:29
AutorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Mensagem de Log

audio_hw: allow to set sound card by properties

To manually specify the audio in and out device nodes, set the
properties like:

Audio in: hal.audio.in=pcmC1D0c
Audio out: hal.audio.out=pcmC1D3p

Mudança Sumário

Diff

--- a/audio_hw.c
+++ b/audio_hw.c
@@ -187,7 +187,17 @@ struct snd_pcm_info *select_card(unsigned int device, unsigned int flags)
187187 if (!cached_info[d] && !cached_info[d + 2]) {
188188 struct dirent **namelist;
189189 char path[PATH_MAX] = "/dev/snd/";
190- int n = scandir(path, &namelist, NULL, alphasort);
190+ char prop[PROPERTY_VALUE_MAX];
191+ int n;
192+ if (property_get(d ? "hal.audio.in" : "hal.audio.out", prop, NULL)) {
193+ ALOGI("using %s from property", prop);
194+ namelist = malloc(sizeof(struct dirent *));
195+ namelist[0] = calloc(1, sizeof(struct dirent));
196+ strncpy(namelist[0]->d_name, prop, sizeof(namelist[0]->d_name) - 1);
197+ n = 1;
198+ } else {
199+ n = scandir(path, &namelist, NULL, alphasort);
200+ }
191201 if (n >= 0) {
192202 int i, fd;
193203 for (i = 0; i < n; i++) {