Skip to content

Instantly share code, notes, and snippets.

@rjeczalik
Created January 5, 2014 12:32
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rjeczalik/8267666 to your computer and use it in GitHub Desktop.
Save rjeczalik/8267666 to your computer and use it in GitHub Desktop.
load/unload AppleCameraInterface
#!/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