Contribute
Register

No OnBoard Audio After Wake From Sleep?

Status
Not open for further replies.

shilohh

Moderator
Joined
Jan 1, 2012
Messages
1,752
Motherboard
Asus Prime Z490-A
CPU
i9-10850K
Graphics
RX 5700 XT
Mac
  1. MacBook Pro
  2. Mac Pro
Mobile Phone
  1. Android
Here is a workaround app I made for you to use until the real problem gets solved by someone smarter than me. It's a applescript app that unloads and reloads the AppleHDA.kext via shell script.

Also see toleda's post
 

Attachments

  • LoadHDA.app.zip
    39.7 KB · Views: 2,641
Last edited:
Is there a way to prevent this app from asking for a password every time you launch it?
 
Is there a way to prevent this app from asking for a password every time you launch it?
You could possibly edit the app's source AppleScript and hard-code your admin username and pw. I haven't looked into that.
Not sure if it will work but you can try replacing the main scripts content with this:
Code:
[FONT=Verdana][B]property[/B] [COLOR=#4f8f00]userpassword[/COLOR] : ""[/FONT]
[FONT=Verdana][B]set[/B] [COLOR=#4f8f00]theFinderPID[/COLOR] [B]to[/B] [COLOR=#012fbe][B]do shell script[/B][/COLOR] "ps -axww | /usr/bin/grep '[/]Finder'| awk '{print $1}' | head -1"[/FONT]
[COLOR=#012FBE][FONT=Verdana][B]do shell script[/B][COLOR=#000000] "renice 1 " & [/COLOR][COLOR=#4f8f00]theFinderPID[/COLOR][COLOR=#5730be]password[/COLOR][COLOR=#4f8f00]userpassword[/COLOR][COLOR=#000000] [B]with[/B] [/COLOR]administrator privileges[/FONT][/COLOR]
[COLOR=#012FBE][FONT=Verdana][B]do shell script[/B][COLOR=#000000] "renice 0 " & [/COLOR][COLOR=#4f8f00]theFinderPID[/COLOR][COLOR=#5730be]password[/COLOR][COLOR=#4f8f00]userpassword[/COLOR][COLOR=#000000] [B]with[/B] [/COLOR]administrator privileges[/FONT][/COLOR]
[FONT=Verdana][COLOR=#012fbe][B]do shell script[/B][/COLOR] "sudo kextunload /System/Library/Extensions/AppleHDA.kext[/FONT]
[FONT=Verdana]sudo kextload /System/Library/Extensions/AppleHDA.kext && sudo kextload /System/Library/Extensions/AppleHDA.kext" [B]with[/B] [COLOR=#012fbe]administrator privileges[/COLOR][/FONT]
In the top line put your case sensitive password between the quotation marks. IE:
Code:
[B]property[/B][COLOR=#4F8F00][FONT=Verdana]userpassword[/FONT][/COLOR][FONT=Verdana] : "YourPassword"[/FONT]
 
nice work! Haven't tested yet...
 
So I am trying to rebuild this in Automator and cannot seem to get it working. This is considered running a shell script right?
 
ACTUALLY I think I may have a near-perfect solution. It requires a bit of setup, but should work noiselessly in the background forever after. (Full disclosure: I haven't tested this on my Hackintosh yet. However, it's based entirely on a working setup I have for something else.) EDIT: Works exactly as expected on my Hackintosh. Machine wakes from sleep, sound doesn't work for a second or two, sound starts working again. No password input needed.

What we're going to do is turn shilohh's AppleScript code (which is just a wrapper for some BASH commands anyway) into a BASH script, then make a launch daemon that runs this script every time the machine wakes.

The script is very simple: create /Library/Scripts/HDAreload.sh (or whatever you would like to call it) with this code:
Code:
#!/bin/bash
[FONT=Verdana]kextunload /System/Library/Extensions/AppleHDA.kext
kextload /System/Library/Extensions/AppleHDA.kext
kextload /System/Library/Extensions/AppleHDA.kext    # not sure why this is here twice, but  that's how it was in the original. Maybe a pause is needed instead?[/FONT][FONT=Verdana]
[/FONT]exit 0

Now we need to set up the daemon. This is accomplished with a separate function, Bernhard Baehr's sleepwatcher. Download from his website and install as described in the readme. (He wants you to install to /usr/local/sbin, but I just put it in /usr/bin like I usually do. Not sure if that's best-practice or not.) Now create the file /System/Library/LaunchDaemons/de.bernhard-baehr.sleepwatcher.plist as follows:

Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>de.bernhard-baehr.sleepwatcher</string>
    <key>ProgramArguments</key>
    <array>
        <string>/usr/local/sbin/sleepwatcher</string> <!-- path to exec -->
        <string>-w /Scripts/Library/HDAreload.sh</string> <!-- your script path -->
    </array>
    <key>RunAtLoad</key>
    <true/>
    <key>KeepAlive</key>
    <true/>
    <key>UserName</key>
    <string>root</string>  <!-- allows file to run w/o needing admin pw -->
</dict>
</plist>

Almost done—just run
Code:
sudo launchctl load -wF /System/Library/LaunchDaemons/de.bernhard-baehr.sleepwatcher.plist
in Terminal and you should be good!
 
ACTUALLY I think I may have a near-perfect solution. It requires a bit of setup, but should work noiselessly in the background forever after. (Full disclosure: I haven't tested this on my Hackintosh yet. However, it's based entirely on a working setup I have for something else.) EDIT: Works exactly as expected on my Hackintosh. Machine wakes from sleep, sound doesn't work for a second or two, sound starts working again. No password input needed.
I think you nailed it, of course AppleHDA from MB 6.1.0 (from 10.9.1 or something) is also working.
 
I think you nailed it, of course AppleHDA from MB 6.1.0 (from 10.9.1 or something) is also working.
Is that working for you in yosemite?
 
Status
Not open for further replies.
Back
Top