在做视频监控项目,以前一直用的是2.6.36的内核,一直很正常,但是这几天换3.0.1内核,启动程序,却出现了错误,如下:

  

./test_usb_camera
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
v4l2_open id=2
Unable to handle kernel NULL pointer dereference at virtual address 00000060
pgd = cbc08000
[00000060] *pgd=5c7d6831, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#2]
Modules linked in:
CPU: 0 Tainted: G D W (3.0.1 #676)
PC is at video_devdata+0x18/0x30
LR is at dev_open+0x28/0x194
pc : [<c0352fbc>] lr : [<c036359c>] psr: 60000013
sp : cc7f5d30 ip : cc7f5d40 fp : cc7f5d3c
r10: c081b880 r9 : 00000026 r8 : cc7e78c8
r7 : cc423008 r6 : cc7e78c8 r5 : cc7bc200 r4 : cc423000
r3 : 00000003 r2 : c089e880 r1 : 00000000 r0 : cc7e78c8
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
Control: 00c5387d Table: 5bc08008 DAC: 00000015
Process test_usb_camera (pid: 77, stack limit = 0xcc7f4268)
Stack: (0xcc7f5d30 to 0xcc7f6000)
5d20: cc7f5d6c cc7f5d40 c036359c c0352fb0
5d40: c0363574 cc423000 cc7bc200 cc7e78c8 cc423008 cc7bc200 00000026 cc127180
5d60: cc7f5d8c cc7f5d70 c035333c c0363580 00000000 00000000 cc721ac0 cc7e78c8
5d80: cc7f5dbc cc7f5d90 c00ef5b0 c0353298 cc7f5e2c cc7f5ed0 00000000 cc7bc200
5da0: 00000000 cc7e78c8 c00ef490 cc127180 cc7f5df4 cc7f5dc0 c00ead14 c00ef49c
5dc0: cc080800 cc40ff00 cc7e78c8 cc7f5ed0 cc7bc200 00000000 cc7bce80 00000802
5de0: 00000026 00000000 cc7f5e1c cc7f5df8 c00eaf50 c00eabb4 cc7bce80 cc7f5e8c
5e00: cc7e78c8 cc7f5ed0 00000000 cc7f5e8c cc7f5e64 cc7f5e20 c00f8488 c00eaef4
5e20: cc7a3005 c088a480 cc7f5e64 cc40ff00 cc080800 cc7e78c8 cc7f5e64 cc7f5ed0
5e40: ffffff9c cc7f5f60 cc7f4000 cc7a3000 cc7f4000 cc7f5e8c cc7f5ec4 cc7f5e68
5e60: c00f992c c00f830c cc7f5e94 00000000 33db2580 00000000 66340397 bee98b70
5e80: 00000068 00000000 00000000 cc40ff00 cc127180 00000000 00000000 00000001
5ea0: cc7f5f60 cc7f5ed0 ffffff9c cc7a3000 cc7f4000 ffffff9c cc7f5f54 cc7f5ec8
5ec0: c00f9d04 c00f9874 00000041 00000000 cc40ff00 cc127180 d9d3cea0 00000006
5ee0: cc7a3005 cc40f820 cc07cc00 cc7e78c8 00000101 00000000 00000000 00000000
5f00: 00000000 00000000 00000004 cc7b50c0 cc7b50c8 cc7b50c4 00000000 cc7f4000
5f20: cc7f5f54 00000803 00000000 00000000 00000001 00000001 00000802 00000000
5f40: 00000004 cc7a3000 cc7f5f94 cc7f5f58 c00eaa78 c00f9cd8 00000000 00000000
5f60: 00000802 00000000 00000026 00000100 00000001 bee98e84 00067ecc 00000005
5f80: c0036ce8 00000000 cc7f5fa4 cc7f5f98 c00eab84 c00ea988 00000000 cc7f5fa8
5fa0: c0036b40 c00eab6c 00000001 bee98e84 000681c8 00000802 00000000 00085c8c
5fc0: 00000001 bee98e84 00067ecc 00000005 bee98d0c 00000000 000874b8 0000000a
5fe0: 00067ed4 bee98be0 000089b4 0001fe4c 40000010 000681c8 00000000 00000000
[<c0352fbc>] (video_devdata+0x18/0x30) from [<c036359c>] (dev_open+0x28/0x194)
[<c036359c>] (dev_open+0x28/0x194) from [<c035333c>] (v4l2_open+0xb0/0xd8)
[<c035333c>] (v4l2_open+0xb0/0xd8) from [<c00ef5b0>] (chrdev_open+0x120/0x1a4)
[<c00ef5b0>] (chrdev_open+0x120/0x1a4) from [<c00ead14>] (__dentry_open+0x16c/0x2c4)
[<c00ead14>] (__dentry_open+0x16c/0x2c4) from [<c00eaf50>] (nameidata_to_filp+0x68/0x70)
[<c00eaf50>] (nameidata_to_filp+0x68/0x70) from [<c00f8488>] (do_last+0x188/0x6b0)
[<c00f8488>] (do_last+0x188/0x6b0) from [<c00f992c>] (path_openat+0xc4/0x3a4)
[<c00f992c>] (path_openat+0xc4/0x3a4) from [<c00f9d04>] (do_filp_open+0x38/0x8c)
[<c00f9d04>] (do_filp_open+0x38/0x8c) from [<c00eaa78>] (do_sys_open+0xfc/0x1d0)
[<c00eaa78>] (do_sys_open+0xfc/0x1d0) from [<c00eab84>] (sys_open+0x24/0x28)
[<c00eab84>] (sys_open+0x24/0x28) from [<c0036b40>] (ret_fast_syscall+0x0/0x30)
Code: e24cb004 e590200c e5921020 e59f2010 (e5913060)
---[ end trace da227214a82491ba ]---
Segmentation fault
[root@Enjoylinux /]#
[root@Enjoylinux /]#

完善OK6410摄像头驱动由上面的分析可知,OK6410新版本(3.0.1)的内核的dev_open函数是有问题的,实际上他是赋值给了v4l2_file_operations结构体的open成员,作为函数指针调用。他的实现部分的函数签名是int dev_open(struct file *file)在./drivers/media/video/gspca/gspca.c的1202行可以找到函数实现。而v4l2_file_operations的open成员的定义是int (*open) (struct node*,struct file *);所以在最终通过open成员函数指针调用dev_open的时候会出现打开失败的结果。我们要把v4l2_file_operations的open成员的定义改为int (*open) (struct file *);而且在相关的调用部分也要修改多了node参数的调用,即删掉node参数。

(1)头文件:./include/media/v4l2-dev.h的48行49行改为   int(*open) (struct file *);   int(*release) (struct file *);

(2)C文件:./drivers/media/video/v4l2-dev.c第281行改为:       ret= vdev->fops->open(filp);

  第295行改为:       vdev->fops->release(filp);

(3)/driver/media/video/uvc/uvc_v4l2.c中 uvc_v4l2_open(struct inode *inode,struct file *file)函数 和uvc_v4l2_release(struct inode *inode,struct file *file)函数,

   改后为: uvc_v4l2_open(struct file *file) uvc_v4l2_release(struct file *file)

然后重新编译内核即可。

此外:要注意自己的摄像头头设备文件要和测试代码中一样!!!!!!!!

ok6410 3.0.1内核调用V4L接口出错解决方法(转)的更多相关文章

  1. 错误:Unsupported major.minor version 51.0(jdk版本错误)的解决方法

    错误:Unsupported major.minor version 51.0(jdk版本错误)的解决方法 java.lang.UnsupportedClassVersionError: org/ap ...

  2. Delphi 多线程 “尚未调用CoInitialize错误”的解决方法

    在Delphi  多线程中出现“尚未调用CoInitialize错误”的解决方法 解决方法如下: function  TMyThread.ExecTimer: Boolean;begin  Resul ...

  3. IIS6.0 IIS7.5应用程序池自动停止的解决方法 搜集整理

    来源:http://www.guchengnet.com/1499.html IIS6.0 IIS7.5应用程序池自动停止的解决方法 搜集整理 发表于2016年12月14日 有2.3个月没有用本地的i ...

  4. localhost不能访问127.0.0.1可以访问的原因及解决方法 被打磨的不像人样

    localhost不能访问127.0.0.1可以访问的原因及解决方法 作者:admin    时间:2013-12-16 10:58:47    浏览:16599   有时候我们在调试程序的时候,会出 ...

  5. Python的Web编程[2] -> WebService技术[0] -> 利用 Python 调用 WebService 接口

    WebService技术 / WebService Technology 1 关于webservice / Constants WebService是一种跨编程语言和跨操作系统平台的远程调用技术. W ...

  6. vc6.0转vs2012的一些错误与解决方法

    1>------ 已启动生成: 项目: NMW210, 配置: Debug Win32 ------ abs_position = fabs((float)posiTemp1 - (float) ...

  7. 必须先将 ContentLength 字节写入请求流,然后再调用 [Begin]GetResponse。解决方法

    当在后台实现POST请求的时候,出现如下错误: 必须先将 ContentLength 字节写入请求流,然后再调用 [Begin]GetResponse. 或者是如下错误: 上述是因为由于我们使用的是代 ...

  8. 织梦dede如何获取图集调用第一张图片完美解决方法【5.7sp2版本】

    制作产品图集多图效果的时候,常常需要获取图集第一张图片的功能,假设获取的是缩略图,那么缩略图不够大的情况下,第一展示效果就会很差,下面来介绍下如何获取调用织梦图集第一张图片的方法: 首先在 inclu ...

  9. Python使用suds调用webservice报错解决方法:AttributeError: 'Document' object has no attribute 'set'

    使用python的suds包调用webservice服务接口,报错:AttributeError: 'Document' object has no attribute 'set' 调用服务接口代码: ...

随机推荐

  1. Combine 框架,从0到1 —— 4.在 Combine 中使用通知

      本文首发于 Ficow Shen's Blog,原文地址: Combine 框架,从0到1 -- 4.在 Combine 中使用通知.   内容概览 前言 让通知处理代码使用 Combine 总结 ...

  2. 2vscode user settings

    {   "editor.accessibilityPageSize": 14,   "editor.fontSize": 14,   "editor. ...

  3. 二.spring boot第一个web服务

    通过<一.spring boot初始化项目>我们已经会初始化spring boot项目,那本篇文章就说明下初始化项目的具体内容,并编写第一个Hello页面. 项目结构 mvnw.mvnw. ...

  4. JAVA读取文件夹大小

    几种不同的实现方法: (一)单线程递归方式 package com.taobao.test; import java.io.File; public class TotalFileSizeSequen ...

  5. Java自定义异常的用法

    package day162020072701.day1601; /** * @author liuwenlong * @create 2020-07-27 09:25:44 */ @Suppress ...

  6. python根据密钥得到谷歌两步验证动态验证码

    # coding=utf-8 import time import base64 import sys import hashlib import hmac import struct def goo ...

  7. 微信小程序常用样式

    1.设置全局字体样式app.wxss: text{ font-family:MicroSoft yahei; } 2.设置弹性盒子模型: .container{ /*弹性模型*/ display:fl ...

  8. python中绝对值的表达式

    abs(x) print(abs(23)) #23print(abs(-45)) #45  

  9. 万字详解TDengine 2.0整体架构设计思路

    ​导读:涛思数据8月3日将TDengine 的集群功能开源,TDengine具有超强的性能和功能,为什么能做到?它到底有哪些技术创新?今将TDengine的整体设计文档分享出来. 1: 数据模型 物联 ...

  10. python-面向过程面向对象和栈的实现

    0x01 大纲 面向过程 函数 参数传递 返回 面向对象 类 栈的数据结构实现 0x02 例子 def add(a,b): return a+b if __name__ == '__main__': ...