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,620
Last edited:
Joined
Mar 17, 2014
Messages
103
Motherboard
Gigabyte Z87X-UH5D
CPU
i7
Graphics
Geforce 1050ti
Mobile Phone
  1. Android
Is there a way to prevent this app from asking for a password every time you launch it?
 

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
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]
 
Joined
Feb 25, 2011
Messages
155
Motherboard
GA-Z68MA-D2H-B3
CPU
2500k
Graphics
nvidia gtx 960
Mac
Classic Mac
Mobile Phone
nice work! Haven't tested yet...
 
Joined
Mar 17, 2014
Messages
103
Motherboard
Gigabyte Z87X-UH5D
CPU
i7
Graphics
Geforce 1050ti
Mobile Phone
  1. Android
So I am trying to rebuild this in Automator and cannot seem to get it working. This is considered running a shell script right?
 
Joined
Oct 1, 2014
Messages
85
Motherboard
Asus Maxmius VIII Gene
CPU
i7-6700k
Graphics
Zotac GTX 980 Ti
Mac
  1. MacBook Pro
Classic Mac
  1. iMac
  2. PowerBook
Mobile Phone
  1. iOS
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!
 
Joined
Aug 12, 2011
Messages
354
Motherboard
Probook 4440:4540
CPU
i3-3110M
Graphics
HD4000
Mac
  1. iMac
  2. MacBook Pro
  3. Mac mini
Classic Mac
Mobile Phone
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.
 

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
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.
Top