Disable HDMI-audio

1,852 views
Skip to first unread message

Kossuth

unread,
Sep 8, 2017, 4:21:15 PM9/8/17
to Android-x86
Hello everyone. Does anybody know how to disable HDMI-audio on Nvidia Geforce 315 card. I'd like to use the motherboards onboard audios 3,5mm jack for the output, but as soon as the Geforce is installed to the system the onboard audio goes silent. I'm running android 7-rc1. Thank you in advance.

Kossuth

unread,
Sep 9, 2017, 4:12:23 PM9/9/17
to Android-x86
I've been poking around the system, and found several things that can relate to this subject. /etc/init.sh has some lines that have something to do with the soundcard loading but I don't know should I try to edit it. I edited the /etc/audio_policy.conf and removed the hdmi as possible output, but it didn't work. I can see both of the soundcards in the /dev, but can anyone tell me how to unload the hdmi card or prevent it from loading. I tried to blacklist kernelmodule snd_hda_codec_hdmi ,but it didn't enable the line out.

Any suggestions are welcome, thank you.

Chih-Wei Huang

unread,
Sep 10, 2017, 1:09:48 AM9/10/17
to Android-x86
2017-09-10 4:12 GMT+08:00 Kossuth <tomi.kos...@gmail.com>:
> I've been poking around the system, and found several things that can relate to this subject. /etc/init.sh has some lines that have something to do with the soundcard loading but I don't know should I try to edit it. I edited the /etc/audio_policy.conf and removed the hdmi as possible output, but it didn't work. I can see both of the soundcards in the /dev, but can anyone tell me how to unload the hdmi card or prevent it from loading. I tried to blacklist kernelmodule snd_hda_codec_hdmi ,but it didn't enable the line out.

The more possible reason is there is
no driver for your sound card.
You can check the command (by root)

cat /proc/asound/cards

You can also test other linux distribution
to see if the sound card driver is loaded
correctly.


--
Chih-Wei
Android-x86 project
http://www.android-x86.org

Kossuth

unread,
Sep 10, 2017, 1:58:27 AM9/10/17
to Android-x86
The on board audio worked before I installed the Geforce card and starts working as soon as I uninstall it from the system. I can see both cards in the dev and both have loaded the snd_hda_codec driver to kernel.

Kossuth

unread,
Sep 10, 2017, 2:06:26 AM9/10/17
to Android-x86
BTW I googled this problem and it is quite common in many linux distros, that when user installs new graphic card that has HDMI output, it takes over and can't be easily disabled. Two common cures are blacklisting the driver, but I cant blacklist it because I think my onboard audio uses the same snd_hda_codec or configuring kernel, but that is beyond my skills.

Chih-Wei Huang

unread,
Sep 10, 2017, 2:34:17 AM9/10/17
to Android-x86
2017-09-10 14:06 GMT+08:00 Kossuth <tomi.kos...@gmail.com>:
> BTW I googled this problem and it is quite common in many linux distros,
> that when user installs new graphic card that has HDMI output, it takes over
> and can't be easily disabled. Two common cures are blacklisting the driver,
> but I cant blacklist it because I think my onboard audio uses the same
> snd_hda_codec or configuring kernel, but that is beyond my skills.

Then please show us

cat /proc/asound/cards

On a system with multiple sound cards,
the current android-x86 rule to select sound
cards is naive. It needs to be polished.

Kossuth

unread,
Sep 10, 2017, 2:44:31 AM9/10/17
to Android-x86
x86:/ $ cat /proc/asound/cards
0 [Intel ]: HDA-Intel - HDA Intel
HDA Intel at 0xfd320000 irq 30
1 [NVidia ]: HDA-Intel - HDA NVidia
HDA NVidia at 0xfd000000 irq 16

I think they both use the same driver because here is the lspci output

x86:/ $ lspci -k
00:1f.5 Class 0101: 8086:3a06 ata_piix
00:19.0 Class 0200: 8086:10df e1000e
00:1e.0 Class 0604: 8086:244e
00:03.2 Class 0101: 8086:2e16 ata_generic
00:1f.3 Class 0c05: 8086:3a60 i801_smbus
00:00.0 Class 0600: 8086:2e10
00:1a.2 Class 0c03: 8086:3a69 uhci_hcd
00:03.0 Class 0780: 8086:2e14
00:1d.2 Class 0c03: 8086:3a66 uhci_hcd
00:1a.0 Class 0c03: 8086:3a67 uhci_hcd
00:1d.0 Class 0c03: 8086:3a64 uhci_hcd
01:00.1 Class 0403: 10de:0be2 snd_hda_intel
00:1a.7 Class 0c03: 8086:3a6c ehci-pci
00:1c.4 Class 0604: 8086:3a78 pcieport
00:1d.7 Class 0c03: 8086:3a6a ehci-pci
00:03.3 Class 0700: 8086:2e17 serial
00:1f.2 Class 0101: 8086:3a00 ata_piix
00:1c.0 Class 0604: 8086:3a70 pcieport
00:1a.1 Class 0c03: 8086:3a68 uhci_hcd
00:1f.0 Class 0601: 8086:3a1a lpc_ich
00:01.0 Class 0604: 8086:2e11 pcieport
00:1d.1 Class 0c03: 8086:3a65 uhci_hcd
01:00.0 Class 0300: 10de:0a22 nouveau
00:1b.0 Class 0403: 8086:3a6e snd_hda_intel

x86:/ $

Chih-Wei Huang

unread,
Sep 10, 2017, 2:55:14 AM9/10/17
to Android-x86
2017-09-10 14:44 GMT+08:00 Kossuth <tomi.kos...@gmail.com>:
> x86:/ $ cat /proc/asound/cards
> 0 [Intel ]: HDA-Intel - HDA Intel
> HDA Intel at 0xfd320000 irq 30
> 1 [NVidia ]: HDA-Intel - HDA NVidia
> HDA NVidia at 0xfd000000 irq 16

In this case the first card (HDA-Intel)
should be selected.
Do you want it go to the second card?

Please also check

ls -l /proc/asound/card?/
Message has been deleted

Kossuth

unread,
Sep 10, 2017, 4:28:05 AM9/10/17
to Android-x86
I want the audio to come trough the Intel - Intel card, not the Intel - Nvidia card. Even tough the Intel - Intel card is first I suspect the audio is not routed to it. I can't be sure, because I don't have anything to receive HDMI audio with, but if I remove the Nvidia card, the line out in the motheboard starts working automatically. Is there a way to see where the system is currently routing the audio?
x86:/ $ ls -l /proc/asound/card?

-r--r--r-- 1 root root 0 2017-09-10 14:16 /proc/asound/cards

/proc/asound/card0:
total 0
-r--r--r-- 1 root root 0 2017-09-10 14:16 codec#2
-r--r--r-- 1 root root 0 2017-09-10 14:16 id
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm0c
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm0p
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm2c
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm3p

/proc/asound/card1:
total 0
-r--r--r-- 1 root root 0 2017-09-10 14:16 codec#0
-r--r--r-- 1 root root 0 2017-09-10 14:16 codec#1
-r--r--r-- 1 root root 0 2017-09-10 14:16 codec#2
-r--r--r-- 1 root root 0 2017-09-10 14:16 codec#3
-rw-r--r-- 1 root root 0 2017-09-10 14:16 eld#0.0
-rw-r--r-- 1 root root 0 2017-09-10 14:16 eld#1.0
-rw-r--r-- 1 root root 0 2017-09-10 14:16 eld#2.0
-rw-r--r-- 1 root root 0 2017-09-10 14:16 eld#3.0
-r--r--r-- 1 root root 0 2017-09-10 14:16 id
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm3p
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm7p
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm8p
dr-xr-xr-x 3 root root 0 2017-09-10 14:16 pcm9p
x86:/ $

Kossuth

unread,
Sep 10, 2017, 7:06:41 AM9/10/17
to Android-x86
I tried the following command and got the file playing from my line out

alsa_aplay -Dhw:0,0 /sdcard/piano2.wav

So now I know that the card and drivers are working, even if the sound routing is wrong.

Kossuth

unread,
Sep 10, 2017, 9:40:01 AM9/10/17
to Android-x86
I can remove the HDMI card from the system by echoing 1 to the remove file in the pci tree, but that does not bring the sound back to the motherboards card. Maybe it should be done during the boot in one of the init scripts. Does anyone have any idea where I should try to put echo > 1 command? Hopefully there would be some place where it would disable the card before the rest of the audio system initializes.

Chih-Wei Huang

unread,
Sep 10, 2017, 10:46:05 AM9/10/17
to Android-x86
The routing rule should just choose hw0,0.

Boot to android in debug mode.
The logcat will be saved to /data/log.txt
Then

grep audio_ /data/log.txt

It should show which card is selected.

You can also check the info of
each device in each card.

cat /proc/asound/card?/pcm?p/info

and the codec info

cat /proc/asound/card?/codec#?
Message has been deleted

Kossuth

unread,
Sep 11, 2017, 8:48:49 AM9/11/17
to Android-x86
Catlog grep from boot with geforce

 09-11 15:19:45.762  2342  2342 I AudioOut_D: type=1400 audit(0.0:862): avc: denied { write } for name="pcmC1D3p" dev="tmpfs" ino=6776 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:19:45.763  2342  2362 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:19:45.774  2342  2342 I AudioOut_D: type=1400 audit(0.0:865): avc: denied { ioctl } for path="/dev/snd/pcmC1D3p" dev="tmpfs" ino=6776 ioctlcmd=0x4101 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:19:52.318  2342  2362 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:21:03.457  2331  2331 E SELinux : avc:  denied  { add } for service=media.audio_flinger pid=2338 uid=1041 scontext=u:r:init:s0 tcontext=u:object_r:audioserver_service:s0 tclass=service_manager permissive=1
09-11 15:21:03.484  2338  2338 I APM::ConfigParsingUtils: loadAudioPolicyConfig() loaded /system/etc/audio_policy.conf
09-11 15:21:03.484  2331  2331 E SELinux : avc:  denied  { find } for service=media.audio_flinger pid=2338 uid=1041 scontext=u:r:init:s0 tcontext=u:object_r:audioserver_service:s0 tclass=service_manager permissive=1
09-11 15:21:03.550  2338  2338 I audioserver: type=1400 audit(0.0:76): avc: denied { write } for name="pcmC1D3p" dev="tmpfs" ino=6742 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:21:03.550  2338  2338 I audioserver: type=1400 audit(0.0:77): avc: denied { ioctl } for path="/dev/snd/pcmC1D3p" dev="tmpfs" ino=6742 ioctlcmd=0x4101 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:21:03.550  2338  2338 D audio_hw_primary: found audio out at /dev/snd/pcmC1D3p
09-11 15:21:03.550  2338  2338 D audio_hw_primary: card: 1/3 id: HDMI 0
09-11 15:21:03.550  2338  2338 D audio_hw_primary: name: HDMI 0
09-11 15:21:03.550  2338  2338 D audio_hw_primary: subname: subdevice #0
09-11 15:21:03.550  2338  2338 D audio_hw_primary: stream: 0
09-11 15:21:03.550  2338  2338 D audio_hw_primary: found audio out at /dev/snd/pcmC1D7p
09-11 15:21:03.550  2338  2338 D audio_hw_primary: card: 1/7 id: HDMI 0
09-11 15:21:03.550  2338  2338 D audio_hw_primary: name: HDMI 0
09-11 15:21:03.550  2338  2338 D audio_hw_primary: subname: subdevice #0
09-11 15:21:03.550  2338  2338 D audio_hw_primary: stream: 0
09-11 15:21:03.550  2338  2338 D audio_hw_primary: ignore pcmC1D7p
09-11 15:21:03.554  2338  2338 D audio_hw_primary: found audio out at /dev/snd/pcmC1D8p
09-11 15:21:03.554  2338  2338 D audio_hw_primary: card: 1/8 id: HDMI 0
09-11 15:21:03.554  2338  2338 D audio_hw_primary: name: HDMI 0
09-11 15:21:03.554  2338  2338 D audio_hw_primary: subname: subdevice #0
09-11 15:21:03.554  2338  2338 D audio_hw_primary: stream: 0
09-11 15:21:03.554  2338  2338 D audio_hw_primary: ignore pcmC1D8p
09-11 15:21:03.558  2338  2338 D audio_hw_primary: found audio out at /dev/snd/pcmC1D9p
09-11 15:21:03.558  2338  2338 D audio_hw_primary: card: 1/9 id: HDMI 0
09-11 15:21:03.558  2338  2338 D audio_hw_primary: name: HDMI 0
09-11 15:21:03.558  2338  2338 D audio_hw_primary: subname: subdevice #0
09-11 15:21:03.558  2338  2338 D audio_hw_primary: stream: 0
09-11 15:21:03.558  2338  2338 D audio_hw_primary: ignore pcmC1D9p
09-11 15:21:03.562  2338  2338 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:21:03.562  2338  2338 E audio_hw_primary: Failed to open /system/etc/mixer_paths.xml
09-11 15:21:03.565  2338  2338 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:21:25.035  2338  2362 D PermissionCache: checking android.permission.MODIFY_AUDIO_SETTINGS for uid=1000 => granted (140 us)
09-11 15:21:25.809  2338  2338 D PermissionCache: checking android.permission.CAPTURE_AUDIO_HOTWORD for uid=1000 => granted (135 us)
09-11 15:21:30.522  2605  2921 I Telecom : Telecom: Non-call EVENT: AUDIO_ROUTE, Entering state QuiescentEarpieceRoute
09-11 15:21:32.350  3017  3017 I alsa_ctl: type=1400 audit(0.0:356): avc: denied { ioctl } for path="/dev/snd/controlC0" dev="tmpfs" ino=8592 ioctlcmd=0x5501 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:21:32.427  3017  3017 I alsa_ctl: type=1400 audit(0.0:357): avc: denied { write } for name="controlC0" dev="tmpfs" ino=8592 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:21:40.603  2605  2663 W AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 4, track 44100 Hz, output 48000 Hz
09-11 15:21:40.731  2338  2360 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:21:50.235  2338  2360 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:21:59.042  2338  2360 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:21:59.041  2338  2338 I AudioOut_D: type=1400 audit(0.0:473): avc: denied { write } for name="pcmC1D3p" dev="tmpfs" ino=6742 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:21:59.041  2338  2338 I AudioOut_D: type=1400 audit(0.0:474): avc: denied { ioctl } for path="/dev/snd/pcmC1D3p" dev="tmpfs" ino=6742 ioctlcmd=0x4101 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:22:02.267  2338  2360 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:22:38.315  2338  2360 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:22:57.699  2338  2360 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:23:02.403  2338  2360 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:23:05.924  2338  2360 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:23:18.115  2338  2360 I audio_hw_primary: choose pcmC1D3p for 0
09-11 15:23:31.044  2338  2360 I audio_hw_primary: choose pcmC1D3p for 0

And without geforce

09-11 15:28:00.756  2332  2332 E SELinux : avc:  denied  { add } for service=media.audio_flinger pid=2339 uid=1041 scontext=u:r:init:s0 tcontext=u:object_r:audioserver_service:s0 tclass=service_manager permissive=1
09-11 15:28:00.775  2339  2339 I APM::ConfigParsingUtils: loadAudioPolicyConfig() loaded /system/etc/audio_policy.conf
09-11 15:28:00.775  2332  2332 E SELinux : avc:  denied  { find } for service=media.audio_flinger pid=2339 uid=1041 scontext=u:r:init:s0 tcontext=u:object_r:audioserver_service:s0 tclass=service_manager permissive=1
09-11 15:28:00.816  2339  2339 D audio_hw_primary: found audio out at /dev/snd/pcmC0D0p
09-11 15:28:00.816  2339  2339 D audio_hw_primary: card: 0/0 id: ALC663 Analog
09-11 15:28:00.816  2339  2339 D audio_hw_primary: name: ALC663 Analog
09-11 15:28:00.816  2339  2339 D audio_hw_primary: subname: subdevice #0
09-11 15:28:00.816  2339  2339 D audio_hw_primary: stream: 0
09-11 15:28:00.816  2339  2339 D audio_hw_primary: found audio out at /dev/snd/pcmC0D3p
09-11 15:28:00.816  2339  2339 D audio_hw_primary: card: 0/3 id: ALC663 Digital
09-11 15:28:00.816  2339  2339 D audio_hw_primary: name: ALC663 Digital
09-11 15:28:00.816  2339  2339 D audio_hw_primary: subname: subdevice #0
09-11 15:28:00.816  2339  2339 D audio_hw_primary: stream: 0
09-11 15:28:00.816  2339  2339 D audio_hw_primary: ignore pcmC0D3p
09-11 15:28:00.816  2339  2339 D audio_hw_primary: found audio out at /dev/snd/pcmC0D7p
09-11 15:28:00.816  2339  2339 D audio_hw_primary: card: 0/7 id: HDMI 0
09-11 15:28:00.816  2339  2339 D audio_hw_primary: name: HDMI 0
09-11 15:28:00.816  2339  2339 D audio_hw_primary: subname: subdevice #0
09-11 15:28:00.816  2339  2339 D audio_hw_primary: stream: 0
09-11 15:28:00.816  2339  2339 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:28:00.816  2339  2339 E audio_hw_primary: Failed to open /system/etc/mixer_paths.xml
09-11 15:28:00.815  2339  2339 I audioserver: type=1400 audit(0.0:97): avc: denied { write } for name="pcmC0D0p" dev="tmpfs" ino=6369 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:28:00.815  2339  2339 I audioserver: type=1400 audit(0.0:98): avc: denied { ioctl } for path="/dev/snd/pcmC0D0p" dev="tmpfs" ino=6369 ioctlcmd=0x4101 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:28:00.817  2339  2339 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:28:21.418  2339  2508 D PermissionCache: checking android.permission.MODIFY_AUDIO_SETTINGS for uid=1000 => granted (117 us)
09-11 15:28:22.160  2339  2508 D PermissionCache: checking android.permission.CAPTURE_AUDIO_HOTWORD for uid=1000 => granted (135 us)
09-11 15:28:25.674  2605  2896 I Telecom : Telecom: Non-call EVENT: AUDIO_ROUTE, Entering state QuiescentEarpieceRoute
09-11 15:28:29.162  3019  3019 I alsa_ctl: type=1400 audit(0.0:353): avc: denied { ioctl } for path="/dev/snd/controlC0" dev="tmpfs" ino=6368 ioctlcmd=0x5501 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:28:29.272  3019  3019 I alsa_ctl: type=1400 audit(0.0:354): avc: denied { write } for name="controlC0" dev="tmpfs" ino=6368 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:28:38.458  2605  2664 W AudioTrack: AUDIO_OUTPUT_FLAG_FAST denied by client; transfer 4, track 44100 Hz, output 48000 Hz
09-11 15:28:38.586  2339  2501 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:28:45.374  2339  2501 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:28:48.232  2339  2339 I FastMixer: type=1400 audit(0.0:457): avc: denied { ioctl } for path="/dev/snd/pcmC0D0p" dev="tmpfs" ino=6369 ioctlcmd=0x4123 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:28:48.843  2339  2501 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:28:48.842  2339  2339 I AudioOut_D: type=1400 audit(0.0:459): avc: denied { write } for name="pcmC0D0p" dev="tmpfs" ino=6369 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:28:53.867  2339  2501 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:29:18.668  2339  2501 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:29:23.074  2339  2501 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:29:27.586  2339  2339 I FastMixer: type=1400 audit(0.0:624): avc: denied { ioctl } for path="/dev/snd/pcmC0D0p" dev="tmpfs" ino=6369 ioctlcmd=0x4123 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:29:43.140  2339  2501 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:29:43.139  2339  2339 I AudioOut_D: type=1400 audit(0.0:663): avc: denied { write } for name="pcmC0D0p" dev="tmpfs" ino=6369 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
09-11 15:29:48.675  2339  2501 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:30:02.908  2339  2501 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:30:06.332  2339  2501 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:30:12.068  2339  2501 I audio_hw_primary: choose pcmC0D0p for 0
09-11 15:30:17.276  2339  2501 I audio_hw_primary: choose pcmC0D0p for 0

Kossuth

unread,
Sep 11, 2017, 9:04:20 AM9/11/17
to Android-x86
I grepped 2990 from the geforce bootlog and got this output, I dont know if this is relevant

09-11 15:21:32.631  2990  2990 I sh      : + hw_sh=/vendor/etc/init.sh
09-11 15:21:32.631  2990  2990 I sh      : + '[' -e /vendor/etc/init.sh ']'
09-11 15:21:32.631  2990  2990 I sh      : + do_bootcomplete
09-11 15:21:32.631  2990  2990 I sh      : + init_cpu_governor
09-11 15:21:32.636  2990  2990 I sh      : + getprop cpu.governor
09-11 15:21:32.644  2990  2990 I sh      : + governor=
09-11 15:21:32.644  2990  2990 I sh      : + '[' ']'
09-11 15:21:32.646  2990  2990 I sh      : + getprop persist.sys.root_access
09-11 15:21:32.657  2990  2990 I sh      : + '[' -z 3 ']'
09-11 15:21:32.658  2990  2990 I sh      : + grep -Ehq 'brcmfmac|rtl8723be'
09-11 15:21:32.663  2990  2990 I sh      : + lsmod
09-11 15:21:32.674  2990  2990 I sh      : + awk '{print $1}'
09-11 15:21:32.679  2990  2990 I sh      : + grep '\[.*\]' /proc/asound/cards
09-11 15:21:32.697  2990  2990 I sh      : + cat /proc/asound/card0/id
09-11 15:21:32.698  2990  2990 I sh      : + f=/system/etc/alsa/Intel.state
09-11 15:21:32.698  2990  2990 I sh      : + '[' -e /system/etc/alsa/Intel.state ']'
09-11 15:21:32.805  2990  2990 I sh      : + alsa_ctl init 0
09-11 15:21:32.644  2990  2990 I sh      : Found hardware: "HDA-Intel" "Realtek ALC663" "HDA:10ec0663,17341157,00100001" "0x1734" "0x1157"
09-11 15:21:32.645  2990  2990 I sh      : Hardware is initialized using a generic method
09-11 15:21:32.654  2990  2990 I sh      : + alsa_amixer -c 0 set Master on
09-11 15:21:32.698  2990  2990 I sh      : Simple mixer control 'Master',0
09-11 15:21:32.698  2990  2990 I sh      :   Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
09-11 15:21:32.698  2990  2990 I sh      :   Playback channels: Mono
09-11 15:21:32.698  2990  2990 I sh      :   Limits: Playback 0 - 64
09-11 15:21:32.698  2990  2990 I sh      :   Mono: Playback 44 [69%] [-20.00dB] [on]
09-11 15:21:32.698  2990  2990 I sh      : + alsa_amixer -c 0 set Master 100%
09-11 15:21:32.703  2990  2990 I sh      : Simple mixer control 'Master',0
09-11 15:21:32.703  2990  2990 I sh      :   Capabilities: pvolume pvolume-joined pswitch pswitch-joined penum
09-11 15:21:32.703  2990  2990 I sh      :   Playback channels: Mono
09-11 15:21:32.703  2990  2990 I sh      :   Limits: Playback 0 - 64
09-11 15:21:32.703  2990  2990 I sh      :   Mono: Playback 64 [100%] [0.00dB] [on]
09-11 15:21:32.703  2990  2990 I sh      : + alsa_amixer -c 0 set Headphone on
09-11 15:21:32.709  2990  2990 I sh      : Simple mixer control 'Headphone',0
09-11 15:21:32.709  2990  2990 I sh      :   Capabilities: pvolume pswitch penum
09-11 15:21:32.709  2990  2990 I sh      :   Playback channels: Front Left - Front Right
09-11 15:21:32.709  2990  2990 I sh      :   Limits: Playback 0 - 64
09-11 15:21:32.709  2990  2990 I sh      :   Mono:
09-11 15:21:32.709  2990  2990 I sh      :   Front Left: Playback 64 [100%] [0.00dB] [on]
09-11 15:21:32.709  2990  2990 I sh      :   Front Right: Playback 64 [100%] [0.00dB] [on]
09-11 15:21:32.718  2990  2990 I sh      : + alsa_amixer -c 0 set Headphone 100%
09-11 15:21:32.724  2990  2990 I sh      : Simple mixer control 'Headphone',0
09-11 15:21:32.724  2990  2990 I sh      :   Capabilities: pvolume pswitch penum
09-11 15:21:32.724  2990  2990 I sh      :   Playback channels: Front Left - Front Right
09-11 15:21:32.724  2990  2990 I sh      :   Limits: Playback 0 - 64
09-11 15:21:32.724  2990  2990 I sh      :   Mono:
09-11 15:21:32.724  2990  2990 I sh      :   Front Left: Playback 64 [100%] [0.00dB] [on]
09-11 15:21:32.724  2990  2990 I sh      :   Front Right: Playback 64 [100%] [0.00dB] [on]
09-11 15:21:32.725  2990  2990 I sh      : + alsa_amixer -c 0 set Speaker 100%
09-11 15:21:32.741  2990  2990 I sh      : Simple mixer control 'Speaker',0
09-11 15:21:32.741  2990  2990 I sh      :   Capabilities: pvolume pswitch pswitch-joined penum
09-11 15:21:32.741  2990  2990 I sh      :   Playback channels: Front Left - Front Right
09-11 15:21:32.742  2990  2990 I sh      :   Limits: Playback 0 - 64
09-11 15:21:32.742  2990  2990 I sh      :   Mono:
09-11 15:21:32.742  2990  2990 I sh      :   Front Left: Playback 64 [100%] [0.00dB] [on]
09-11 15:21:32.742  2990  2990 I sh      :   Front Right: Playback 64 [100%] [0.00dB] [on]
09-11 15:21:32.742  2990  2990 I sh      : + alsa_amixer -c 0 set Capture 100%
09-11 15:21:32.750  2990  2990 I sh      : Simple mixer control 'Capture',0
09-11 15:21:32.750  2990  2990 I sh      :   Capabilities: cvolume cswitch penum
09-11 15:21:32.750  2990  2990 I sh      :   Capture channels: Front Left - Front Right
09-11 15:21:32.750  2990  2990 I sh      :   Limits: Capture 0 - 31
09-11 15:21:32.750  2990  2990 I sh      :   Front Left: Capture 31 [100%] [30.00dB] [on]
09-11 15:21:32.750  2990  2990 I sh      :   Front Right: Capture 31 [100%] [30.00dB] [on]
09-11 15:21:32.750  2990  2990 I sh      : + alsa_amixer -c 0 set Capture cap
09-11 15:21:32.754  2990  2990 I sh      : Simple mixer control 'Capture',0
09-11 15:21:32.754  2990  2990 I sh      :   Capabilities: cvolume cswitch penum
09-11 15:21:32.754  2990  2990 I sh      :   Capture channels: Front Left - Front Right
09-11 15:21:32.755  2990  2990 I sh      :   Limits: Capture 0 - 31
09-11 15:21:32.755  2990  2990 I sh      :   Front Left: Capture 31 [100%] [30.00dB] [on]
09-11 15:21:32.755  2990  2990 I sh      :   Front Right: Capture 31 [100%] [30.00dB] [on]
09-11 15:21:32.756  2990  2990 I sh      : + alsa_amixer -c 0 set PCM 100 unmute
09-11 15:21:32.768  2990  2990 I sh      : amixer: Unable to find simple control 'PCM',0
09-11 15:21:32.768  2990  2990 I sh      :
09-11 15:21:32.768  2990  2990 I sh      : + alsa_amixer -c 0 set SPO unmute
09-11 15:21:32.774  2990  2990 I sh      : amixer: Unable to find simple control 'SPO',0
09-11 15:21:32.774  2990  2990 I sh      :
09-11 15:21:32.775  2990  2990 I sh      : + alsa_amixer -c 0 set 'Mic Boost' 3
09-11 15:21:32.785  2990  2990 I sh      : amixer: Unable to find simple control 'Mic Boost',0
09-11 15:21:32.785  2990  2990 I sh      :
09-11 15:21:32.786  2990  2990 I sh      : + alsa_amixer -c 0 set 'Internal Mic Boost' 3
09-11 15:21:32.792  2990  2990 I sh      : amixer: Unable to find simple control 'Internal Mic Boost',0
09-11 15:21:32.792  2990  2990 I sh      :
09-11 15:21:32.797  2990  2990 I sh      : + cat /proc/asound/card1/id
09-11 15:21:32.798  2990  2990 I sh      : + f=/system/etc/alsa/NVidia.state
09-11 15:21:32.798  2990  2990 I sh      : + '[' -e /system/etc/alsa/NVidia.state ']'
09-11 15:21:32.798  2990  2990 I sh      : + alsa_ctl init 1
09-11 15:21:32.802  2990  2990 I sh      : Found hardware: "HDA-Intel" "Nvidia Generic HDMI" "HDA:10de000a,10de0101,00100100" "0x174b" "0x1141"
09-11 15:21:32.803  2990  2990 I sh      : Hardware is initialized using a generic method
09-11 15:21:32.806  2990  2990 I sh      : + alsa_amixer -c 1 set Master on
09-11 15:21:32.831  2990  2990 I sh      : amixer: Unable to find simple control 'Master',0
09-11 15:21:32.831  2990  2990 I sh      :
09-11 15:21:32.831  2990  2990 I sh      : + alsa_amixer -c 1 set Master 100%
09-11 15:21:32.849  2990  2990 I sh      : amixer: Unable to find simple control 'Master',0
09-11 15:21:32.849  2990  2990 I sh      :
09-11 15:21:32.849  2990  2990 I sh      : + alsa_amixer -c 1 set Headphone on
09-11 15:21:32.880  2990  2990 I sh      : amixer: Unable to find simple control 'Headphone',0
09-11 15:21:32.880  2990  2990 I sh      :
09-11 15:21:32.880  2990  2990 I sh      : + alsa_amixer -c 1 set Headphone 100%
09-11 15:21:32.903  2990  2990 I sh      : amixer: Unable to find simple control 'Headphone',0
09-11 15:21:32.903  2990  2990 I sh      :
09-11 15:21:32.903  2990  2990 I sh      : + alsa_amixer -c 1 set Speaker 100%
09-11 15:21:32.918  2990  2990 I sh      : amixer: Unable to find simple control 'Speaker',0
09-11 15:21:32.918  2990  2990 I sh      :
09-11 15:21:32.919  2990  2990 I sh      : + alsa_amixer -c 1 set Capture 100%
09-11 15:21:32.924  2990  2990 I sh      : amixer: Unable to find simple control 'Capture',0
09-11 15:21:32.924  2990  2990 I sh      :
09-11 15:21:32.925  2990  2990 I sh      : + alsa_amixer -c 1 set Capture cap
09-11 15:21:32.933  2990  2990 I sh      : amixer: Unable to find simple control 'Capture',0
09-11 15:21:32.933  2990  2990 I sh      :
09-11 15:21:32.933  2990  2990 I sh      : + alsa_amixer -c 1 set PCM 100 unmute
09-11 15:21:32.938  2990  2990 I sh      : amixer: Unable to find simple control 'PCM',0
09-11 15:21:32.938  2990  2990 I sh      :
09-11 15:21:32.938  2990  2990 I sh      : + alsa_amixer -c 1 set SPO unmute
09-11 15:21:32.947  2990  2990 I sh      : amixer: Unable to find simple control 'SPO',0
09-11 15:21:32.947  2990  2990 I sh      :
09-11 15:21:32.947  2990  2990 I sh      : + alsa_amixer -c 1 set 'Mic Boost' 3
09-11 15:21:32.951  2990  2990 I sh      : amixer: Unable to find simple control 'Mic Boost',0
09-11 15:21:32.952  2990  2990 I sh      :
09-11 15:21:32.952  2990  2990 I sh      : + alsa_amixer -c 1 set 'Internal Mic Boost' 3
09-11 15:21:32.957  2990  2990 I sh      : amixer: Unable to find simple control 'Internal Mic Boost',0
09-11 15:21:32.957  2990  2990 I sh      :
09-11 15:21:32.958  2990  2990 I sh      : + post_bootcomplete
09-11 15:21:32.958  2990  2990 I sh      : /system/etc/init.sh[462]: post_bootcomplete: not found
09-11 15:21:32.958  2990  2990 I sh      : + return 0

Kossuth

unread,
Sep 12, 2017, 9:33:11 AM9/12/17
to Android-x86
This is becoming hopeless. I've tried every alsa command I could google to find out which is the default output or change it, but no effect. I've also tried to set the properties audio.routing and hal.audio.primary.hdmi, but no effect. I've tried to change the files in /dev/snd/pcmC... around with init.sh to get the default card changed but with no use. It seems that it is impossible for user to find out the default audio route setting let alone to change it. Maybe I have to find a card without the hdmi output, and use DVI-hdmi adapter.

Chih-Wei Huang

unread,
Sep 12, 2017, 12:01:33 PM9/12/17
to Android-x86
09-11 15:28:00.816 2339 2339 I audio_hw_primary: choose pcmC0D0p for 0

2017-09-11 20:44 GMT+08:00 Kossuth <tomi.kos...@gmail.com>:
> Below is catlog grep from boot with the Geforce card

> 09-11 15:21:03.550 2338 2338 D audio_hw_primary: found audio out at
> /dev/snd/pcmC1D3p
> 09-11 15:21:03.550 2338 2338 D audio_hw_primary: card: 1/3 id: HDMI 0
> 09-11 15:21:03.550 2338 2338 D audio_hw_primary: name: HDMI 0
> 09-11 15:21:03.550 2338 2338 D audio_hw_primary: subname: subdevice #0
> 09-11 15:21:03.550 2338 2338 D audio_hw_primary: stream: 0
> 09-11 15:21:03.550 2338 2338 D audio_hw_primary: found audio out at
...
> 09-11 15:21:40.731 2338 2360 I audio_hw_primary: choose pcmC1D3p for 0

pcmC1D3p is the chosen card with the Geforce card.

This is strange. Please show ls -l /dev/snd/

> And below catlog grep from boot without the Geforce
...
> 09-11 15:28:00.816 2339 2339 D audio_hw_primary: found audio out at
> /dev/snd/pcmC0D0p
> 09-11 15:28:00.816 2339 2339 D audio_hw_primary: card: 0/0 id: ALC663
> Analog
> 09-11 15:28:00.816 2339 2339 D audio_hw_primary: name: ALC663 Analog
> 09-11 15:28:00.816 2339 2339 D audio_hw_primary: subname: subdevice #0
> 09-11 15:28:00.816 2339 2339 D audio_hw_primary: stream: 0
...

> 09-11 15:28:00.817 2339 2339 I audio_hw_primary: choose pcmC0D0p for 0

pcmC0D0p is the chosen card without the Geforce card.
This is expected.

If /dev/snd/pcmC0D0p presents, the card selection rule
should just choose it.
It's very strange it chose pcmC1D3p in the case
with the Geforce card.

You can try to remove the pcmC1* device nodes
to see if it choose pcmC0D0p again:

rm /dev/snd/pcmC1*

Then restart zygote:

stop; start

Kossuth

unread,
Sep 12, 2017, 1:14:57 PM9/12/17
to Android-x86

x86:/ # ls -l /dev/snd
total 0
crw-rw---- 1 system audio 116, 11 2017-09-12 16:12 controlC0
crw-rw---- 1 system audio 116, 2 2017-09-12 19:11 controlC1
crw-rw---- 1 system audio 116, 16 2017-09-12 16:12 hwC0D2
crw-rw---- 1 system audio 116, 7 2017-09-12 19:11 hwC1D0
crw-rw---- 1 system audio 116, 8 2017-09-12 19:11 hwC1D1
crw-rw---- 1 system audio 116, 9 2017-09-12 19:11 hwC1D2
crw-rw---- 1 system audio 116, 10 2017-09-12 19:11 hwC1D3
crw-rw---- 1 system audio 116, 13 2017-09-12 16:12 pcmC0D0c
crw-rw---- 1 system audio 116, 4 2017-09-12 19:11 pcmC0D0p
crw-rw---- 1 system audio 116, 15 2017-09-12 16:12 pcmC0D2c
crw-rw---- 1 system audio 116, 14 2017-09-12 16:12 pcmC0D3p
crw-rw---- 1 system audio 116, 3 2017-09-12 19:11 pcmC1D3p
crw-rw---- 1 system audio 116, 5 2017-09-12 19:11 pcmC1D8p
crw-rw---- 1 system audio 116, 6 2017-09-12 19:11 pcmC1D9p
crw-rw---- 1 system audio 116, 33 2017-09-12 19:11 timer

Kossuth

unread,
Sep 12, 2017, 3:33:00 PM9/12/17
to Android-x86
Ok, I did fresh reboot, and then went to the console with alt and left. I ran ls -l /dev/snd/ and checked that both cards were present. Then I removed the second cards pcm entries with rm /dev/snd/pcmC1* and the checked again the ls -l ans saw that the second card was missing. Then I typed stop, waited a while ans then start. The screen went blank and nothing happened. I couln't get console or home screen. I waited for a while the shut hte computer down by holding powerbutton down for 5 seconds. I tried again and same results. The I tried the same, but this time removed the first cards entries and checked that it was now missing. The stop and then start and blank screen again. Finally I rebooted and straight after getting to homescreen I directly went to console, typed only the rm command, then quickly stop and then start, and to my amazement I got back to home screen WITH AUDIO!!!!!

I'll have repeat the steps soon couple of times and try to figure out why it didn't work  the first couple of times, but at least I know it's doable. This kind of hack is enough for me, I think I can live with it, if I can somehow make semiautomatic with for example init.sh script or Tasker, but I'm willing to help more if you want to debug this more.

Chih-Wei Huang

unread,
Sep 13, 2017, 2:26:44 AM9/13/17
to Android-x86
Indeed you can modify /system/etc/init.sh,
(you have to install /system as read-write)
add a function like

post_init()
{
rm -f /dev/snd/pcmC1*
}

But I'm more interesting in the root cause and a proper fix.

If you can read C code, see the select_card() function
in about line 180-220:

https://osdn.net/projects/android-x86/scm/git/hardware-libaudio/blobs/oreo-x86/audio_hw.c

Basically it uses the standard function scandir()
to scan /dev/snd/

int n = scandir(path, &namelist, NULL, alphasort);

and the result should be put in the alpha order.
Therefore pcmC0D0p (if exists) should always
be the first one be chosen.
But seems it doesn't find pcmC0D0p at all
if the Geforce card presents.
This is very abnormal.
If you can build the code you can add
more debug messages to see what happens.

Kossuth

unread,
Sep 13, 2017, 7:20:53 AM9/13/17
to Android-x86
Ok, I can _read_ C code, but I suspect that I don't understand it much, let alone have the ability to build it (I don't have any Linux machines currently and have never had any experience buildin code for Linux). I still can have a look and try to understand what happens and when.

Is it possible that the select card function is run at such time that somehow the C0 is not accessibe/present, and comes around only later in time? What part of the system is responsible for cataloging the cards and presenting them to audio_hw.c. Could the problem be in the fact that the card C1 is located in PCI-EX bus and the C0 is in standard PCI bus (or something else as it is integrated in the motherboard)?

Kossuth

unread,
Nov 4, 2017, 12:22:14 PM11/4/17
to Android-x86
I installed the rc2 version of the Nougat, but I can't get the soundcard property to work with the improved audio_hw.c. If I use terminal to set the property "setprop hal.audio.out=pcmC0D3p or pcmC0D0p" the property does not stay over reboot. If I write it to build.prop, it stays over reboot, and I can read it with "getprop hal.audio.out", but it does not seem to have any effect on the operating system, as it stays mute. I can use the same trick as in rc1 to get the audio working, but I'd like know where should I put property setting (maybe to init.sh), so it gets set before the audio_hw.c reads the cards from /dev/snd/ ?

Ps. I could not get the zygote to restart properly on my system, so for now, I just rm the wrong card from /dev/snd and the kill the audioserver, which automatically restarts and then chooses the right card. That way I can manually choose the right card after boot.

Pps, is there a way to see in a running system, where the audio is currently routed, or is the debug booting and catlog grepping the only way?

Kossuth

unread,
Nov 16, 2017, 8:29:18 AM11/16/17
to Android-x86
Ok, I did some more testing

If I set the property so that I get it to stay over boot, it does not initialize the correct card at boot. But, if after the Android has booted to home I just kill the audioserver (without removing the wrong card), it then chooses the right card. From the logs I can see, that during boot the audio_hw.c is trying to use the property I set (pcmC0D0p), but it does not find the card. After boot, when killing the audioserver it uses the property again, and this time finds out the correct device from pcmC0D0p.

I cannot currently give exact pastes from cat.log as I can't seem to find the cat.log file in the rc2 version after debug booting and playstore cat.log readers seem a bit flaky in my system, so I cant get anything meaningful copied from them.

Is it possible that when the audio_hw.c is scanning the system during the boot, the pcmC0* devices are not there yet and therefor can't be accessed, but after boot they are there and can be found by the audio_hw.c?

Kossuth

unread,
Nov 16, 2017, 8:44:23 AM11/16/17
to Android-x86
Ok, found the log at /data/log.txt

These two lines appear during boot

11-16 15:06:12.401 2291 2291 I audio_hw_primary: using pcmC0D0p from property
11-16 15:06:12.401 2291 2291 W audio_hw_primary: Unable to find the mixer

And these appear after boot when I kill the audioserver

11-16 15:10:37.540 4758 4758 I audio_hw_primary: using pcmC0D0p from property
11-16 15:10:37.540 4758 4758 I audioserver: type=1400 audit(0.0:641): avc: denied { write } for name="pcmC0D0p" dev="tmpfs" ino=6767 scontext=u:r:init:s0 tcontext=u:object_r:audio_device:s0 tclass=chr_file permissive=1
11-16 15:10:37.698 4758 4758 D audio_hw_primary: found audio out at /dev/snd/pcmC0D0p
11-16 15:10:37.698 4758 4758 D audio_hw_primary: card: 0/0 id: ALC663 Analog
11-16 15:10:37.698 4758 4758 D audio_hw_primary: name: ALC663 Analog
11-16 15:10:37.698 4758 4758 D audio_hw_primary: subname: subdevice #0
11-16 15:10:37.698 4758 4758 D audio_hw_primary: stream: 0
11-16 15:10:37.698 4758 4758 I audio_hw_primary: choose pcmC0D0p for 0
11-16 15:10:37.698 4758 4758 E audio_hw_primary: Failed to open /system/etc/mixer_paths.xml
11-16 15:10:37.698 4758 4758 I AudioFlinger: loadHwModule() Loaded primary audio interface from Grouper audio HW HAL (audio) handle 10
11-16 15:10:37.698 4758 4758 I audio_hw_primary: choose pcmC0D0p for 0

Kossuth

unread,
Nov 16, 2017, 11:28:15 AM11/16/17
to Android-x86
Ok, now it is hacked so that it works automatically at boot. I also added

pkill audioserver

to the end of the init.sh just before return 0 line and now the correct card gets chosen after boot.

This is fine for me, but if anyone is interested in finding better solution, I'm willing to participate.

Chih-Wei Huang

unread,
Nov 16, 2017, 10:02:45 PM11/16/17
to Android-x86
2017-11-16 21:29 GMT+08:00 Kossuth <tomi.kos...@gmail.com>:
> Ok, I did some more testing
>
> If I set the property so that I get it to stay over boot, it does not
> initialize the correct card at boot. But, if after the Android has booted to
> home I just kill the audioserver (without removing the wrong card), it then
> chooses the right card. From the logs I can see, that during boot the
> audio_hw.c is trying to use the property I set (pcmC0D0p), but it does not
> find the card. After boot, when killing the audioserver it uses the property
> again, and this time finds out the correct device from pcmC0D0p.
>
> I cannot currently give exact pastes from cat.log as I can't seem to find
> the cat.log file in the rc2 version after debug booting and playstore
> cat.log readers seem a bit flaky in my system, so I cant get anything
> meaningful copied from them.
>
> Is it possible that when the audio_hw.c is scanning the system during the
> boot, the pcmC0* devices are not there yet and therefor can't be accessed,
> but after boot they are there and can be found by the audio_hw.c?

Yes, it seems so.
However, without deep analyzing how audio driver is initialized
it hard to say what happened.

Could you please get dmesg and lsmod?

Kossuth

unread,
Nov 17, 2017, 4:46:45 AM11/17/17
to Android-x86


On Friday, 17 November 2017 05:02:45 UTC+2, Chih-Wei Huang wrote:

Yes, it seems so.
However, without deep analyzing how audio driver is initialized
it hard to say what happened.

Could you please get dmesg and lsmod?

Do you mean that I boot with debug option from Grub menu and and find the dmesg log somewhere, and then run the lsmod command after boot? I found the bootlog from the /data/ directory, but I assumed it was the new cat.log. Where does the rc2 store the dmesg.log? Is it in /var/log/dmesg.log? Or should I try "dmesg > /dmesg.log" command?

Arts821

unread,
Jul 30, 2018, 12:35:45 AM7/30/18
to Android-x86
Use SoundAbout app from playstore, u can choose default sound output from speaker or hdmi, Bluetooth, and wifi too, it's like sound control from windows. I wish android-x86 can implement this feature
Reply all
Reply to author
Forward
0 new messages