diff options
author | Thierry MERLE <thierry.merle@free.fr> | 2006-12-09 14:42:54 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2006-12-10 06:22:53 -0500 |
commit | c876a3468d0f136710af81595177889953d1ff71 (patch) | |
tree | 60cbe821d8b0253f17d6e8dd4454388576a89b43 /drivers/media/video/usbvision/usbvision-video.c | |
parent | f30ebd43597e9b2bbbc8b0eb650f5aad545e255b (diff) |
V4L/DVB (4953): Usbvision minor fixes
- fix debug outputs
- fix returned parameters on VIDIOC_G_FMT, VIDIOC_S_FMT and
VIDIOC_TRY_FMT and mmap size setting
Signed-off-by: Thierry MERLE <thierry.merle@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/usbvision/usbvision-video.c')
-rw-r--r-- | drivers/media/video/usbvision/usbvision-video.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index 3f3839be561f..864446c012eb 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -92,8 +92,6 @@ | |||
92 | #define ENABLE_HEXDUMP 0 /* Enable if you need it */ | 92 | #define ENABLE_HEXDUMP 0 /* Enable if you need it */ |
93 | 93 | ||
94 | 94 | ||
95 | #define USBVISION_DEBUG /* Turn on debug messages */ | ||
96 | |||
97 | #ifdef USBVISION_DEBUG | 95 | #ifdef USBVISION_DEBUG |
98 | #define PDEBUG(level, fmt, args...) \ | 96 | #define PDEBUG(level, fmt, args...) \ |
99 | if (video_debug & (level)) info("[%s:%d] " fmt, __PRETTY_FUNCTION__, __LINE__ , ## args) | 97 | if (video_debug & (level)) info("[%s:%d] " fmt, __PRETTY_FUNCTION__, __LINE__ , ## args) |
@@ -104,7 +102,7 @@ | |||
104 | #define DBG_IOCTL 1<<0 | 102 | #define DBG_IOCTL 1<<0 |
105 | #define DBG_IO 1<<1 | 103 | #define DBG_IO 1<<1 |
106 | #define DBG_PROBE 1<<2 | 104 | #define DBG_PROBE 1<<2 |
107 | #define DBG_FUNC 1<<3 | 105 | #define DBG_MMAP 1<<3 |
108 | 106 | ||
109 | //String operations | 107 | //String operations |
110 | #define rmspace(str) while(*str==' ') str++; | 108 | #define rmspace(str) while(*str==' ') str++; |
@@ -821,7 +819,7 @@ static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
821 | 819 | ||
822 | vb->memory = V4L2_MEMORY_MMAP; | 820 | vb->memory = V4L2_MEMORY_MMAP; |
823 | vb->field = V4L2_FIELD_NONE; | 821 | vb->field = V4L2_FIELD_NONE; |
824 | vb->length = usbvision->max_frame_size; | 822 | vb->length = usbvision->curwidth*usbvision->curheight*usbvision->palette.bytes_per_pixel; |
825 | vb->timestamp = usbvision->frame[vb->index].timestamp; | 823 | vb->timestamp = usbvision->frame[vb->index].timestamp; |
826 | vb->sequence = usbvision->frame[vb->index].sequence; | 824 | vb->sequence = usbvision->frame[vb->index].sequence; |
827 | return 0; | 825 | return 0; |
@@ -959,13 +957,14 @@ static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
959 | vf->fmt.pix.sizeimage = vf->fmt.pix.bytesperline*usbvision->curheight; | 957 | vf->fmt.pix.sizeimage = vf->fmt.pix.bytesperline*usbvision->curheight; |
960 | vf->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; | 958 | vf->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M; |
961 | vf->fmt.pix.field = V4L2_FIELD_NONE; /* Always progressive image */ | 959 | vf->fmt.pix.field = V4L2_FIELD_NONE; /* Always progressive image */ |
960 | PDEBUG(DBG_IOCTL, "VIDIOC_G_FMT w=%d, h=%d, format=%s", | ||
961 | vf->fmt.pix.width, vf->fmt.pix.height,usbvision->palette.desc); | ||
962 | return 0; | ||
962 | } | 963 | } |
963 | return 0; | ||
964 | default: | 964 | default: |
965 | PDEBUG(DBG_IOCTL, "VIDIOC_G_FMT invalid type %d",vf->type); | 965 | PDEBUG(DBG_IOCTL, "VIDIOC_G_FMT invalid type %d",vf->type); |
966 | return -EINVAL; | 966 | return -EINVAL; |
967 | } | 967 | } |
968 | PDEBUG(DBG_IOCTL, "VIDIOC_G_FMT w=%d, h=%d",vf->fmt.win.w.width, vf->fmt.win.w.height); | ||
969 | return 0; | 968 | return 0; |
970 | } | 969 | } |
971 | case VIDIOC_TRY_FMT: | 970 | case VIDIOC_TRY_FMT: |
@@ -991,6 +990,15 @@ static int usbvision_v4l2_do_ioctl(struct inode *inode, struct file *file, | |||
991 | RESTRICT_TO_RANGE(vf->fmt.pix.width, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH); | 990 | RESTRICT_TO_RANGE(vf->fmt.pix.width, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH); |
992 | RESTRICT_TO_RANGE(vf->fmt.pix.height, MIN_FRAME_HEIGHT, MAX_FRAME_HEIGHT); | 991 | RESTRICT_TO_RANGE(vf->fmt.pix.height, MIN_FRAME_HEIGHT, MAX_FRAME_HEIGHT); |
993 | 992 | ||
993 | vf->fmt.pix.bytesperline = vf->fmt.pix.width*usbvision->palette.bytes_per_pixel; | ||
994 | vf->fmt.pix.sizeimage = vf->fmt.pix.bytesperline*vf->fmt.pix.height; | ||
995 | |||
996 | if(cmd == VIDIOC_TRY_FMT) { | ||
997 | PDEBUG(DBG_IOCTL, "VIDIOC_TRY_FMT grabdisplay w=%d, h=%d, format=%s", | ||
998 | vf->fmt.pix.width, vf->fmt.pix.height,usbvision->palette.desc); | ||
999 | return 0; | ||
1000 | } | ||
1001 | |||
994 | /* stop io in case it is already in progress */ | 1002 | /* stop io in case it is already in progress */ |
995 | if(usbvision->streaming == Stream_On) { | 1003 | if(usbvision->streaming == Stream_On) { |
996 | if ((ret = usbvision_stream_interrupt(usbvision))) | 1004 | if ((ret = usbvision_stream_interrupt(usbvision))) |
@@ -1133,7 +1141,7 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma) | |||
1133 | } | 1141 | } |
1134 | 1142 | ||
1135 | if (!(vma->vm_flags & VM_WRITE) || | 1143 | if (!(vma->vm_flags & VM_WRITE) || |
1136 | size != PAGE_ALIGN(usbvision->max_frame_size)) { | 1144 | size != PAGE_ALIGN(usbvision->curwidth*usbvision->curheight*usbvision->palette.bytes_per_pixel)) { |
1137 | up(&usbvision->lock); | 1145 | up(&usbvision->lock); |
1138 | return -EINVAL; | 1146 | return -EINVAL; |
1139 | } | 1147 | } |
@@ -1143,7 +1151,7 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma) | |||
1143 | break; | 1151 | break; |
1144 | } | 1152 | } |
1145 | if (i == USBVISION_NUMFRAMES) { | 1153 | if (i == USBVISION_NUMFRAMES) { |
1146 | PDEBUG(DBG_FUNC, "mmap: user supplied mapping address is out of range"); | 1154 | PDEBUG(DBG_MMAP, "mmap: user supplied mapping address is out of range"); |
1147 | up(&usbvision->lock); | 1155 | up(&usbvision->lock); |
1148 | return -EINVAL; | 1156 | return -EINVAL; |
1149 | } | 1157 | } |
@@ -1156,7 +1164,7 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma) | |||
1156 | while (size > 0) { | 1164 | while (size > 0) { |
1157 | 1165 | ||
1158 | if (vm_insert_page(vma, start, vmalloc_to_page(pos))) { | 1166 | if (vm_insert_page(vma, start, vmalloc_to_page(pos))) { |
1159 | PDEBUG(DBG_FUNC, "mmap: vm_insert_page failed"); | 1167 | PDEBUG(DBG_MMAP, "mmap: vm_insert_page failed"); |
1160 | up(&usbvision->lock); | 1168 | up(&usbvision->lock); |
1161 | return -EAGAIN; | 1169 | return -EAGAIN; |
1162 | } | 1170 | } |
@@ -2003,7 +2011,7 @@ static int __init usbvision_init(void) | |||
2003 | PDEBUG(DBG_IOCTL, "IOCTL debugging is enabled [video]"); | 2011 | PDEBUG(DBG_IOCTL, "IOCTL debugging is enabled [video]"); |
2004 | PDEBUG(DBG_IO, "IO debugging is enabled [video]"); | 2012 | PDEBUG(DBG_IO, "IO debugging is enabled [video]"); |
2005 | PDEBUG(DBG_PROBE, "PROBE debugging is enabled [video]"); | 2013 | PDEBUG(DBG_PROBE, "PROBE debugging is enabled [video]"); |
2006 | PDEBUG(DBG_FUNC, "FUNC debugging is enabled [video]"); | 2014 | PDEBUG(DBG_MMAP, "MMAP debugging is enabled [video]"); |
2007 | 2015 | ||
2008 | /* disable planar mode support unless compression enabled */ | 2016 | /* disable planar mode support unless compression enabled */ |
2009 | if (isocMode != ISOC_MODE_COMPRESS ) { | 2017 | if (isocMode != ISOC_MODE_COMPRESS ) { |