Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
make install
cd $temp_dir/bcwc_pcie
pwd
make
make install
rm -rf $temp_dir
if [ ! -d "/etc/modules-load.d" ]; then
mkdir -p "/etc/modules-load.d"
fi
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"
@ukn
Copy link
Author

ukn commented Jul 3, 2020

It works on my Macbook Pro 13" 2015 and Linux Mint 19.3 (kernel 5.4.0-40-generic)

@ba2sai
Copy link

ba2sai commented Jul 29, 2020

It worked like a charm on a MacBook Pro 2015 and Ubuntu 20.04.1 LTS. Thank you!

@TheLandzer
Copy link

TheLandzer commented Aug 6, 2020

hi i need help

Installing FacetimeHD camera for 5.7.11-200.fc32.x86_64
Clonando en 'facetimehd-firmware'...
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 886 (delta 0), reused 1 (delta 0), pack-reused 885
Recibiendo objetos: 100% (886/886), 290.76 KiB | 167.00 KiB/s, listo.
Resolviendo deltas: 100% (585/585), listo.
Clonando en 'bcwc_pcie'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 1101 (delta 11), reused 10 (delta 4), pack-reused 1083
Recibiendo objetos: 100% (1101/1101), 377.88 KiB | 658.00 KiB/s, listo.
Resolviendo deltas: 100% (738/738), listo.
/tmp/tmp.4btMwpOpIy/facetimehd-firmware

Checking dependencies for driver download...
/usr/bin/curl
/usr/bin/xzcat
/usr/bin/cpio

Downloading the driver, please wait...

Found matching hash from OS X, El Capitan 10.11.5
==> Extracting firmware...
--> Decompressing the firmware using gzip...
--> Deleting temporary files...
--> Extracted firmware version 1.43.0

Copying firmware into '//usr/lib/firmware/facetimehd'
install: no se pueden cambiar los permisos de «//usr/lib/firmware/facetimehd»: No existe el fichero o el directorio
make: *** [Makefile:46: install] Error 1

@ukn
Copy link
Author

ukn commented Aug 7, 2020

hi i need help
...
Copying firmware into '//usr/lib/firmware/facetimehd'
install: no se pueden cambiar los permisos de «//usr/lib/firmware/facetimehd»: No existe el fichero o el directorio
make: *** [Makefile:46: install] Error 1

If I understand correctly /usr/lib/firmware/facetimehd directory doesn't exist.
On my OS (Linux Mint 20) it's copied to /lib/firmware/facetimehd.

What Linux distro and version do you have?
Maybe try creating /usr/lib/firmware/facetimehd manually before running the script?

@jungx148
Copy link

jungx148 commented Sep 18, 2020

This script works great on a MacBook Air 2013 and Ubuntu 16.04 LTS.
Thank you very much.

@bczy
Copy link

bczy commented Oct 22, 2020

Works like a charm on a MacBook Air "Core i5-5350U CPU @ 1.80GHz × 4 " and Ubuntu 20.04.1 LTS
Thanks a lot!

@danielemoraschi
Copy link

danielemoraschi commented Nov 10, 2020

Working fine on a MacBook 13" 2015. Camera stop working after upgrading to Mint 20 (5.4.0-52-generic).

@IAmDarthMole
Copy link

IAmDarthMole commented Nov 21, 2020

hi i need help

Installing FacetimeHD camera for 5.7.11-200.fc32.x86_64
Clonando en 'facetimehd-firmware'...
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 886 (delta 0), reused 1 (delta 0), pack-reused 885
Recibiendo objetos: 100% (886/886), 290.76 KiB | 167.00 KiB/s, listo.
Resolviendo deltas: 100% (585/585), listo.
Clonando en 'bcwc_pcie'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 1101 (delta 11), reused 10 (delta 4), pack-reused 1083
Recibiendo objetos: 100% (1101/1101), 377.88 KiB | 658.00 KiB/s, listo.
Resolviendo deltas: 100% (738/738), listo.
/tmp/tmp.4btMwpOpIy/facetimehd-firmware

Checking dependencies for driver download...
/usr/bin/curl
/usr/bin/xzcat
/usr/bin/cpio

Downloading the driver, please wait...

Found matching hash from OS X, El Capitan 10.11.5
==> Extracting firmware...
--> Decompressing the firmware using gzip...
--> Deleting temporary files...
--> Extracted firmware version 1.43.0

Copying firmware into '//usr/lib/firmware/facetimehd'
install: no se pueden cambiar los permisos de «//usr/lib/firmware/facetimehd»: No existe el fichero o el directorio
make: *** [Makefile:46: install] Error 1

I'm not sure if you are still having the problem but I hit the same error and completed the below steps to make it work.

  1. I created a facetimehd folder in the firmware directory.
  2. I ran sudo chmod +x on the .sh file.
  3. I ran the .sh file via terminal with sudo ./
  4. I restarted my machine.

*There was still an error in the output but at the very end and everything else ran fine. I had to do the restart for the changes to take effect and it works.

Machine: Macbook Pro Retina, Early 2015, MX Linux 19.3

Hope this helps!

@kelvinq
Copy link

kelvinq commented Jan 24, 2022

This works perfectly. Thanks!

If you see a:

modprobe: FATAL: Module bdc_pci not found.

Don't worry. It just means that your system did not have this module to begin with and, as such, there is nothing to unload (ie the failed command tries to unload non-existent bdc_pci)! Continue to load your newly compiled facetimehd module anyway:

sudo modprobe facetimehd

Success! :)

@giggit75
Copy link

giggit75 commented Mar 22, 2022

Hello, when I try to install it, I got the error message
./99-install-facetime-camera.sh: line 12: git: command not found

Could someone please help.

Thx

@ukn
Copy link
Author

ukn commented Mar 22, 2022

Hello, when I try to install it, I got the error message ./99-install-facetime-camera.sh: line 12: git: command not found

Could someone please help.

Thx

@giggit75 looks like you don't have git installed.
Use your favorite search engine to find how to install it on your OS
If it's Ubuntu/Debian it'll be apt update && apt install git

@giggit75
Copy link

giggit75 commented Mar 23, 2022

@ukn
Hello,

thank you very much, worked finally. ;-*

@xichen-de
Copy link

xichen-de commented Jun 3, 2022

hi i need help
Installing FacetimeHD camera for 5.7.11-200.fc32.x86_64
Clonando en 'facetimehd-firmware'...
remote: Enumerating objects: 1, done.
remote: Counting objects: 100% (1/1), done.
remote: Total 886 (delta 0), reused 1 (delta 0), pack-reused 885
Recibiendo objetos: 100% (886/886), 290.76 KiB | 167.00 KiB/s, listo.
Resolviendo deltas: 100% (585/585), listo.
Clonando en 'bcwc_pcie'...
remote: Enumerating objects: 18, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (14/14), done.
remote: Total 1101 (delta 11), reused 10 (delta 4), pack-reused 1083
Recibiendo objetos: 100% (1101/1101), 377.88 KiB | 658.00 KiB/s, listo.
Resolviendo deltas: 100% (738/738), listo.
/tmp/tmp.4btMwpOpIy/facetimehd-firmware
Checking dependencies for driver download...
/usr/bin/curl
/usr/bin/xzcat
/usr/bin/cpio
Downloading the driver, please wait...
Found matching hash from OS X, El Capitan 10.11.5
==> Extracting firmware...
--> Decompressing the firmware using gzip...
--> Deleting temporary files...
--> Extracted firmware version 1.43.0
Copying firmware into '//usr/lib/firmware/facetimehd'
install: no se pueden cambiar los permisos de «//usr/lib/firmware/facetimehd»: No existe el fichero o el directorio
make: *** [Makefile:46: install] Error 1

I'm not sure if you are still having the problem but I hit the same error and completed the below steps to make it work.

  1. I created a facetimehd folder in the firmware directory.
  2. I ran sudo chmod +x on the .sh file.
  3. I ran the .sh file via terminal with sudo ./
  4. I restarted my machine.

*There was still an error in the output but at the very end and everything else ran fine. I had to do the restart for the changes to take effect and it works.

Machine: Macbook Pro Retina, Early 2015, MX Linux 19.3

Hope this helps!

This has saved my life.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment