Skip to content

Instantly share code, notes, and snippets.

@xyb
Forked from ukn/99-install-facetime-camera.sh
Last active May 5, 2024 20:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xyb/879f3bdf93cb5e8fc3d9d9675ae272cb to your computer and use it in GitHub Desktop.
Save xyb/879f3bdf93cb5e8fc3d9d9675ae272cb to your computer and use it in GitHub Desktop.
Install the kernal module required for the facetimehd camera to work on Linux
#!/bin/bash
set -e
export CONFIG_MODULE_SIG=n
export CONFIG_MODULE_SIG_ALL=n
# For current kernel
export KERNELRELEASE=$(cat /proc/version | awk '{print $3}')
temp_dir=$(mktemp -d)
echo "Installing FacetimeHD camera for $KERNELRELEASE"
cd $temp_dir
git clone https://github.com/patjak/facetimehd-firmware.git
git clone https://github.com/patjak/bcwc_pcie.git
cd $temp_dir/facetimehd-firmware
pwd
make
sudo make install
cd $temp_dir/bcwc_pcie
pwd
make
sudo make install
rm -rf $temp_dir
if [ ! -d "/etc/modules-load.d" ]; then
mkdir -p "/etc/modules-load.d"
fi
sudo bash -c 'cat > "/etc/modules-load.d/facetimehd.conf" << EOL
videobuf2-core
videobuf2_v4l2
videobuf2-dma-sg
facetimehd
EOL'
# Workaround for depmod being skipped above with error:
# Warning: modules_install: missing 'System.map' file. Skipping depmod
echo "Generate modules.dep and map files"
sudo depmod
echo "Adding kernel modules"
sudo modprobe -r bdc_pci
sudo modprobe facetimehd
echo "Install complete"
# Color calibration
# https://github.com/patjak/facetimehd/wiki/Extracting-the-sensor-calibration-files
sudo cp *.dat /lib/firmware/facetimehd/
sudo modprobe -r facetimehd
echo "Color calibration complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment