ok6410 3.0.1核心調用V4L介面出錯解決方案(轉)

來源:互聯網
上載者:User

標籤:

在做視頻監控項目,以前一直用的是2.6.36的核心,一直很正常,但是這幾天換3.0.1核心,啟動程式,卻出現了錯誤,如下:

  

./test_usb_camera XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXv4l2_open  id=2Unable to handle kernel NULL pointer dereference at virtual address 00000060pgd = cbc08000[00000060] *pgd=5c7d6831, *pte=00000000, *ppte=00000000Internal error: Oops: 17 [#2]Modules linked in:CPU: 0    Tainted: G      D W    (3.0.1 #676)PC is at video_devdata+0x18/0x30LR is at dev_open+0x28/0x194pc : [<c0352fbc>]    lr : [<c036359c>]    psr: 60000013sp : cc7f5d30  ip : cc7f5d40  fp : cc7f5d3cr10: c081b880  r9 : 00000026  r8 : cc7e78c8r7 : cc423008  r6 : cc7e78c8  r5 : cc7bc200  r4 : cc423000r3 : 00000003  r2 : c089e880  r1 : 00000000  r0 : cc7e78c8Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment userControl: 00c5387d  Table: 5bc08008  DAC: 00000015Process test_usb_camera (pid: 77, stack limit = 0xcc7f4268)Stack: (0xcc7f5d30 to 0xcc7f6000)5d20:                                     cc7f5d6c cc7f5d40 c036359c c0352fb05d40: c0363574 cc423000 cc7bc200 cc7e78c8 cc423008 cc7bc200 00000026 cc1271805d60: cc7f5d8c cc7f5d70 c035333c c0363580 00000000 00000000 cc721ac0 cc7e78c85d80: cc7f5dbc cc7f5d90 c00ef5b0 c0353298 cc7f5e2c cc7f5ed0 00000000 cc7bc2005da0: 00000000 cc7e78c8 c00ef490 cc127180 cc7f5df4 cc7f5dc0 c00ead14 c00ef49c5dc0: cc080800 cc40ff00 cc7e78c8 cc7f5ed0 cc7bc200 00000000 cc7bce80 000008025de0: 00000026 00000000 cc7f5e1c cc7f5df8 c00eaf50 c00eabb4 cc7bce80 cc7f5e8c5e00: cc7e78c8 cc7f5ed0 00000000 cc7f5e8c cc7f5e64 cc7f5e20 c00f8488 c00eaef45e20: cc7a3005 c088a480 cc7f5e64 cc40ff00 cc080800 cc7e78c8 cc7f5e64 cc7f5ed05e40: ffffff9c cc7f5f60 cc7f4000 cc7a3000 cc7f4000 cc7f5e8c cc7f5ec4 cc7f5e685e60: c00f992c c00f830c cc7f5e94 00000000 33db2580 00000000 66340397 bee98b705e80: 00000068 00000000 00000000 cc40ff00 cc127180 00000000 00000000 000000015ea0: cc7f5f60 cc7f5ed0 ffffff9c cc7a3000 cc7f4000 ffffff9c cc7f5f54 cc7f5ec85ec0: c00f9d04 c00f9874 00000041 00000000 cc40ff00 cc127180 d9d3cea0 000000065ee0: cc7a3005 cc40f820 cc07cc00 cc7e78c8 00000101 00000000 00000000 000000005f00: 00000000 00000000 00000004 cc7b50c0 cc7b50c8 cc7b50c4 00000000 cc7f40005f20: cc7f5f54 00000803 00000000 00000000 00000001 00000001 00000802 000000005f40: 00000004 cc7a3000 cc7f5f94 cc7f5f58 c00eaa78 c00f9cd8 00000000 000000005f60: 00000802 00000000 00000026 00000100 00000001 bee98e84 00067ecc 000000055f80: c0036ce8 00000000 cc7f5fa4 cc7f5f98 c00eab84 c00ea988 00000000 cc7f5fa85fa0: c0036b40 c00eab6c 00000001 bee98e84 000681c8 00000802 00000000 00085c8c5fc0: 00000001 bee98e84 00067ecc 00000005 bee98d0c 00000000 000874b8 0000000a5fe0: 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[[email protected] /]# [[email protected] /]# 

完善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介面出錯解決方案(轉)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.