gpt4 book ai didi

python - Raspberry Pi NoIR 相机挂起

转载 作者:IT王子 更新时间:2023-10-29 00:01:45 29 4
gpt4 key购买 nike

背景信息:

我使用 RPi B+ (Raspbian) 构建了一个智能门解决方案,它使用三个传感器(PIR、陀螺仪 [I2C] 和超声波)。根据 Python 脚本管理的传感器状态,我开始使用 raspivid 命令录制视频和/或在蓝牙扬声器上播放声音。我还有一个连接到 RPi 的 USB WIFI 加密狗。

这就是我在 .sh 文件中调用 Pi NoIR 相机的方式:

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

问题描述:

摄像头可以正常工作一段时间(我无法准确说明多长时间 [可能是 2 小时],也无法确定是什么触发了问题),但随后就停止工作了。有趣的是我没有收到任何错误消息。

我做了什么来确定根本原因:

  • 我尝试手动终止子进程 (Raspivid),但根本行不通。如果我终止父进程(.sh 文件),那么我的子进程将分配给 PID 1 (init.d)。

  • 我尝试在新终端窗口中录制新视频,但新进程也挂起。

  • 重启树莓派也没用。它说它正在重新启动,但实际上并没有(即使使用 -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

系统日志:

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 ]---

最佳答案

通过查看您的内核消息,特别是包含“__vb2_queue_cancel”的行,我认为您的问题可能部分与 Raspberry 的内核驱动程序有关。您是否检查过您的内核是否包含 [1] 中给出的修复程序?如果没有,应用该 oneliner 可能会解决您的问题。

由于某种原因,您的相机应用程序正在停止视频捕获,并且由于上述错误,它未能这样做。这至少可以让您有机会重新启动捕获管道。

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

关于python - Raspberry Pi NoIR 相机挂起,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28281293/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com