内核版本为Linux-2.6.18
这两天在开发板上调试摄像头遇到的些问题:
1、mmap.frame没设定好,造成的错误信息:
the framebuffer device was opened successfully;
error reading fixed information.
640,480, 16bpp,xoffset= 0,yoffset= 0
the framebuffer device was mapped to memory successfully.
/mnt/hgfs/Image/gspcav1-20071224/gspca_core.c: [spca5xx_set_light_freq:1932] Sensor currently not support light frequency banding filters.
/mnt/hgfs/Image/gspcav1-20071224/gspca_core.c: [gspca_set_isoc_ep:945] ISO EndPoint found 0x81 AlternateSet 8
the video device was opened successfully.
Sonix PcCam, Type:1 (((#define VID_TYPE_CAPTURE 1 /* Can capture */)))
Maxwidth:640, Maxheight:480
Minwidth:160, Minheight:120
Channels:1, Audios:0
Unable to handle kernel NULL pointer dereference at virtual address 00000004
pgd = c3c04000
[00000004] *pgd=33884031, *pte=00000000, *ppte=00000000
Internal error: Oops: 817 [#5]
Modules linked in: gspca zlgffs zlgfs
CPU: 0
PC is at prepare_to_wait+0x40/0x6c
LR is at 0xc3a70034
pc : [<c005016c>] lr : [<c3a70034>] Tainted: PF
sp : c3a71df4 ip : c3a71e3c fp : c3a71e04
r10: 00000020 r9 : bf05a2b8 r8 : c3a70000
r7 : c04e4000 r6 : c3a71e30 r5 : 00000002 r4 : 00000001
r3 : 00000000 r2 : 40000013 r1 : c3a71e30 r0 : c04e7bec
Flags: nZCv IRQs off FIQs on Mode SVC_32 Segment user
Control: 717F Table: 33C04000 DAC: 00000015
Process source (pid: 1012, stack limit = 0xc3a70250)
Stack: (0xc3a71df4 to 0xc3a72000)
1de0: c04e59d0 c3a71e6c c3a71e08
1e00: bf020620 c005013c c04e51a8 c3a71f2c c3a71e1c bf02c404 00000000 00000000
1e20: c3480360 c0050270 c3a71e3c c3a71e3c 00000000 c3480360 c0050270 00000000
1e40: c3a71e3c 00000000 beec0d78 fffffff2 00000000 00000000 40047612 00000000
1e60: c3a71f2c c3a71e70 c01753c8 bf01fac4 00000001 00000000 c3a71e84 c04364e0
1e80: c0569870 00000002 000000f0 00000140 00000003 0000002a 00000000 00000000
1ea0: c3a71f28 c3a70000 0000002a c3a71ecc c3a71ebc c3a71ed4 c3a71ec4 c00452fc
1ec0: c00452b8 00000000 c3a71f24 c3a71ed8 c00459fc c3480360 c3a71f0c c3a71edc
1ee0: c3a71edc c3480360 00000001 00000000 00000000 c3a71fb0 c3a70000 0000001e
1f00: c3a71f34 c04364e0 ffffffe7 40047612 00000000 c0025f44 c3a70000 4016864c
1f20: c3a71f40 c3a71f30 bf020a00 c0175218 bf01fab4 c3a71f5c c3a71f44 c008f1bc
1f40: bf0209f4 c04364e0 beec0d78 00000004 c3a71f84 c3a71f60 c008f45c c008f158
1f60: c3a71f8c c0025df4 c04364e0 fffffff7 40047612 00000036 c3a71fa4 c3a71f88
1f80: c008f4bc c008f1dc 00000000 beec0e34 000090d4 00000001 00000000 c3a71fa8
1fa0: c0025da0 c008f48c beec0e34 000090d4 00000004 40047612 beec0d78 beec0d78
1fc0: beec0e34 000090d4 00000001 00009130 00008eac 00000000 4016864c bee2a860
1fe0: 00011530 bee2a848 00008b6c 4010f644 60000010 00000004 ffffffff ffffffff
Backtrace:
[<c005012c>] (prepare_to_wait+0x0/0x6c) from [<bf020620>] (spca5xx_do_ioctl+0xb6c/0xf30 [gspca])
r4 = C04E59D0
[<bf01fab4>] (spca5xx_do_ioctl+0x0/0xf30 [gspca]) from [<c01753c8>] (video_usercopy+0x1c0/0x2b0)
[<c0175208>] (video_usercopy+0x0/0x2b0) from [<bf020a00>] (spca5xx_ioctl+0x1c/0x24 [gspca])
[<bf0209e4>] (spca5xx_ioctl+0x0/0x24 [gspca]) from [<c008f1bc>] (do_ioctl+0x74/0x84)
[<c008f148>] (do_ioctl+0x0/0x84) from [<c008f45c>] (vfs_ioctl+0x290/0x2b0)
r6 = 00000004 r5 = BEEC0D78 r4 = C04364E0
[<c008f1cc>] (vfs_ioctl+0x0/0x2b0) from [<c008f4bc>] (sys_ioctl+0x40/0x5c)
r7 = 00000036 r6 = 40047612 r5 = FFFFFFF7 r4 = C04364E0
[<c008f47c>] (sys_ioctl+0x0/0x5c) from [<c0025da0>] (ret_fast_syscall+0x0/0x2c)
r6 = 00000001 r5 = 000090D4 r4 = BEEC0E34
Code: e153000c 05903000 e3cded7f 0581300c (0583c004)
/mnt/hgfs/Image/gspcav1-20071224/gspca_core.c: [spca50x_move_data:1611] ISOC data error: [0] len=0, status=-18
/mnt/hgfs/Image/gspcav1-20071224/gspca_core.c: [spca50x_move_data:1611] ISOC data error: [1] len=0, status=-18
/mnt/hgfs/Image/gspcav1-20071224/gspca_core.c: [spca50x_move_data:1611] ISOC data error: [2] len=0, status=-18
/mnt/hgfs/Image/gspcav1-20071224/gspca_core.c: [spca50x_move_data:1611] ISOC data error: [3] len=0, status=-18
/mnt/hgfs/Image/gspcav1-20071224/gspca_core.c: [spca50x_move_data:1611] ISOC data error: [4] len=0, status=-18
/mnt/hgfs/Image/gspcav1-20071224/gspca_core.c: [spca50x_move_data:1611] ISOC data error: [5] len=1019, status=-114
【注解】
简单分析:普通摄像头一般都是double frames,因此在使用过程中不能将mmap.frame的值超过1,即可设为0、1,此值为当前摄像头采集帧的序号。
struct video_mmap
{
unsigned int frame; /* Frame (0 - n) for double buffer */
int height,width;
unsigned int format; /* should be VIDEO_PALETTE_* */
};
frame :设置当前是第几帧、height,width:设置图象的高和宽、format :颜色模式