Малина Pi NoIR камера висит

Фоновая информация:

Я построил интеллектуальное дверное решение с RPi B + (Raspbian), которое использует три датчика (PIR, гироскоп [I2C] и ультразвук). В зависимости от состояния датчика, управляемого Python script, я начинаю записывать видео с помощью команды raspivid и/или воспроизводить звуки на динамиках Bluetooth. У меня также есть USB WIFI-ключ, подключенный к RPi.

Так я называю камеру Pi NoIR в моем файле .sh:

raspivid -w 800 -h 600 -t 15000 -o file.h264 -n -rot 270

Описание проблемы:

Камера работает нормально на некоторое время (я не могу точно определить, как долго [2 часа может быть], ни то, что вызывает проблему), но затем перестает работать. Самое смешное, что я не получаю сообщение об ошибке.

Что я сделал, чтобы определить основную причину:

  • Я попытался вручную убить дочерний процесс (Raspivid), но он просто не работает. Если я убью родительский процесс (файл .sh), то мой дочерний процесс назначается PID 1 (init.d).

  • Я попытался записать новое видео в новом окне терминала, но новый процесс тоже зависает.

  • Перезагрузка Pi не работает. Он говорит, что перезагружается, но это не так (даже с опцией -f).

  • Я установил новую Pi-камеру, гарантирующую, что это не проблема с оборудованием или лентой.

  • У камеры достаточно памяти.

  • Pi имеет достаточную мощность (красный светодиод всегда включен)

  • -v не возвращает ошибку

  • Я установил V4L2-CTL, но у меня такая же проблема

Как я могу исправить это? Спасибо!

** Изменить **

dmesg:

[   90.555578] ------------[ cut here ]------------
[   90.555698] WARNING: CPU: 0 PID: 3593 at drivers/media/v4l2-core/videobuf2-core.c:2135 __vb2_queue_cancel+0xf4/0x160 [videobuf2_core]()
[   90.555715] Modules linked in: evdev uinput rfcomm bnep bcm2835_v4l2 videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev media snd_bcm2835 snd_pcm snd_seq snd_seq_device snd_timer snd spi_bcm2708 i2c_bcm2708 i2c_dev ecb btusb 8192cu bluetooth rfkill uio_pdrv_genirq uio
[   90.555843] CPU: 0 PID: 3593 Comm: v4l2-ctl Not tainted 3.18.7+ #755
[   90.555915] [<c00151fc>] (unwind_backtrace) from [<c0012710>] (show_stack+0x20/0x24)
[   90.556012] [<c0012710>] (show_stack) from [<c0555b30>] (dump_stack+0x20/0x28)
[   90.556053] [<c0555b30>] (dump_stack) from [<c0022ef4>] (warn_slowpath_common+0x7c/0x9c)
[   90.556083] [<c0022ef4>] (warn_slowpath_common) from [<c0022fd0>] (warn_slowpath_null+0x2c/0x34)
[   90.556143] [<c0022fd0>] (warn_slowpath_null) from [<bf263a1c>] (__vb2_queue_cancel+0xf4/0x160 [videobuf2_core])
[   90.556252] [<bf263a1c>] (__vb2_queue_cancel [videobuf2_core]) from [<bf265548>] (vb2_internal_streamoff+0x40/0xdc [videobuf2_core])
[   90.556361] [<bf265548>] (vb2_internal_streamoff [videobuf2_core]) from [<bf2656d8>] (vb2_streamoff+0x3c/0x60 [videobuf2_core])
[   90.556436] [<bf2656d8>] (vb2_streamoff [videobuf2_core]) from [<bf26574c>] (vb2_ioctl_streamoff+0x50/0x54 [videobuf2_core])
[   90.556669] [<bf26574c>] (vb2_ioctl_streamoff [videobuf2_core]) from [<bf228658>] (v4l_streamoff+0x28/0x2c [videodev])
[   90.556938] [<bf228658>] (v4l_streamoff [videodev]) from [<bf22baf4>] (__video_do_ioctl+0x254/0x2e8 [videodev])
[   90.557182] [<bf22baf4>] (__video_do_ioctl [videodev]) from [<bf22b49c>] (video_usercopy+0x180/0x560 [videodev])
[   90.557414] [<bf22b49c>] (video_usercopy [videodev]) from [<bf22b898>] (video_ioctl2+0x1c/0x24 [videodev])
[   90.557616] [<bf22b898>] (video_ioctl2 [videodev]) from [<bf2266b0>] (v4l2_ioctl+0x11c/0x14c [videodev])
[   90.557791] [<bf2266b0>] (v4l2_ioctl [videodev]) from [<c014c478>] (do_vfs_ioctl+0x3f0/0x5d4)
[   90.557872] [<c014c478>] (do_vfs_ioctl) from [<c014c6a0>] (SyS_ioctl+0x44/0x6c)
[   90.557917] [<c014c6a0>] (SyS_ioctl) from [<c000e8c0>] (ret_fast_syscall+0x0/0x48)
[   90.557936] ---[ end trace 28c9150399e29093 ]---
[ 3123.544118] ------------[ cut here ]------------
[ 3123.544235] WARNING: CPU: 0 PID: 28629 at drivers/media/v4l2-core/videobuf2-core.c:2135 __vb2_queue_cancel+0xf4/0x160 [videobuf2_core]()
[ 3123.544251] Modules linked in: evdev uinput rfcomm bnep bcm2835_v4l2 videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev media snd_bcm2835 snd_pcm snd_seq snd_seq_device snd_timer snd spi_bcm2708 i2c_bcm2708 i2c_dev ecb btusb 8192cu bluetooth rfkill uio_pdrv_genirq uio
[ 3123.544404] CPU: 0 PID: 28629 Comm: v4l2-ctl Tainted: G        W      3.18.7+ #755
[ 3123.544475] [<c00151fc>] (unwind_backtrace) from [<c0012710>] (show_stack+0x20/0x24)
[ 3123.544570] [<c0012710>] (show_stack) from [<c0555b30>] (dump_stack+0x20/0x28)
[ 3123.544676] [<c0555b30>] (dump_stack) from [<c0022ef4>] (warn_slowpath_common+0x7c/0x9c)
[ 3123.545092] [<c0022ef4>] (warn_slowpath_common) from [<c0022fd0>] (warn_slowpath_null+0x2c/0x34)
[ 3123.545178] [<c0022fd0>] (warn_slowpath_null) from [<bf263a1c>] (__vb2_queue_cancel+0xf4/0x160 [videobuf2_core])
[ 3123.545253] [<bf263a1c>] (__vb2_queue_cancel [videobuf2_core]) from [<bf265548>] (vb2_internal_streamoff+0x40/0xdc [videobuf2_core])
[ 3123.545316] [<bf265548>] (vb2_internal_streamoff [videobuf2_core]) from [<bf2656d8>] (vb2_streamoff+0x3c/0x60 [videobuf2_core])
[ 3123.545377] [<bf2656d8>] (vb2_streamoff [videobuf2_core]) from [<bf26574c>] (vb2_ioctl_streamoff+0x50/0x54 [videobuf2_core])
[ 3123.545562] [<bf26574c>] (vb2_ioctl_streamoff [videobuf2_core]) from [<bf228658>] (v4l_streamoff+0x28/0x2c [videodev])
[ 3123.545803] [<bf228658>] (v4l_streamoff [videodev]) from [<bf22baf4>] (__video_do_ioctl+0x254/0x2e8 [videodev])
[ 3123.546060] [<bf22baf4>] (__video_do_ioctl [videodev]) from [<bf22b49c>] (video_usercopy+0x180/0x560 [videodev])
[ 3123.546309] [<bf22b49c>] (video_usercopy [videodev]) from [<bf22b898>] (video_ioctl2+0x1c/0x24 [videodev])
[ 3123.546483] [<bf22b898>] (video_ioctl2 [videodev]) from [<bf2266b0>] (v4l2_ioctl+0x11c/0x14c [videodev])
[ 3123.546595] [<bf2266b0>] (v4l2_ioctl [videodev]) from [<c014c478>] (do_vfs_ioctl+0x3f0/0x5d4)
[ 3123.546676] [<c014c478>] (do_vfs_ioctl) from [<c014c6a0>] (SyS_ioctl+0x44/0x6c)
[ 3123.546717] [<c014c6a0>] (SyS_ioctl) from [<c000e8c0>] (ret_fast_syscall+0x0/0x48)
[ 3123.546737] ---[ end trace 28c9150399e29094 ]---
[34462.831249] bcm2835_v4l2: error 0 waiting for sync completion
[34465.833783] bcm2835_v4l2: error 0 waiting for sync completion
[34465.833853] bcm2835_v4l2: failed disconnecting src port
[34468.833772] bcm2835_v4l2: error 0 waiting for sync completion
[34468.833818] bcm2835-v4l2: Failed to disable encode component -62
[34471.834219] bcm2835_v4l2: error 0 waiting for sync completion
[34471.834395] bcm2835-v4l2: vidioc_s_fmt_vid_cap: failed to setup mmal components: -62
[34474.873813] bcm2835_v4l2: error 0 waiting for sync completion
[34474.890435] bcm2835-v4l2: queue_setup: capture port not configured
[34495.914162] bcm2835_v4l2: error 0 waiting for sync completion
[34498.916190] bcm2835_v4l2: error 0 waiting for sync completion
[34498.916290] bcm2835-v4l2: vidioc_s_fmt_vid_cap: failed to setup mmal components: -62
[34502.064159] bcm2835_v4l2: error 0 waiting for sync completion
[34502.070076] bcm2835-v4l2: queue_setup: capture port not configured
[36016.330148] bcm2835_v4l2: error 0 waiting for sync completion
[36019.339279] bcm2835_v4l2: error 0 waiting for sync completion
[36019.339327] bcm2835-v4l2: vidioc_s_fmt_vid_cap: failed to setup mmal components: -62
[36022.430218] bcm2835_v4l2: error 0 waiting for sync completion
[36022.441684] bcm2835-v4l2: queue_setup: capture port not configured

Syslog:

Feb 20 05:35:02 raspberrypi kernel: [34462.831249] bcm2835_v4l2: error 0 waiting for sync completion
Feb 20 05:35:05 raspberrypi kernel: [34465.833783] bcm2835_v4l2: error 0 waiting for sync completion
Feb 20 05:35:05 raspberrypi kernel: [34465.833853] bcm2835_v4l2: failed disconnecting src port
Feb 20 05:35:08 raspberrypi kernel: [34468.833772] bcm2835_v4l2: error 0 waiting for sync completion
Feb 20 05:35:08 raspberrypi kernel: [34468.833818] bcm2835-v4l2: Failed to disable encode component -62
Feb 20 05:35:11 raspberrypi kernel: [34471.834219] bcm2835_v4l2: error 0 waiting for sync completion
Feb 20 05:35:11 raspberrypi kernel: [34471.834395] bcm2835-v4l2: vidioc_s_fmt_vid_cap: failed to setup mmal components: -62
Feb 20 05:35:14 raspberrypi kernel: [34474.873813] bcm2835_v4l2: error 0 waiting for sync completion
Feb 20 05:35:14 raspberrypi kernel: [34474.890435] bcm2835-v4l2: queue_setup: capture port not configured
Feb 20 05:35:35 raspberrypi kernel: [34495.914162] bcm2835_v4l2: error 0 waiting for sync completion
Feb 20 05:35:38 raspberrypi kernel: [34498.916190] bcm2835_v4l2: error 0 waiting for sync completion
Feb 20 05:35:38 raspberrypi kernel: [34498.916290] bcm2835-v4l2: vidioc_s_fmt_vid_cap: failed to setup mmal components: -62
Feb 20 05:35:41 raspberrypi kernel: [34502.064159] bcm2835_v4l2: error 0 waiting for sync completion
Feb 20 05:35:41 raspberrypi kernel: [34502.070076] bcm2835-v4l2: queue_setup: capture port not configured
Feb 20 06:00:55 raspberrypi kernel: [36016.330148] bcm2835_v4l2: error 0 waiting for sync completion
Feb 20 06:00:58 raspberrypi kernel: [36019.339279] bcm2835_v4l2: error 0 waiting for sync completion
Feb 20 06:00:58 raspberrypi kernel: [36019.339327] bcm2835-v4l2: vidioc_s_fmt_vid_cap: failed to setup mmal components: -62
Feb 20 06:01:01 raspberrypi kernel: [36022.430218] bcm2835_v4l2: error 0 waiting for sync completion
Feb 20 06:01:01 raspberrypi kernel: [36022.441684] bcm2835-v4l2: queue_setup: capture port not configured

сообщения:

Feb 19 20:02:10 raspberrypi kernel: [   90.555578] ------------[ cut here ]------------
Feb 19 20:02:10 raspberrypi kernel: [   90.555698] WARNING: CPU: 0 PID: 3593 at drivers/media/v4l2-core/videobuf2-core.c:2135 __vb2_queue_cancel+0xf4/0x160 [videobuf2_core]()
Feb 19 20:02:10 raspberrypi kernel: [   90.555715] Modules linked in: evdev uinput rfcomm bnep bcm2835_v4l2 videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev media snd_bcm2835 snd_pcm snd_seq snd_seq_device snd_timer snd spi_bcm2708 i2c_bcm2708 i2c_dev ecb btusb 8192cu bluetooth rfkill uio_pdrv_genirq uio
Feb 19 20:02:10 raspberrypi kernel: [   90.555843] CPU: 0 PID: 3593 Comm: v4l2-ctl Not tainted 3.18.7+ #755
Feb 19 20:02:10 raspberrypi kernel: [   90.555915] [<c00151fc>] (unwind_backtrace) from [<c0012710>] (show_stack+0x20/0x24)
Feb 19 20:02:10 raspberrypi kernel: [   90.556012] [<c0012710>] (show_stack) from [<c0555b30>] (dump_stack+0x20/0x28)
Feb 19 20:02:10 raspberrypi kernel: [   90.556053] [<c0555b30>] (dump_stack) from [<c0022ef4>] (warn_slowpath_common+0x7c/0x9c)
Feb 19 20:02:10 raspberrypi kernel: [   90.556083] [<c0022ef4>] (warn_slowpath_common) from [<c0022fd0>] (warn_slowpath_null+0x2c/0x34)
Feb 19 20:02:10 raspberrypi kernel: [   90.556143] [<c0022fd0>] (warn_slowpath_null) from [<bf263a1c>] (__vb2_queue_cancel+0xf4/0x160 [videobuf2_core])
Feb 19 20:02:10 raspberrypi kernel: [   90.556252] [<bf263a1c>] (__vb2_queue_cancel [videobuf2_core]) from [<bf265548>] (vb2_internal_streamoff+0x40/0xdc [videobuf2_core])
Feb 19 20:02:10 raspberrypi kernel: [   90.556361] [<bf265548>] (vb2_internal_streamoff [videobuf2_core]) from [<bf2656d8>] (vb2_streamoff+0x3c/0x60 [videobuf2_core])
Feb 19 20:02:10 raspberrypi kernel: [   90.556436] [<bf2656d8>] (vb2_streamoff [videobuf2_core]) from [<bf26574c>] (vb2_ioctl_streamoff+0x50/0x54 [videobuf2_core])
Feb 19 20:02:10 raspberrypi kernel: [   90.556669] [<bf26574c>] (vb2_ioctl_streamoff [videobuf2_core]) from [<bf228658>] (v4l_streamoff+0x28/0x2c [videodev])
Feb 19 20:02:10 raspberrypi kernel: [   90.556938] [<bf228658>] (v4l_streamoff [videodev]) from [<bf22baf4>] (__video_do_ioctl+0x254/0x2e8 [videodev])
Feb 19 20:02:10 raspberrypi kernel: [   90.557182] [<bf22baf4>] (__video_do_ioctl [videodev]) from [<bf22b49c>] (video_usercopy+0x180/0x560 [videodev])
Feb 19 20:02:10 raspberrypi kernel: [   90.557414] [<bf22b49c>] (video_usercopy [videodev]) from [<bf22b898>] (video_ioctl2+0x1c/0x24 [videodev])
Feb 19 20:02:10 raspberrypi kernel: [   90.557616] [<bf22b898>] (video_ioctl2 [videodev]) from [<bf2266b0>] (v4l2_ioctl+0x11c/0x14c [videodev])
Feb 19 20:02:10 raspberrypi kernel: [   90.557791] [<bf2266b0>] (v4l2_ioctl [videodev]) from [<c014c478>] (do_vfs_ioctl+0x3f0/0x5d4)
Feb 19 20:02:10 raspberrypi kernel: [   90.557872] [<c014c478>] (do_vfs_ioctl) from [<c014c6a0>] (SyS_ioctl+0x44/0x6c)
Feb 19 20:02:10 raspberrypi kernel: [   90.557917] [<c014c6a0>] (SyS_ioctl) from [<c000e8c0>] (ret_fast_syscall+0x0/0x48)
Feb 19 20:02:10 raspberrypi kernel: [   90.557936] ---[ end trace 28c9150399e29093 ]---
Feb 19 20:52:43 raspberrypi kernel: [ 3123.544118] ------------[ cut here ]------------
Feb 19 20:52:43 raspberrypi kernel: [ 3123.544235] WARNING: CPU: 0 PID: 28629 at drivers/media/v4l2-core/videobuf2-core.c:2135 __vb2_queue_cancel+0xf4/0x160 [videobuf2_core]()
Feb 19 20:52:43 raspberrypi kernel: [ 3123.544251] Modules linked in: evdev uinput rfcomm bnep bcm2835_v4l2 videobuf2_vmalloc videobuf2_memops videobuf2_core v4l2_common videodev media snd_bcm2835 snd_pcm snd_seq snd_seq_device snd_timer snd spi_bcm2708 i2c_bcm2708 i2c_dev ecb btusb 8192cu bluetooth rfkill uio_pdrv_genirq uio
Feb 19 20:52:43 raspberrypi kernel: [ 3123.544404] CPU: 0 PID: 28629 Comm: v4l2-ctl Tainted: G        W      3.18.7+ #755
Feb 19 20:52:43 raspberrypi kernel: [ 3123.544475] [<c00151fc>] (unwind_backtrace) from [<c0012710>] (show_stack+0x20/0x24)
Feb 19 20:52:43 raspberrypi kernel: [ 3123.544570] [<c0012710>] (show_stack) from [<c0555b30>] (dump_stack+0x20/0x28)
Feb 19 20:52:43 raspberrypi kernel: [ 3123.544676] [<c0555b30>] (dump_stack) from [<c0022ef4>] (warn_slowpath_common+0x7c/0x9c)
Feb 19 20:52:43 raspberrypi kernel: [ 3123.545092] [<c0022ef4>] (warn_slowpath_common) from [<c0022fd0>] (warn_slowpath_null+0x2c/0x34)
Feb 19 20:52:43 raspberrypi kernel: [ 3123.545178] [<c0022fd0>] (warn_slowpath_null) from [<bf263a1c>] (__vb2_queue_cancel+0xf4/0x160 [videobuf2_core])
Feb 19 20:52:43 raspberrypi kernel: [ 3123.545253] [<bf263a1c>] (__vb2_queue_cancel [videobuf2_core]) from [<bf265548>] (vb2_internal_streamoff+0x40/0xdc [videobuf2_core])
Feb 19 20:52:43 raspberrypi kernel: [ 3123.545316] [<bf265548>] (vb2_internal_streamoff [videobuf2_core]) from [<bf2656d8>] (vb2_streamoff+0x3c/0x60 [videobuf2_core])
Feb 19 20:52:43 raspberrypi kernel: [ 3123.545377] [<bf2656d8>] (vb2_streamoff [videobuf2_core]) from [<bf26574c>] (vb2_ioctl_streamoff+0x50/0x54 [videobuf2_core])
Feb 19 20:52:43 raspberrypi kernel: [ 3123.545562] [<bf26574c>] (vb2_ioctl_streamoff [videobuf2_core]) from [<bf228658>] (v4l_streamoff+0x28/0x2c [videodev])
Feb 19 20:52:43 raspberrypi kernel: [ 3123.545803] [<bf228658>] (v4l_streamoff [videodev]) from [<bf22baf4>] (__video_do_ioctl+0x254/0x2e8 [videodev])
Feb 19 20:52:43 raspberrypi kernel: [ 3123.546060] [<bf22baf4>] (__video_do_ioctl [videodev]) from [<bf22b49c>] (video_usercopy+0x180/0x560 [videodev])
Feb 19 20:52:43 raspberrypi kernel: [ 3123.546309] [<bf22b49c>] (video_usercopy [videodev]) from [<bf22b898>] (video_ioctl2+0x1c/0x24 [videodev])
Feb 19 20:52:43 raspberrypi kernel: [ 3123.546483] [<bf22b898>] (video_ioctl2 [videodev]) from [<bf2266b0>] (v4l2_ioctl+0x11c/0x14c [videodev])
Feb 19 20:52:43 raspberrypi kernel: [ 3123.546595] [<bf2266b0>] (v4l2_ioctl [videodev]) from [<c014c478>] (do_vfs_ioctl+0x3f0/0x5d4)
Feb 19 20:52:43 raspberrypi kernel: [ 3123.546676] [<c014c478>] (do_vfs_ioctl) from [<c014c6a0>] (SyS_ioctl+0x44/0x6c)
Feb 19 20:52:43 raspberrypi kernel: [ 3123.546717] [<c014c6a0>] (SyS_ioctl) from [<c000e8c0>] (ret_fast_syscall+0x0/0x48)
Feb 19 20:52:43 raspberrypi kernel: [ 3123.546737] ---[ end trace 28c9150399e29094 ]---

Ответ 1

Изучая ваши сообщения ядра, в частности строку, содержащую '__vb2_queue_cancel', я думаю, что ваша проблема может частично быть связана с драйверами ядра Raspberry. Вы проверили, содержит ли ваше ядро ​​исправление, указанное в [1]? Если нет, применение этого параметра может решить вашу проблему.

По какой-то причине приложение вашей камеры останавливает захват видео, и из-за вышеупомянутой ошибки это не удается. Это может по крайней мере дать вам возможность перезапустить конвейер захвата.

[1] https://github.com/6by9/linux/commit/f1e870c2c910d0620b1a48ac7165c8f9e9a75527