# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher.
# This patch includes the following deltas:
#	           ChangeSet	1.495   -> 1.496  
#	drivers/usb/media/usbvideo.h	1.13    -> 1.14   
#	drivers/usb/media/usbvideo.c	1.22    -> 1.23   
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 02/08/18	spse@secret.org.uk	1.496
# [PATCH] add callback for VIDIOCSWIN ioctl to usbvideo
# 
# This patch adds a callback for VIDIOCSWIN ioctl to usbvideo so
# the webcam miniport drivers can implement handling for the ioctl.
# 
# It also makes VIDIOCGWIN return the frame size for the current
# mode rather than the canvas size. For current drivers
# uvd->canvas == uvd->videosize since the frame size is set
# when the module is loaded.
# --------------------------------------------
#
diff -Nru a/drivers/usb/media/usbvideo.c b/drivers/usb/media/usbvideo.c
--- a/drivers/usb/media/usbvideo.c	Sun Aug 18 20:48:16 2002
+++ b/drivers/usb/media/usbvideo.c	Sun Aug 18 20:48:16 2002
@@ -1468,6 +1468,10 @@
 		{
 			struct video_window *vw = arg;
 
+			if(VALID_CALLBACK(uvd, setVideoMode)) {
+				return GET_CALLBACK(uvd, setVideoMode)(uvd, vw);
+			}
+
 			if (vw->flags)
 				return -EINVAL;
 			if (vw->clipcount)
@@ -1485,8 +1489,8 @@
 
 			vw->x = 0;
 			vw->y = 0;
-			vw->width = VIDEOSIZE_X(uvd->canvas);
-			vw->height = VIDEOSIZE_Y(uvd->canvas);
+			vw->width = VIDEOSIZE_X(uvd->videosize);
+			vw->height = VIDEOSIZE_Y(uvd->videosize);
 			vw->chromakey = 0;
 			if (VALID_CALLBACK(uvd, getFPS))
 				vw->flags = GET_CALLBACK(uvd, getFPS)(uvd);
diff -Nru a/drivers/usb/media/usbvideo.h b/drivers/usb/media/usbvideo.h
--- a/drivers/usb/media/usbvideo.h	Sun Aug 18 20:48:16 2002
+++ b/drivers/usb/media/usbvideo.h	Sun Aug 18 20:48:16 2002
@@ -272,6 +272,7 @@
 	int (*procfs_write)(struct file *file,const char *buffer,unsigned long count,void *data);
 	int (*startDataPump)(uvd_t *uvd);
 	void (*stopDataPump)(uvd_t *uvd);
+	int (*setVideoMode)(uvd_t *uvd, struct video_window *vw);
 } usbvideo_cb_t;
 
 struct s_usbvideo_t {
