Created
January 5, 2014 12:32
-
-
Save rjeczalik/8267666 to your computer and use it in GitHub Desktop.
load/unload AppleCameraInterface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
toggle-camera() { | |
if kextstat | grep AppleCameraInterface &>/dev/null; then | |
for ((i=0; i<3; i++)); do | |
if sudo kextunload /System/Library/Extensions/AppleCameraInterface.kext &>/dev/null; then | |
echo "toggle-camera: AppleCameraInterface unloaded" | |
return 0 | |
fi | |
done | |
echo "toggle-camera: failed to unload AppleCameraInterface" | |
else | |
if sudo kextload /System/Library/Extensions/AppleCameraInterface.kext &>/dev/null; then | |
echo "toggle-camera: AppleCameraInterface loaded" | |
return 0 | |
else | |
echo "toggle-camera: failed to load AppleCameraInterface" | |
fi | |
fi | |
return 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment