├── ALCPlugFix.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ ├── goodwin.xcuserdatad │ │ └── UserInterfaceState.xcuserstate │ │ └── sky.xcuserdatad │ │ └── UserInterfaceState.xcuserstate └── xcuserdata │ ├── goodwin.xcuserdatad │ └── xcschemes │ │ ├── ALCPlugFix.xcscheme │ │ └── xcschememanagement.plist │ └── sky.xcuserdatad │ └── xcschemes │ └── xcschememanagement.plist ├── ALCPlugFix ├── 1.plist └── main.m ├── Info.plist ├── README.md └── alc_fix ├── ALCPlugFix ├── good.win.ALCPlugFix.plist ├── hda-verb ├── install.command ├── install.sh ├── install双击自动卸载ALCPlugFix.command ├── install双击自动安装.command └── uninstall.command /ALCPlugFix.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 4CE328391DCA9A59002A53ED /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 4CE328381DCA9A59002A53ED /* main.m */; }; 11 | /* End PBXBuildFile section */ 12 | 13 | /* Begin PBXCopyFilesBuildPhase section */ 14 | 4CE328331DCA9A59002A53ED /* CopyFiles */ = { 15 | isa = PBXCopyFilesBuildPhase; 16 | buildActionMask = 2147483647; 17 | dstPath = /usr/share/man/man1/; 18 | dstSubfolderSpec = 0; 19 | files = ( 20 | ); 21 | runOnlyForDeploymentPostprocessing = 1; 22 | }; 23 | /* End PBXCopyFilesBuildPhase section */ 24 | 25 | /* Begin PBXFileReference section */ 26 | 4CE328351DCA9A59002A53ED /* ALCPlugFix */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ALCPlugFix; sourceTree = BUILT_PRODUCTS_DIR; }; 27 | 4CE328381DCA9A59002A53ED /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 28 | /* End PBXFileReference section */ 29 | 30 | /* Begin PBXFrameworksBuildPhase section */ 31 | 4CE328321DCA9A59002A53ED /* Frameworks */ = { 32 | isa = PBXFrameworksBuildPhase; 33 | buildActionMask = 2147483647; 34 | files = ( 35 | ); 36 | runOnlyForDeploymentPostprocessing = 0; 37 | }; 38 | /* End PBXFrameworksBuildPhase section */ 39 | 40 | /* Begin PBXGroup section */ 41 | 4CE3282C1DCA9A59002A53ED = { 42 | isa = PBXGroup; 43 | children = ( 44 | 4CE328371DCA9A59002A53ED /* ALCPlugFix */, 45 | 4CE328361DCA9A59002A53ED /* Products */, 46 | ); 47 | sourceTree = ""; 48 | }; 49 | 4CE328361DCA9A59002A53ED /* Products */ = { 50 | isa = PBXGroup; 51 | children = ( 52 | 4CE328351DCA9A59002A53ED /* ALCPlugFix */, 53 | ); 54 | name = Products; 55 | sourceTree = ""; 56 | }; 57 | 4CE328371DCA9A59002A53ED /* ALCPlugFix */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | 4CE328381DCA9A59002A53ED /* main.m */, 61 | ); 62 | path = ALCPlugFix; 63 | sourceTree = ""; 64 | }; 65 | /* End PBXGroup section */ 66 | 67 | /* Begin PBXNativeTarget section */ 68 | 4CE328341DCA9A59002A53ED /* ALCPlugFix */ = { 69 | isa = PBXNativeTarget; 70 | buildConfigurationList = 4CE3283C1DCA9A59002A53ED /* Build configuration list for PBXNativeTarget "ALCPlugFix" */; 71 | buildPhases = ( 72 | 4CE328311DCA9A59002A53ED /* Sources */, 73 | 4CE328321DCA9A59002A53ED /* Frameworks */, 74 | 4CE328331DCA9A59002A53ED /* CopyFiles */, 75 | ); 76 | buildRules = ( 77 | ); 78 | dependencies = ( 79 | ); 80 | name = ALCPlugFix; 81 | productName = ALCPlugFix; 82 | productReference = 4CE328351DCA9A59002A53ED /* ALCPlugFix */; 83 | productType = "com.apple.product-type.tool"; 84 | }; 85 | /* End PBXNativeTarget section */ 86 | 87 | /* Begin PBXProject section */ 88 | 4CE3282D1DCA9A59002A53ED /* Project object */ = { 89 | isa = PBXProject; 90 | attributes = { 91 | LastUpgradeCheck = 0810; 92 | ORGANIZATIONNAME = "Oleksandr Stoyevskyy"; 93 | TargetAttributes = { 94 | 4CE328341DCA9A59002A53ED = { 95 | CreatedOnToolsVersion = 8.1; 96 | ProvisioningStyle = Automatic; 97 | }; 98 | }; 99 | }; 100 | buildConfigurationList = 4CE328301DCA9A59002A53ED /* Build configuration list for PBXProject "ALCPlugFix" */; 101 | compatibilityVersion = "Xcode 3.2"; 102 | developmentRegion = English; 103 | hasScannedForEncodings = 0; 104 | knownRegions = ( 105 | en, 106 | ); 107 | mainGroup = 4CE3282C1DCA9A59002A53ED; 108 | productRefGroup = 4CE328361DCA9A59002A53ED /* Products */; 109 | projectDirPath = ""; 110 | projectRoot = ""; 111 | targets = ( 112 | 4CE328341DCA9A59002A53ED /* ALCPlugFix */, 113 | ); 114 | }; 115 | /* End PBXProject section */ 116 | 117 | /* Begin PBXSourcesBuildPhase section */ 118 | 4CE328311DCA9A59002A53ED /* Sources */ = { 119 | isa = PBXSourcesBuildPhase; 120 | buildActionMask = 2147483647; 121 | files = ( 122 | 4CE328391DCA9A59002A53ED /* main.m in Sources */, 123 | ); 124 | runOnlyForDeploymentPostprocessing = 0; 125 | }; 126 | /* End PBXSourcesBuildPhase section */ 127 | 128 | /* Begin XCBuildConfiguration section */ 129 | 4CE3283A1DCA9A59002A53ED /* Debug */ = { 130 | isa = XCBuildConfiguration; 131 | buildSettings = { 132 | ALWAYS_SEARCH_USER_PATHS = NO; 133 | CLANG_ANALYZER_NONNULL = YES; 134 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 135 | CLANG_CXX_LIBRARY = "libc++"; 136 | CLANG_ENABLE_MODULES = YES; 137 | CLANG_ENABLE_OBJC_ARC = YES; 138 | CLANG_WARN_BOOL_CONVERSION = YES; 139 | CLANG_WARN_CONSTANT_CONVERSION = YES; 140 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 141 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 142 | CLANG_WARN_EMPTY_BODY = YES; 143 | CLANG_WARN_ENUM_CONVERSION = YES; 144 | CLANG_WARN_INFINITE_RECURSION = YES; 145 | CLANG_WARN_INT_CONVERSION = YES; 146 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 147 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 148 | CLANG_WARN_UNREACHABLE_CODE = YES; 149 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 150 | CODE_SIGN_IDENTITY = "-"; 151 | COPY_PHASE_STRIP = NO; 152 | DEBUG_INFORMATION_FORMAT = dwarf; 153 | ENABLE_STRICT_OBJC_MSGSEND = YES; 154 | ENABLE_TESTABILITY = YES; 155 | GCC_C_LANGUAGE_STANDARD = gnu99; 156 | GCC_DYNAMIC_NO_PIC = NO; 157 | GCC_NO_COMMON_BLOCKS = YES; 158 | GCC_OPTIMIZATION_LEVEL = 0; 159 | GCC_PREPROCESSOR_DEFINITIONS = ( 160 | "DEBUG=1", 161 | "$(inherited)", 162 | ); 163 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 164 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 165 | GCC_WARN_UNDECLARED_SELECTOR = YES; 166 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 167 | GCC_WARN_UNUSED_FUNCTION = YES; 168 | GCC_WARN_UNUSED_VARIABLE = YES; 169 | MACOSX_DEPLOYMENT_TARGET = 10.11; 170 | MTL_ENABLE_DEBUG_INFO = YES; 171 | ONLY_ACTIVE_ARCH = YES; 172 | SDKROOT = macosx; 173 | }; 174 | name = Debug; 175 | }; 176 | 4CE3283B1DCA9A59002A53ED /* Release */ = { 177 | isa = XCBuildConfiguration; 178 | buildSettings = { 179 | ALWAYS_SEARCH_USER_PATHS = NO; 180 | CLANG_ANALYZER_NONNULL = YES; 181 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 182 | CLANG_CXX_LIBRARY = "libc++"; 183 | CLANG_ENABLE_MODULES = YES; 184 | CLANG_ENABLE_OBJC_ARC = YES; 185 | CLANG_WARN_BOOL_CONVERSION = YES; 186 | CLANG_WARN_CONSTANT_CONVERSION = YES; 187 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 188 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 189 | CLANG_WARN_EMPTY_BODY = YES; 190 | CLANG_WARN_ENUM_CONVERSION = YES; 191 | CLANG_WARN_INFINITE_RECURSION = YES; 192 | CLANG_WARN_INT_CONVERSION = YES; 193 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 194 | CLANG_WARN_SUSPICIOUS_MOVES = YES; 195 | CLANG_WARN_UNREACHABLE_CODE = YES; 196 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 197 | CODE_SIGN_IDENTITY = "-"; 198 | COPY_PHASE_STRIP = NO; 199 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 200 | ENABLE_NS_ASSERTIONS = NO; 201 | ENABLE_STRICT_OBJC_MSGSEND = YES; 202 | GCC_C_LANGUAGE_STANDARD = gnu99; 203 | GCC_NO_COMMON_BLOCKS = YES; 204 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 205 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 206 | GCC_WARN_UNDECLARED_SELECTOR = YES; 207 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 208 | GCC_WARN_UNUSED_FUNCTION = YES; 209 | GCC_WARN_UNUSED_VARIABLE = YES; 210 | MACOSX_DEPLOYMENT_TARGET = 10.11; 211 | MTL_ENABLE_DEBUG_INFO = NO; 212 | SDKROOT = macosx; 213 | }; 214 | name = Release; 215 | }; 216 | 4CE3283D1DCA9A59002A53ED /* Debug */ = { 217 | isa = XCBuildConfiguration; 218 | buildSettings = { 219 | PRODUCT_NAME = "$(TARGET_NAME)"; 220 | }; 221 | name = Debug; 222 | }; 223 | 4CE3283E1DCA9A59002A53ED /* Release */ = { 224 | isa = XCBuildConfiguration; 225 | buildSettings = { 226 | PRODUCT_NAME = "$(TARGET_NAME)"; 227 | }; 228 | name = Release; 229 | }; 230 | /* End XCBuildConfiguration section */ 231 | 232 | /* Begin XCConfigurationList section */ 233 | 4CE328301DCA9A59002A53ED /* Build configuration list for PBXProject "ALCPlugFix" */ = { 234 | isa = XCConfigurationList; 235 | buildConfigurations = ( 236 | 4CE3283A1DCA9A59002A53ED /* Debug */, 237 | 4CE3283B1DCA9A59002A53ED /* Release */, 238 | ); 239 | defaultConfigurationIsVisible = 0; 240 | defaultConfigurationName = Release; 241 | }; 242 | 4CE3283C1DCA9A59002A53ED /* Build configuration list for PBXNativeTarget "ALCPlugFix" */ = { 243 | isa = XCConfigurationList; 244 | buildConfigurations = ( 245 | 4CE3283D1DCA9A59002A53ED /* Debug */, 246 | 4CE3283E1DCA9A59002A53ED /* Release */, 247 | ); 248 | defaultConfigurationIsVisible = 0; 249 | }; 250 | /* End XCConfigurationList section */ 251 | }; 252 | rootObject = 4CE3282D1DCA9A59002A53ED /* Project object */; 253 | } 254 | -------------------------------------------------------------------------------- /ALCPlugFix.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /ALCPlugFix.xcodeproj/project.xcworkspace/xcuserdata/goodwin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daliansky/ALCPlugFix/4fe1ad043fd58ba16d24aeec335532dc45e9003e/ALCPlugFix.xcodeproj/project.xcworkspace/xcuserdata/goodwin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ALCPlugFix.xcodeproj/project.xcworkspace/xcuserdata/sky.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daliansky/ALCPlugFix/4fe1ad043fd58ba16d24aeec335532dc45e9003e/ALCPlugFix.xcodeproj/project.xcworkspace/xcuserdata/sky.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /ALCPlugFix.xcodeproj/xcuserdata/goodwin.xcuserdatad/xcschemes/ALCPlugFix.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 39 | 40 | 41 | 42 | 43 | 44 | 54 | 56 | 62 | 63 | 64 | 65 | 66 | 67 | 73 | 75 | 81 | 82 | 83 | 84 | 86 | 87 | 90 | 91 | 92 | -------------------------------------------------------------------------------- /ALCPlugFix.xcodeproj/xcuserdata/goodwin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ALCPlugFix.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 4CE328341DCA9A59002A53ED 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /ALCPlugFix.xcodeproj/xcuserdata/sky.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | ALCPlugFix.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /ALCPlugFix/1.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | KeepAlive 6 | 7 | Label 8 | good.win.ALCPlugFix 9 | ProgramArguments 10 | 11 | /Library/MyDaemon/Daemon/ 12 | 13 | RunAtLoad 14 | 15 | ServiceIPC 16 | 17 | /* 18 | StandardErrorPath 19 | /Library/Logs/MyDaemon.log 20 | StandardOutPath 21 | /Library/Logs/MyDaemon.log 22 | */ 23 | 24 | 25 | -------------------------------------------------------------------------------- /ALCPlugFix/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // ALCPlugFix 4 | // 5 | // Created by Oleksandr Stoyevskyy on 11/3/16. 6 | // Copyright © 2016 Oleksandr Stoyevskyy. All rights reserved. 7 | // 8 | 9 | #import 10 | #import 11 | #import 12 | 13 | @protocol DaemonProtocol 14 | - (void)performWork; 15 | @end 16 | 17 | @interface NSString (ShellExecution) 18 | - (NSString*)runAsCommand; 19 | @end 20 | 21 | @implementation NSString (ShellExecution) 22 | 23 | - (NSString*)runAsCommand { 24 | NSPipe* pipe = [NSPipe pipe]; 25 | 26 | NSTask* task = [[NSTask alloc] init]; 27 | [task setLaunchPath: @"/bin/sh"]; 28 | [task setArguments:@[@"-c", [NSString stringWithFormat:@"%@", self]]]; 29 | [task setStandardOutput:pipe]; 30 | 31 | NSFileHandle* file = [pipe fileHandleForReading]; 32 | [task launch]; 33 | 34 | return [[NSString alloc] initWithData:[file readDataToEndOfFile] encoding:NSUTF8StringEncoding]; 35 | } 36 | 37 | @end 38 | 39 | # pragma mark ALCPlugFix Object Conforms to Protocol 40 | 41 | @interface ALCPlugFix : NSObject 42 | @end; 43 | @implementation ALCPlugFix 44 | - (id)init 45 | { 46 | self = [super init]; 47 | if (self) { 48 | // Do here what you needs to be done to start things 49 | } 50 | return self; 51 | } 52 | 53 | 54 | - (void)dealloc 55 | { 56 | // Do here what needs to be done to shut things down 57 | //[super dealloc]; 58 | } 59 | 60 | - (void)performWork 61 | { 62 | // This method is called periodically to perform some routine work 63 | //NSLog(@"performing work ..."); 64 | } 65 | @end 66 | 67 | # pragma mark Setup the daemon 68 | 69 | // Seconds runloop runs before performing work 70 | #define kRunLoopWaitTime 30.0 71 | 72 | BOOL keepRunning = TRUE; 73 | 74 | void sigHandler(int signo) 75 | { 76 | NSLog(@"sigHandler: Received signal %d", signo); 77 | 78 | switch (signo) { 79 | case SIGTERM: keepRunning = FALSE; break; // SIGTERM means we must quit 80 | default: break; 81 | } 82 | } 83 | 84 | int main(int argc, const char * argv[]) { 85 | @autoreleasepool { 86 | NSLog(@"Headphones daemon running!"); 87 | 88 | signal(SIGHUP, sigHandler); 89 | signal(SIGTERM, sigHandler); 90 | 91 | ALCPlugFix *task = [[ALCPlugFix alloc] init]; 92 | 93 | AudioDeviceID defaultDevice = 0; 94 | UInt32 defaultSize = sizeof(AudioDeviceID); 95 | 96 | const AudioObjectPropertyAddress defaultAddr = { 97 | kAudioHardwarePropertyDefaultOutputDevice, 98 | kAudioObjectPropertyScopeGlobal, 99 | kAudioObjectPropertyElementMaster 100 | }; 101 | 102 | AudioObjectGetPropertyData(kAudioObjectSystemObject, &defaultAddr, 0, NULL, &defaultSize, &defaultDevice); 103 | 104 | AudioObjectPropertyAddress sourceAddr; 105 | sourceAddr.mSelector = kAudioDevicePropertyDataSource; 106 | sourceAddr.mScope = kAudioDevicePropertyScopeOutput; 107 | sourceAddr.mElement = kAudioObjectPropertyElementMaster; 108 | 109 | NSString *output1 = [@"hda-verb 0x12 SET_PIN_WIDGET_CONTROL 0x20" runAsCommand]; 110 | NSString *output2 = [@"hda-verb 0x19 SET_PIN_WIDGET_CONTROL 0x00" runAsCommand]; 111 | 112 | AudioObjectAddPropertyListenerBlock(defaultDevice, &sourceAddr, dispatch_get_global_queue (DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^(UInt32 inNumberAddresses, const AudioObjectPropertyAddress * inAddresses) { 113 | 114 | UInt32 bDataSourceId = 0; 115 | UInt32 bDataSourceIdSize = sizeof(UInt32); 116 | AudioObjectGetPropertyData(defaultDevice, inAddresses, 0, NULL, &bDataSourceIdSize, &bDataSourceId); 117 | if (bDataSourceId == 'ispk') { 118 | // 被认定为内置扬声器 119 | NSLog(@"Headphones removed! Fixing!"); 120 | NSString *output1 = [@"hda-verb 0x12 SET_PIN_WIDGET_CONTROL 0x20" runAsCommand]; 121 | NSString *output2 = [@"hda-verb 0x19 SET_PIN_WIDGET_CONTROL 0x00" runAsCommand]; 122 | } else if (bDataSourceId == 'hdpn') { 123 | // 被认定为耳机 124 | NSLog(@"Headphones inserted! Fixing!"); 125 | NSString *output1 = [@"hda-verb 0x12 SET_PIN_WIDGET_CONTROL 0x00" runAsCommand]; 126 | NSString *output2 = [@"hda-verb 0x19 SET_PIN_WIDGET_CONTROL 0x20" runAsCommand]; 127 | } 128 | }); 129 | 130 | while (keepRunning) { 131 | [task performWork]; 132 | CFRunLoopRunInMode(kCFRunLoopDefaultMode, kRunLoopWaitTime, false); 133 | } 134 | // [task release]; 135 | 136 | NSLog(@"Daemon exiting"); 137 | } 138 | return 0; 139 | } 140 | -------------------------------------------------------------------------------- /Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | KeepAlive 6 | 7 | Label 8 | good.win.ALCPlugFix 9 | ProgramArguments 10 | 11 | /Library/MyDaemon/Daemon/ 12 | 13 | RunAtLoad 14 | 15 | ServiceIPC 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ALCPlugFix 2 | ## ALCPlugFix能做什么? 3 | * 它可以解决耳机插拔状态的切换 4 | * 它是通过使用命令:`hda-verb 0xNode SET_PIN_WIDGET_CONTROL 0xVerbs`的方式进行状态切换 5 | * `hda-verb`的由来 6 | * `hda-verb`是linux下面的`alsa-project`的一条命令,它的作用是发送HD-audio命令 7 | 8 | ## 如何使用? 9 | * 将`ALCPlugFix`同步到本地 10 | 11 | ```sh 12 | git clone https://github.com/daliansky/ALCPlugFix 13 | ``` 14 | 15 | * 打开`ALCPlugFix`目录下面的`main.m`,将包含`hda-verb`语句的几行修改成如图所示 16 | ![ALCPlugFix_ALC256](http://7.daliansky.net/ALCPlugFix_ALC256.png) 17 | 18 | 19 | * 其中`0x12`是`Mic Int`节点,`0x19`是`Mic Ext`节点,之所以要这么修改,是因为我的`ALC256`的`0x19`节点总是无法工作,在插入耳机的时候我希望内置的`Mic Int`可以工作的同时还可以使用耳机. 20 | * 将`XCODE`编译生成的`ALCPlugFix`文件复制到`alc_fix`目录,然后双击`install双击自动安装.command`,输入用户密码即可. 21 | * 更多的用法可以进QQ群讨论 22 | * 331686786 [一起黑苹果](http://shang.qq.com/wpa/qunwpa?idkey=db511a29e856f37cbb871108ffa77a6e79dde47e491b8f2c8d8fe4d3c310de91) 23 | 24 | # 鸣谢 25 | [goodwin](https://github.com/goodwin/ALCPlugFix) ALCPlugFix大本营 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /alc_fix/ALCPlugFix: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daliansky/ALCPlugFix/4fe1ad043fd58ba16d24aeec335532dc45e9003e/alc_fix/ALCPlugFix -------------------------------------------------------------------------------- /alc_fix/good.win.ALCPlugFix.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | KeepAlive 6 | 7 | Label 8 | good.win.ALCPlugFix 9 | ProgramArguments 10 | 11 | /usr/bin/ALCPlugFix 12 | 13 | RunAtLoad 14 | 15 | ServiceIPC 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /alc_fix/hda-verb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/daliansky/ALCPlugFix/4fe1ad043fd58ba16d24aeec335532dc45e9003e/alc_fix/hda-verb -------------------------------------------------------------------------------- /alc_fix/install.command: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | path=${0%/*} 5 | sudo cp -a "$path/ALCPlugFix" /usr/bin 6 | sudo chmod 755 /usr/bin/ALCPlugFix 7 | sudo chown root:wheel /usr/bin/ALCPlugFix 8 | sudo cp -a "$path/hda-verb" /usr/bin 9 | sudo chmod 755 /usr/bin/hda-verb 10 | sudo chown root:wheel /usr/bin/hda-verb 11 | sudo cp -a "$path/good.win.ALCPlugFix.plist" /Library/LaunchAgents/ 12 | sudo chmod 644 /Library/LaunchAgents/good.win.ALCPlugFix.plist 13 | sudo chown root:wheel /Library/LaunchAgents/good.win.ALCPlugFix.plist 14 | sudo launchctl load /Library/LaunchAgents/good.win.ALCPlugFix.plist 15 | echo 'The installation of the ALCPlugFix daemon is complete' 16 | echo 'Rebuild kextcache, please wait...' 17 | sudo chmod -Rf 755 /S*/L*/E* 18 | sudo chown -Rf 0:0 /S*/L*/E* 19 | sudo chmod -Rf 755 /L*/E* 20 | sudo chown -Rf 0:0 /L*/E* 21 | sudo rm -Rf /S*/L*/PrelinkedKernels/* 22 | sudo rm -Rf /S*/L*/Caches/com.apple.kext.caches/* 23 | sudo touch -f /S*/L*/E* 24 | sudo touch -f /L*/E* 25 | sudo kextcache -Boot -U / 26 | echo 'Rebuild kextcache is complete' 27 | bash read -p 'Press any key to Exit' -------------------------------------------------------------------------------- /alc_fix/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | sudo cp ALCPlugFix /usr/bin 4 | sudo chmod 755 /usr/bin/ALCPlugFix 5 | sudo chown root:wheel /usr/bin/ALCPlugFix 6 | sudo cp hda-verb /usr/bin 7 | sudo chmod 755 /usr/bin/hda-verb 8 | sudo chown root:wheel /usr/bin/hda-verb 9 | sudo cp good.win.ALCPlugFix.plist /Library/LaunchAgents/ 10 | sudo chmod 644 /Library/LaunchAgents/good.win.ALCPlugFix.plist 11 | sudo chown root:wheel /Library/LaunchAgents/good.win.ALCPlugFix.plist 12 | sudo launchctl load /Library/LaunchAgents/good.win.ALCPlugFix.plist 13 | 14 | exit 0 15 | -------------------------------------------------------------------------------- /alc_fix/install双击自动卸载ALCPlugFix.command: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | path=${0%/*} 5 | sudo launchctl remove /Library/LaunchAgents/good.win.ALCPlugFix.plist 6 | sudo rm -rf /Library/LaunchAgents/good.win.ALCPlugFix.plist 7 | sudo rm -rf /usr/bin/ALCPlugFix 8 | 9 | echo '重建缓存中,请稍候……' 10 | sudo chmod -Rf 755 /S*/L*/E* 11 | sudo chown -Rf 0:0 /S*/L*/E* 12 | sudo chmod -Rf 755 /L*/E* 13 | sudo chown -Rf 0:0 /L*/E* 14 | sudo rm -Rf /S*/L*/PrelinkedKernels/* 15 | sudo rm -Rf /S*/L*/Caches/com.apple.kext.caches/* 16 | sudo touch -f /S*/L*/E* 17 | sudo touch -f /L*/E* 18 | sudo kextcache -Boot -U / 19 | echo '卸载ALCPlugFix守护进程完成!' 20 | bash read -p '按任何键退出' -------------------------------------------------------------------------------- /alc_fix/install双击自动安装.command: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | path=${0%/*} 5 | sudo cp -a "$path/ALCPlugFix" /usr/bin 6 | sudo chmod 755 /usr/bin/ALCPlugFix 7 | sudo chown root:wheel /usr/bin/ALCPlugFix 8 | sudo cp -a "$path/hda-verb" /usr/bin 9 | sudo chmod 755 /usr/bin/hda-verb 10 | sudo chown root:wheel /usr/bin/hda-verb 11 | sudo cp -a "$path/good.win.ALCPlugFix.plist" /Library/LaunchAgents/ 12 | sudo chmod 644 /Library/LaunchAgents/good.win.ALCPlugFix.plist 13 | sudo chown root:wheel /Library/LaunchAgents/good.win.ALCPlugFix.plist 14 | sudo launchctl load /Library/LaunchAgents/good.win.ALCPlugFix.plist 15 | echo '正在重建缓存中,请稍候......' 16 | sudo chmod -Rf 755 /S*/L*/E* 17 | sudo chown -Rf 0:0 /S*/L*/E* 18 | sudo chmod -Rf 755 /L*/E* 19 | sudo chown -Rf 0:0 /L*/E* 20 | sudo rm -Rf /S*/L*/PrelinkedKernels/* 21 | sudo rm -Rf /S*/L*/Caches/com.apple.kext.caches/* 22 | sudo touch -f /S*/L*/E* 23 | sudo touch -f /L*/E* 24 | sudo kextcache -Boot -U / 25 | echo '重建缓存完毕!' 26 | echo '安装ALCPlugFix守护进程完成!' 27 | bash read -p '按任何键退出' -------------------------------------------------------------------------------- /alc_fix/uninstall.command: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | 4 | path=${0%/*} 5 | sudo launchctl remove /Library/LaunchAgents/good.win.ALCPlugFix.plist 6 | sudo rm -rf /Library/LaunchAgents/good.win.ALCPlugFix.plist 7 | sudo rm -rf /usr/bin/ALCPlugFix 8 | 9 | echo 'Rebuilding Kext Cache,please wait……' 10 | sudo chmod -Rf 755 /S*/L*/E* 11 | sudo chown -Rf 0:0 /S*/L*/E* 12 | sudo chmod -Rf 755 /L*/E* 13 | sudo chown -Rf 0:0 /L*/E* 14 | sudo rm -Rf /S*/L*/PrelinkedKernels/* 15 | sudo rm -Rf /S*/L*/Caches/com.apple.kext.caches/* 16 | sudo touch -f /S*/L*/E* 17 | sudo touch -f /L*/E* 18 | sudo kextcache -Boot -U / 19 | echo 'Uninstall the ALCPlugFix daemon complete!' 20 | bash read -p 'Press any key to exit' --------------------------------------------------------------------------------