Android-x86
Fork

  • R/O
  • HTTP
  • SSH
  • HTTPS

hardware-libaudio: コミット

hardware/libaudio


コミットメタ情報

リビジョン7b7bf0207ad99efc5d287d64bc7aac6dd3402640 (tree)
日時2017-09-13 17:10:29
作者Chih-Wei Huang <cwhuang@linu...>
コミッターChih-Wei Huang

ログメッセージ

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

変更サマリ

差分

--- 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++) {
旧リポジトリブラウザで表示