I would like to share with you how I solved this with a permanent solution without scripts. This way we can also get rid of the ugly pop sound when pulseaudio starts.
I use Apple MacBook 7,1 Mid 2010, White Unibody.
The reason why the red light lights up on every pulseaudio start is that there is automatic detection of hardware defined in /etc/pulse/default.pa
The usual default.pa example here: https://gist.github.com/95406ea115dc3a0a561f8242e2ae00f4
### Automatically load driver modules depending on the hardware available
.ifexists module-udev-detect.so
load-module module-udev-detect
.else
### Use the static hardware detection module (for systems that lack udev support)
load-module module-detect
.endif
When these modules are being loaded it automatically detects your hardware and also initializes it. While the hardware is being initialized then SPDI/F output is turned on so red light is glowing even if you previously toggled mute using alsamixser off. When SPDI/F are toggled again on then there is also the ugly pop sound effect.
To avoid this behavior I decided to define my hardware manually.
I don't wan't use automatic hardware detection modules. I disabled them by commenting whole block:
### Automatically load driver modules depending on the hardware available
#.ifexists module-udev-detect.so
#load-module module-udev-detect
#.else
### Use the static hardware detection module (for systems that lack udev support)
#load-module module-detect
#.endif
Now, I need to define my audio hardware - output sink and input source.
I have used module-alsa-sink and module-alsa-source. I also need to know which HW ID's my audio sources have. On my machine there is only one integrated audio card with both input/output which has id hw:0,0. It can be different on your machine.
This is how I load outpit sink and input source modules:
### Load audio drivers statically
load-module module-alsa-sink device=hw:0,0
load-module module-alsa-source device=hw:0,0
#load-module module-null-sink
#load-module module-pipe-sink
It's important to reload pulseaudio then.
You can use: pulseaudio --vv --kill and then again start it with
pulseaudio --vv --start
No we will have available both our audio input/output, the jack isn't glowing with the red and the pop sound on startup is gone. All changes made in alsamixer will always persist too.
But, with this simple configurations we can't now use SPDI/F as regular output.
What if decide to play sound through it?
I can even define the SPDI/F output too. The SPDI/F has hw0,1 ID on machine. If I would like to use it again. I will add this line to my configuration:
### Load audio drivers statically
load-module module-alsa-sink device=hw:0,0
load-module module-alsa-sink device=hw:0,1
load-module module-alsa-source device=hw:0,0
#load-module module-null-sink
#load-module module-pipe-sink
With this configuration we can easily disable and enable it in alsamixer. And the configuration will persist.
Here is sample of my configuration I use: https://gist.github.com/7a11adf0edc49d55a60be071ca307784
Actually, I don't own any other kind of sound system so I'm not able to test it with it. If you are using 2.1 or 4.1 sound system the output will be probably played only as stereo and you will need add more configurations in order to get it properly work. The same problem could be with HDMI outpout, I can't test it.
I'm kind of a newb at this stuff, so I'll have to read up on how to make the script for init.d.
I'm basically trying to get it to run the equivalent of
sudo alsactl restore
upon startup.Just not proficient enough yet in Linux to understand everything that needs to be contained in a proper script.
– Ski May 27 '16 at 03:19#!/bin/bash
followed byalsactl restore
two spaces below it. After making this script, I made it executable with thechmod 755 Redlight-Kill
command. I then moved this executable file to '/etc/init.d' and made a symbolic link to the '/etc/rc2.d' directory and named it "S07Kill-Redlight". Before this existed there, the last symbolic link in this directory was "S06rc.local". – Ski Jun 23 '16 at 01:46update-rc.d -n Kill-Redlight enable 2
it returnsinsserv: warning: script 'S07Kill-Redlight' missing LSB tags and overrides
followed byinsserv: warning: script 'Kill-Redlight' missing LSB tags and overrides
. What composition do I need to do in order to fulfill the LSB tags? Is this a recent change to simply having a script say#!/bin/bash
at the top of it? The only script I think I've wrote prior to this was a "Hello, world." one once upon a time. Any help in composing this simple command to meet the format requirements would be greatly appreciated. – Ski Jun 23 '16 at 01:53