aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorThierry MERLE <thierry.merle@free.fr>2006-12-09 14:42:54 -0500
committerMauro Carvalho Chehab <mchehab@infradead.org>2006-12-10 06:22:53 -0500
commitc876a3468d0f136710af81595177889953d1ff71 (patch)
tree60cbe821d8b0253f17d6e8dd4454388576a89b43 /drivers/media
parentf30ebd43597e9b2bbbc8b0eb650f5aad545e255b (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')
-rw-r--r--drivers/media/video/usbvision/usbvision-core.c1
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c28
-rw-r--r--drivers/media/video/usbvision/usbvision.h7
3 files changed, 26 insertions, 10 deletions
diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c
index e660a91d8251..9163b60c7f91 100644
--- a/drivers/media/video/usbvision/usbvision-core.c
+++ b/drivers/media/video/usbvision/usbvision-core.c
@@ -87,6 +87,7 @@ MODULE_PARM_DESC(SwitchSVideoInput, " Set the S-Video input. Some cables and in
87#define DBG_ISOC 1<<2 87#define DBG_ISOC 1<<2
88#define DBG_PARSE 1<<3 88#define DBG_PARSE 1<<3
89#define DBG_SCRATCH 1<<4 89#define DBG_SCRATCH 1<<4
90#define DBG_FUNC 1<<5
90 91
91static const int max_imgwidth = MAX_FRAME_WIDTH; 92static const int max_imgwidth = MAX_FRAME_WIDTH;
92static const int max_imgheight = MAX_FRAME_HEIGHT; 93static const int max_imgheight = MAX_FRAME_HEIGHT;
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 ) {
diff --git a/drivers/media/video/usbvision/usbvision.h b/drivers/media/video/usbvision/usbvision.h
index f2eeda8326ff..0e7e3d653cac 100644
--- a/drivers/media/video/usbvision/usbvision.h
+++ b/drivers/media/video/usbvision/usbvision.h
@@ -3,9 +3,14 @@
3 * usbvision header file 3 * usbvision header file
4 * 4 *
5 * Copyright (c) 1999-2005 Joerg Heckenbach <joerg@heckenbach-aw.de> 5 * Copyright (c) 1999-2005 Joerg Heckenbach <joerg@heckenbach-aw.de>
6 * Dwaine Garden <dwainegarden@rogers.com>
7 *
8 *
9 * Report problems to v4l MailingList : http://www.redhat.com/mailman/listinfo/video4linux-list
6 * 10 *
7 * This module is part of usbvision driver project. 11 * This module is part of usbvision driver project.
8 * Updates to driver completed by Dwaine P. Garden 12 * Updates to driver completed by Dwaine P. Garden
13 * v4l2 conversion by Thierry Merle <thierry.merle@free.fr>
9 * 14 *
10 * This program is free software; you can redistribute it and/or modify 15 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by 16 * it under the terms of the GNU General Public License as published by
@@ -32,6 +37,8 @@
32#include <media/tuner.h> 37#include <media/tuner.h>
33#include <linux/videodev2.h> 38#include <linux/videodev2.h>
34 39
40#define USBVISION_DEBUG /* Turn on debug messages */
41
35#ifndef VID_HARDWARE_USBVISION 42#ifndef VID_HARDWARE_USBVISION
36 #define VID_HARDWARE_USBVISION 34 /* USBVision Video Grabber */ 43 #define VID_HARDWARE_USBVISION 34 /* USBVision Video Grabber */
37#endif 44#endif