From afa5789e28d53b7d6281cc756bc78b8ed38d530a Mon Sep 17 00:00:00 2001 From: Isaac Date: Thu, 16 Apr 2020 14:56:06 +0800 Subject: [PATCH 01/11] Fixed builds on 5.6 --- fthd_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fthd_drv.c b/fthd_drv.c index 2255d30..32e9512 100644 --- a/fthd_drv.c +++ b/fthd_drv.c @@ -70,19 +70,19 @@ static int fthd_pci_reserve_mem(struct fthd_private *dev_priv) /* S2 IO */ start = pci_resource_start(dev_priv->pdev, FTHD_PCI_S2_IO); len = pci_resource_len(dev_priv->pdev, FTHD_PCI_S2_IO); - dev_priv->s2_io = ioremap_nocache(start, len); + dev_priv->s2_io = ioremap_cache(start, len); dev_priv->s2_io_len = len; /* S2 MEM */ start = pci_resource_start(dev_priv->pdev, FTHD_PCI_S2_MEM); len = pci_resource_len(dev_priv->pdev, FTHD_PCI_S2_MEM); - dev_priv->s2_mem = ioremap_nocache(start, len); + dev_priv->s2_mem = ioremap_cache(start, len); dev_priv->s2_mem_len = len; /* ISP IO */ start = pci_resource_start(dev_priv->pdev, FTHD_PCI_ISP_IO); len = pci_resource_len(dev_priv->pdev, FTHD_PCI_ISP_IO); - dev_priv->isp_io = ioremap_nocache(start, len); + dev_priv->isp_io = ioremap_cache(start, len); dev_priv->isp_io_len = len; pr_debug("Allocated S2 regs (BAR %d). %u bytes at 0x%p\n", From c182db5408218dbe9f83efc04670fd82711c7389 Mon Sep 17 00:00:00 2001 From: Isaac Date: Thu, 16 Apr 2020 14:57:47 +0800 Subject: [PATCH 02/11] Fix builds on 5.7rc1; credit to https://github.com/umlaeute/v4l2loopback/commit/4815caf32e5dceb0a0cad02d9522d0a44d1defd6 --- fthd_v4l2.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fthd_v4l2.c b/fthd_v4l2.c index 6e6b768..5e697c4 100644 --- a/fthd_v4l2.c +++ b/fthd_v4l2.c @@ -41,6 +41,10 @@ #define FTHD_MIN_HEIGHT 240 #define FTHD_NUM_FORMATS 2 /* NV16 is disabled for now */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 7, 0) +# define VFL_TYPE_VIDEO VFL_TYPE_GRABBER +#endif + static int fthd_buffer_queue_setup( struct vb2_queue *vq, #if LINUX_VERSION_CODE < KERNEL_VERSION(4,4,0) @@ -735,7 +739,7 @@ int fthd_v4l2_register(struct fthd_private *dev_priv) V4L2_CAP_STREAMING; #endif video_set_drvdata(vdev, dev_priv); - ret = video_register_device(vdev, VFL_TYPE_GRABBER, -1); + ret = video_register_device(vdev, VFL_TYPE_VIDEO, -1); if (ret) { video_device_release(vdev); goto fail_vdev; From 2240b500c61563fe7310f6c4ce34537fa5c5ca65 Mon Sep 17 00:00:00 2001 From: Isaac Date: Fri, 5 Jun 2020 13:29:03 +0800 Subject: [PATCH 03/11] This now only includes the 5.7 fix --- fthd_drv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fthd_drv.c b/fthd_drv.c index 32e9512..2255d30 100644 --- a/fthd_drv.c +++ b/fthd_drv.c @@ -70,19 +70,19 @@ static int fthd_pci_reserve_mem(struct fthd_private *dev_priv) /* S2 IO */ start = pci_resource_start(dev_priv->pdev, FTHD_PCI_S2_IO); len = pci_resource_len(dev_priv->pdev, FTHD_PCI_S2_IO); - dev_priv->s2_io = ioremap_cache(start, len); + dev_priv->s2_io = ioremap_nocache(start, len); dev_priv->s2_io_len = len; /* S2 MEM */ start = pci_resource_start(dev_priv->pdev, FTHD_PCI_S2_MEM); len = pci_resource_len(dev_priv->pdev, FTHD_PCI_S2_MEM); - dev_priv->s2_mem = ioremap_cache(start, len); + dev_priv->s2_mem = ioremap_nocache(start, len); dev_priv->s2_mem_len = len; /* ISP IO */ start = pci_resource_start(dev_priv->pdev, FTHD_PCI_ISP_IO); len = pci_resource_len(dev_priv->pdev, FTHD_PCI_ISP_IO); - dev_priv->isp_io = ioremap_cache(start, len); + dev_priv->isp_io = ioremap_nocache(start, len); dev_priv->isp_io_len = len; pr_debug("Allocated S2 regs (BAR %d). %u bytes at 0x%p\n", From 02c92b62fb0d00200abf49164ce0d82256bd2575 Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 10 Jun 2020 14:02:41 +0800 Subject: [PATCH 04/11] Add a nice buid script for people who don't use Arch For those who do, you are _strongly_ encouraged to use the AUR instead. --- build.sh | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 build.sh diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..103d176 --- /dev/null +++ b/build.sh @@ -0,0 +1,43 @@ +#! /bin/bash +# Some inspiration from the AUR pkgbuild + +if [ ! whoami = root ]; then + echo 'You must be root to run this script.' + exit 13 +fi + +pkgname=bcwc-pcie +pkgver=r245.82626d4 +url="https://github.com/patjak/bcwc_pcie" +fwurl="https://github.com/patjak/facetimehd-firmware" +fwname=facetimehd-firmware +srcdir=src + +rm -rf ${srcdir} + +mkdir $srcdir + +if [ ! -f /usr/lib/firmware/facetimehd/firmware.bin ]; then + echo 'WARNING: Requires facetimehd-firmware, but it was not found. Installing it for you...' + (cd src; git clone $fwurl $fwname) + pushd ${srcdir}/${fwname} > /dev/null + make + mkdir /usr/lib/firmware/facetimehd/ + install -Dm 644 firmware.bin /usr/lib/firmware/facetimehd/firmware.bin + popd > /dev/null +fi + +(cd $srcdir; git clone $url $pkgname) + +pushd $srcdir/$pkgname/ > /dev/null +for FILE in dkms.conf Makefile *.[ch]; do + install -Dm 644 "$FILE" "/usr/src/${pkgname}-${pkgver}/$FILE" +done +popd > /dev/null + +echo 'Creating modprobe config files' +echo 'facetimehd' > /etc/modules-load.d/bcwc-pcie.conf +echo 'blacklist bdc_pci' > /etc/modprobe.d/bcwc-pcie.conf + +echo 'DKMS install for current kernel' +dkms add $pkgname -v $pkgver; dkms install $pkgname -v $pkgver From ff4a20187e93d7cacdab4bd0e2d7a9817482fe92 Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 10 Jun 2020 14:05:57 +0800 Subject: [PATCH 05/11] README says to use the script --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index f1d6970..1b8ad95 100644 --- a/README.md +++ b/README.md @@ -9,3 +9,8 @@ This driver is experimental. Use at your own risk. See the [Wiki][wiki] for more information: [wiki]: https://github.com/patjak/bcwc_pcie/wiki + +## Install: +If you use arch, install from the AUR +If not, run build.sh as root: +`sudo ./build.sh` From 26c23d243e23493d99ea9259be362facb05fd476 Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 10 Jun 2020 14:07:34 +0800 Subject: [PATCH 06/11] Oops --- README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/README.md b/README.md index 1b8ad95..bcb76de 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,5 @@ See the [Wiki][wiki] for more information: [wiki]: https://github.com/patjak/bcwc_pcie/wiki ## Install: -If you use arch, install from the AUR -If not, run build.sh as root: +If you use arch, install from the AUR. If not, run build.sh as root: `sudo ./build.sh` From cacdf5ed57a3e6b4257e4f65ab3e4558b292e1cc Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 10 Jun 2020 14:10:35 +0800 Subject: [PATCH 07/11] Call it install.sh instead of build.sh --- README.md | 4 ++-- build.sh => install.sh | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename build.sh => install.sh (100%) diff --git a/README.md b/README.md index bcb76de..6b5a7ff 100644 --- a/README.md +++ b/README.md @@ -11,5 +11,5 @@ See the [Wiki][wiki] for more information: [wiki]: https://github.com/patjak/bcwc_pcie/wiki ## Install: -If you use arch, install from the AUR. If not, run build.sh as root: -`sudo ./build.sh` +If you use arch, install from the AUR. If not, run install.sh as root: +`sudo ./install.sh` diff --git a/build.sh b/install.sh similarity index 100% rename from build.sh rename to install.sh From 6a66a9c195d8d0d41d9b4a16438416dd5780603c Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 10 Jun 2020 14:20:50 +0800 Subject: [PATCH 08/11] Ignore src/ --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 99a46ca..f624a38 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ description-pak doc-pak *.deb *.tgz +src From 86f1be7a2cd376d353a344e15ea7d4291b4bbf9b Mon Sep 17 00:00:00 2001 From: Isaac Date: Wed, 10 Jun 2020 14:20:59 +0800 Subject: [PATCH 09/11] $(whoami) != whoami --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 103d176..75afe57 100755 --- a/install.sh +++ b/install.sh @@ -1,7 +1,7 @@ #! /bin/bash # Some inspiration from the AUR pkgbuild -if [ ! whoami = root ]; then +if [ ! $(whoami) = root ]; then echo 'You must be root to run this script.' exit 13 fi From 66a7bf14cd3729b3fe37c0320b2a8ccc933caad1 Mon Sep 17 00:00:00 2001 From: Isaac Date: Sun, 14 Jun 2020 19:29:15 +0800 Subject: [PATCH 10/11] Version is git --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 75afe57..00c777b 100755 --- a/install.sh +++ b/install.sh @@ -7,7 +7,7 @@ if [ ! $(whoami) = root ]; then fi pkgname=bcwc-pcie -pkgver=r245.82626d4 +pkgver=git url="https://github.com/patjak/bcwc_pcie" fwurl="https://github.com/patjak/facetimehd-firmware" fwname=facetimehd-firmware From 86b149604ffc23da0c50479430fa3115cd417ca0 Mon Sep 17 00:00:00 2001 From: Isaac Date: Sun, 14 Jun 2020 19:30:13 +0800 Subject: [PATCH 11/11] Use existing source --- install.sh | 6 ------ 1 file changed, 6 deletions(-) diff --git a/install.sh b/install.sh index 00c777b..79c4c90 100755 --- a/install.sh +++ b/install.sh @@ -8,13 +8,11 @@ fi pkgname=bcwc-pcie pkgver=git -url="https://github.com/patjak/bcwc_pcie" fwurl="https://github.com/patjak/facetimehd-firmware" fwname=facetimehd-firmware srcdir=src rm -rf ${srcdir} - mkdir $srcdir if [ ! -f /usr/lib/firmware/facetimehd/firmware.bin ]; then @@ -27,13 +25,9 @@ if [ ! -f /usr/lib/firmware/facetimehd/firmware.bin ]; then popd > /dev/null fi -(cd $srcdir; git clone $url $pkgname) - -pushd $srcdir/$pkgname/ > /dev/null for FILE in dkms.conf Makefile *.[ch]; do install -Dm 644 "$FILE" "/usr/src/${pkgname}-${pkgver}/$FILE" done -popd > /dev/null echo 'Creating modprobe config files' echo 'facetimehd' > /etc/modules-load.d/bcwc-pcie.conf