patjak / facetimehd

Reverse engineered Linux driver for the FacetimeHD (Broadcom 1570) PCIe webcam
GNU General Public License v2.0
1.36k stars 160 forks source link

Direct firmware load for facetimehd/1871_01XX.dat failed with error -2 #104

Closed nicolone closed 8 years ago

nicolone commented 8 years ago

When the driver is loaded via modprobe facetimehd the following error is generated: Direct firmware load for facetimehd/1871_01XX.dat failed with error -2

More details on my system:

$ sudo dmidecode -s system-product-name
MacBookPro11,5
$ uname -r
4.2.0-42-generic
$ ls -la /lib/firmware/facetimehd/
total 1428
drwxr-xr-x  2 root root    4096 Okt 20 16:05 .
drwxr-xr-x 73 root root   24576 Jul 20 12:04 ..
-rw-r--r--  1 root root 1425412 Okt 20 16:05 firmware.bin
$ lsmod | grep bdc_pci
$ lsmod | grep facetimehd
facetimehd             98304  0
videobuf2_dma_sg       20480  1 facetimehd
videobuf2_core         49152  1 facetimehd
videodev              172032  3 v4l2_common,facetimehd,videobuf2_core

The full dmesg log:

$ dmesg
...
[Okt20 16:38] media: Linux media interface: v0.10
[  +0,002931] Linux video capture interface: v2.00
[  +0,003979] facetimehd 0000:05:00.0: Found FaceTime HD camera with device id: 1570
[  +0,000066] facetimehd 0000:05:00.0: Setting 64bit DMA mask
[  +0,005036] facetimehd 0000:05:00.0: S2 PCIe link init succeeded
[  +0,000028] facetimehd 0000:05:00.0: Refclk: 25MHz (0xa)
[  +0,009943] facetimehd 0000:05:00.0: PLL reset finished
[  +0,000002] facetimehd 0000:05:00.0: Waiting for S2 PLL to lock at 450 MHz
[  +0,000012] facetimehd 0000:05:00.0: S2 PLL is locked after 10 us
[  +0,009940] facetimehd 0000:05:00.0: S2 PLL is in bypass mode
[  +0,019899] facetimehd 0000:05:00.0: DDR40 PHY PLL locked on safe settings
[  +0,000014] facetimehd 0000:05:00.0: STRAP valid
[  +0,000001] facetimehd 0000:05:00.0: Configuring DDR PLLs for 450 MHz
[  +0,000007] facetimehd 0000:05:00.0: DDR40 PLL is locked after 0 us
[  +0,000011] facetimehd 0000:05:00.0: First DDR40 VDL calibration completed after 2 us
[  +0,000011] facetimehd 0000:05:00.0: Second DDR40 VDL calibration completed after 2 us
[  +0,000001] facetimehd 0000:05:00.0: Using step size 150
[  +0,000005] facetimehd 0000:05:00.0: VDL set to: coarse=0x10008, fine=0x1011a
[  +0,000005] facetimehd 0000:05:00.0: Virtual VTT enabled
[  +0,020379] facetimehd 0000:05:00.0: S2 DRAM memory address: 0x22159559
[  +0,000014] facetimehd 0000:05:00.0: Rewrite DDR mode registers succeeded
[  +0,000199] facetimehd 0000:05:00.0: Full memory verification succeeded! (0)
[  +0,464180] facetimehd 0000:05:00.0: Loaded firmware, size: 1392kb
[  +0,140572] facetimehd 0000:05:00.0: ISP woke up after 0ms
[  +0,000007] facetimehd 0000:05:00.0: Number of IPC channels: 7, queue size: 44865
[  +0,000003] facetimehd 0000:05:00.0: Firmware requested heap size: 3072kb
[  +0,009948] facetimehd 0000:05:00.0: ISP second int after 0ms
[  +0,000002] facetimehd 0000:05:00.0: Channel description table at 00800000
[  +0,010104] facetimehd 0000:05:00.0: magic value: 00000000 after 0 ms
[  +0,000002] facetimehd 0000:05:00.0: Enabling interrupts
[  +0,000150] FWMSG: 
[  +0,000023] FWMSG: - APOLLO-ISP-APPLE ------------------------------------------------------------
[  +0,000011] FWMSG: 
[  +0,000013] FWMSG:   Restart count : 0
[  +0,000096] FWMSG:   Platform : mode = TARGET, ID = 0x00000000, HW = 00020018.00000000
[  +0,000016] FWMSG:   System Clock : 200000000 Hz
[  +0,000014] FWMSG:   Processor mode : SUPERVISOR
[  +0,000016] FWMSG:   Cache architecture type : SEPARATE
[  +0,000014] FWMSG:   Cache type : WRITEBACK
[  +0,000014] FWMSG:   Data Cache Line : 32 [0x20]
[  +0,000015] FWMSG:   Boot arguments entries : 2
[  +0,000082] FWMSG:     0000: 0x00000000 0x00000000
[  +0,000021] FWMSG:   Physical memory base : 0x00000000 [TLB base 0x00160000]
[  +0,000015] FWMSG:   Main memory :   base : 0x00000000
[  +0,000017] FWMSG:                   size : 8388608 [0x00800000] [8.0 MB]
[  +0,000085] FWMSG:   Extra heap :    base : 0x2080b000 [phy = 0x0080b000]
[  +0,000019] FWMSG:                   size : 3145728 [0x00300000] [3.0 MB]
[  +0,000018] FWMSG:   Shared window : base : 0x00800000 [static wiring]
[  +0,000072] FWMSG:                   size : 125829120 [0x07800000] [120.0 MB]
[  +0,000015] FWMSG:   Shared memory : base : 0x00800000
[  +0,000030] FWMSG:                   size : 260046848 [0x0f800000] [248.0 MB]
[  +0,000109] FWMSG:   TEXT : 1421992 [0x15b2a8] - text 667256, cstring  38749, const 715528
[  +0,000023] FWMSG:   DATA : 8076 [0x1f8c] - data 0, bss 460, common 1452, noinit 6144
[  +0,000017] FWMSG:   Heap free space : 10002626 [0x0098a0c2]
[  +0,000049] FWMSG:   Heap allocated space : 94656 [0x000171c0]
[  +0,000018] FWMSG:   Disclaimer : Copyright (c) APPLE Inc. All Rights Reserved.
[  +0,000014] FWMSG:   Application : adc [release]
[  +0,000040] FWMSG:   Linked on : Jul 25 2015 - 08:48:55
[  +0,000013] FWMSG:   Release : S2ISP-01.43.00
[  +0,000013] FWMSG:   H4ISPAPPLE : 11536
[  +0,000013] FWMSG:   H4ISPCD : 4081
[  +0,000035] FWMSG:   ffw : 4143
[  +0,000018] FWMSG:   Tool-chain : iPhone OS - 7.0.3 [clang/clang++]
[  +0,000010] FWMSG: 
[  +0,000060] FWMSG: -------------------------------------------------------------------------------
[  +0,000010] FWMSG: 
[  +0,072295] FWMSG: [ISP] CMD = 0x0004 [CISP_CMD_PRINT_ENABLE]
[  +0,000154] FWMSG: [ISP] CMD = 0x0003 [CISP_CMD_CONFIG_GET]
[  +0,000246] FWMSG: [ISP] CH = 0 CMD = 0x010d [CISP_CMD_CH_INFO_GET]
[  +0,000326] facetimehd 0000:05:00.0: Direct firmware load for facetimehd/1871_01XX.dat failed with error -2

When I run mplayer to test it anyways I get the following errors:

$ mplayer tv://
MPlayer2 2.0-728-g2c378c7-4build1 (C) 2000-2012 MPlayer Team
Cannot open file '/home/nico/.mplayer/input.conf': No such file or directory
Failed to open /home/nico/.mplayer/input.conf.
Cannot open file '/etc/mplayer/input.conf': No such file or directory
Failed to open /etc/mplayer/input.conf.

Playing tv://.
Detected file format: TV
Selected driver: v4l2
 name: Video 4 Linux 2 input
 author: Martin Olschewski <olschewski@zpr.uni-koeln.de>
 comment: first try, more to come ;-)
v4l2: your device driver does not support VIDIOC_G_STD ioctl, VIDIOC_G_PARM was used instead.
Selected device: Apple Facetime HD
 Capabilities:  video capture  read/write  streaming
 supported norms:
 inputs: 0 = Camera;
 Current input: 0
 Current format: YUYV
tv.c: norm_from_string(pal): Bogus norm parameter, setting default.
v4l2: ioctl enum norm failed: Inappropriate ioctl for device
Error: Cannot set norm!
Selected input hasn't got a tuner!

After that mplayer hangs and is unresponsive.

The generated dmesg logs are:

$dmesg
...
[Okt20 16:41] BUG: unable to handle kernel paging request at 0000000000096000
[  +0,000005] IP: [<ffffffffc14800f4>] vb2_dma_sg_alloc+0x194/0x10a0 [videobuf2_dma_sg]
[  +0,000006] PGD 3c083a067 PUD 3dda43067 PMD 0 
[  +0,000012] Oops: 0000 [#1] SMP 
[  +0,000002] Modules linked in: facetimehd(OE) videobuf2_dma_sg videobuf2_memops videobuf2_core v4l2_common videodev media bnep nvram ipt_MASQUERADE nf_nat_masquerade_ipv4 xfrm_user xfrm_algo iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 xt_addrtype iptable_filter ip_tables xt_conntrack x_tables nf_nat nf_conntrack br_netfilter bridge stp llc aufs msr btusb btrtl btbcm btintel bluetooth input_leds joydev bcm5974 binfmt_misc nls_iso8859_1 applesmc input_polldev x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel kvm snd_hda_codec_cirrus snd_hda_codec_generic fglrx(POE) brcmfmac snd_hda_codec_hdmi brcmutil snd_hda_intel snd_hda_codec cfg80211 snd_hda_core snd_seq_midi sbs snd_seq_midi_event snd_hwdep lpc_ich snd_rawmidi mei_me snd_pcm mei snd_seq snd_seq_device snd_timer snd thunderbolt
[  +0,000034]  soundcore amd_iommu_v2 shpchp acpi_als sbshc kfifo_buf industrialio apple_gmux apple_bl mac_hid parport_pc ppdev lp parport autofs4 drbg ansi_cprng algif_skcipher af_alg dm_crypt raid10 raid456 async_raid6_recov async_memcpy async_pq async_xor async_tx xor raid6_pq raid1 raid0 multipath linear hid_apple hid_generic usbhid hid crct10dif_pclmul crc32_pclmul aesni_intel aes_x86_64 lrw gf128mul glue_helper uas ablk_helper cryptd usb_storage ahci libahci video [last unloaded: bdc_pci]
[  +0,000017] CPU: 5 PID: 5654 Comm: mplayer Tainted: P           OE   4.2.0-42-generic #49-Ubuntu
[  +0,000002] Hardware name: Apple Inc. MacBookPro11,5/Mac-06F11F11946D27C5, BIOS MBP114.88Z.0172.B06.1509021656 09/02/2015
[  +0,000001] task: ffff88046a533700 ti: ffff8803b0d98000 task.ti: ffff8803b0d98000
[  +0,000001] RIP: 0010:[<ffffffffc14800f4>]  [<ffffffffc14800f4>] vb2_dma_sg_alloc+0x194/0x10a0 [videobuf2_dma_sg]
[  +0,000002] RSP: 0018:ffff8803b0d9baf8  EFLAGS: 00010246
[  +0,000001] RAX: 0000000000096000 RBX: ffff8803d0891f00 RCX: 0000160000000000
[  +0,000001] RDX: 0000000000000002 RSI: 0000000000001000 RDI: 0000000000000001
[  +0,000000] RBP: ffff8803b0d9bb58 R08: 0000000000000002 R09: 0000000000000000
[  +0,000001] R10: 0000000000000001 R11: 0000000000000001 R12: 00000000000082d0
[  +0,000001] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000001
[  +0,000001] FS:  00007f62d4d83880(0000) GS:ffff88047f340000(0000) knlGS:0000000000000000
[  +0,000000] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  +0,000001] CR2: 0000000000096000 CR3: 00000003d675c000 CR4: 00000000001406e0
[  +0,000001] Stack:
[  +0,000001]  ffff8803b0d9bb08 0000000000096000 0000000000001000 ffffea0001e00400
[  +0,000001]  0000000000000020 00000000fdc26df6 ffff880463040800 ffff88042727be88
[  +0,000001]  ffff88042b6db5c0 ffff88042727bc5c 0000000000000000 ffff88042b6db604
[  +0,000002] Call Trace:
[  +0,000004]  [<ffffffffc1518a44>] __vb2_queue_alloc+0x164/0x530 [videobuf2_core]
[  +0,000002]  [<ffffffffc1519008>] __reqbufs.isra.20+0x1f8/0x360 [videobuf2_core]
[  +0,000002]  [<ffffffffc151a6ac>] vb2_ioctl_reqbufs+0x6c/0xa0 [videobuf2_core]
[  +0,000005]  [<ffffffffc1540b63>] v4l_reqbufs+0x43/0x50 [videodev]
[  +0,000003]  [<ffffffffc153f7fd>] __video_do_ioctl+0x29d/0x310 [videodev]
[  +0,000003]  [<ffffffff811e1fbb>] ? __kmalloc+0x1cb/0x270
[  +0,000003]  [<ffffffffc153f2c6>] video_usercopy+0x336/0x5b0 [videodev]
[  +0,000002]  [<ffffffffc153f560>] ? video_ioctl2+0x20/0x20 [videodev]
[  +0,000003]  [<ffffffff810b0ab9>] ? update_curr+0x79/0x160
[  +0,000002]  [<ffffffff81242476>] ? fsnotify+0x316/0x4a0
[  +0,000001]  [<ffffffff810bea88>] ? __wake_up+0x48/0x60
[  +0,000003]  [<ffffffffc153f555>] video_ioctl2+0x15/0x20 [videodev]
[  +0,000002]  [<ffffffffc153a681>] v4l2_ioctl+0xb1/0xe0 [videodev]
[  +0,000003]  [<ffffffff81214205>] do_vfs_ioctl+0x295/0x480
[  +0,000001]  [<ffffffff81214469>] SyS_ioctl+0x79/0x90
[  +0,000003]  [<ffffffff817fa072>] entry_SYSCALL_64_fastpath+0x16/0x75
[  +0,000001] Code: ff ff ff 48 8b 73 10 8b 53 40 48 8b 7b 30 31 c9 4c 8b 45 b0 41 b9 d0 00 00 00 e8 c8 c7 f5 bf 85 c0 0f 85 47 01 00 00 48 8b 45 a8 <48> 8b 38 e8 24 20 0a c0 49 89 c5 48 89 03 8b 43 1c 4d 85 ed 44 
[  +0,000013] RIP  [<ffffffffc14800f4>] vb2_dma_sg_alloc+0x194/0x10a0 [videobuf2_dma_sg]
[  +0,000002]  RSP <ffff8803b0d9baf8>
[  +0,000000] CR2: 0000000000096000
[  +0,000002] ---[ end trace be3fed7893e5f349 ]---

Please contact me if you need further information to solve this issue. Thanks for your work!

patjak commented 8 years ago

That firmware error is harmless. You're missing the sensor calibration files but there is unfortunately no support for extracting them at the moment. The problem seems to be that your kernel is too old. If possible try upgrading to at least 4.4 and see if that helps.

seumasmac commented 8 years ago

Is 4.4 the oldest kernel that works? The wiki says:

Since this driver depends on vb2_dma_sg_init_ctx, it requires Linux kernel 3.19 or later.

so we should probably update it if the driver requires something a lot newer.

patjak commented 8 years ago

Yes, the wiki might be outdated or just simply wrong. Would help a lot if someone could test which kernels the driver work for and update the wiki with the correct info.

nicolone commented 8 years ago

Upgrading to kernel 4.4 fixed the problem. Thanks!

Tlanextic commented 3 years ago

I am running KDE Neon 5.22.3 with kernel 5.8.0-63 generic based on Ubuntu. I spend some hours and reboots to get the camera to work but now no avail. Please help a struggling n00b. :-P

iDevPro commented 6 months ago

This issue with kernel 6.6 also :)

nthdat09 commented 2 weeks ago

image

Does anyone have solution with this problem?