diff mbox

zr364xx: Aiptek DV8800 (neo): 08ca:2062: Fails on subsequent zr364xx_open()

Message ID 4B7567CB.20609@gmail.com (mailing list archive)
State RFC
Headers show

Commit Message

thomas schorpp Feb. 12, 2010, 2:38 p.m. UTC
None
diff mbox

Patch

--- drivers/media/video/zr364xx.c.orig	2009-12-18 23:27:07.000000000 +0100
+++ drivers/media/video/zr364xx.c	2010-02-12 12:57:54.000000000 +0100
@@ -205,40 +205,41 @@ 
 struct zr364xx_buffer {
 	/* common v4l buffer stuff -- must be first */
 	struct videobuf_buffer vb;
 	const struct zr364xx_fmt *fmt;
 };
 
 /* function used to send initialisation commands to the camera */
 static int send_control_msg(struct usb_device *udev, u8 request, u16 value,
 			    u16 index, unsigned char *cp, u16 size)
 {
 	int status;
 
 	unsigned char *transfer_buffer = kmalloc(size, GFP_KERNEL);
 	if (!transfer_buffer) {
 		dev_err(&udev->dev, "kmalloc(%d) failed\n", size);
 		return -ENOMEM;
 	}
 
 	memcpy(transfer_buffer, cp, size);
 
+	mdelay(300);
 	status = usb_control_msg(udev,
 				 usb_sndctrlpipe(udev, 0),
 				 request,
 				 USB_DIR_OUT | USB_TYPE_VENDOR |
 				 USB_RECIP_DEVICE, value, index,
 				 transfer_buffer, size, CTRL_TIMEOUT);
 
 	kfree(transfer_buffer);
 
 	if (status < 0)
 		dev_err(&udev->dev,
 			"Failed sending control message, error %d.\n", status);
 
 	return status;
 }
 
 
 /* Control messages sent to the camera to initialize it
  * and launch the capture */
 typedef struct {
@@ -1248,40 +1249,41 @@ 
 
 
 /* open the camera */
 static int zr364xx_open(struct file *file)
 {
 	struct video_device *vdev = video_devdata(file);
 	struct zr364xx_camera *cam = video_drvdata(file);
 	struct usb_device *udev = cam->udev;
 	int i, err;
 
 	DBG("%s\n", __func__);
 
 	mutex_lock(&cam->open_lock);
 
 	if (cam->users) {
 		err = -EBUSY;
 		goto out;
 	}
 
 	for (i = 0; init[cam->method][i].size != -1; i++) {
+//		if (i == 6) mdelay(1000);
 		err =
 		    send_control_msg(udev, 1, init[cam->method][i].value,
 				     0, init[cam->method][i].bytes,
 				     init[cam->method][i].size);
 		if (err < 0) {
 			dev_err(&cam->udev->dev,
 				"error during open sequence: %d\n", i);
 			goto out;
 		}
 	}
 
 	cam->skip = 2;
 	cam->users++;
 	file->private_data = vdev;
 	cam->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	cam->fmt = formats;
 
 	videobuf_queue_vmalloc_init(&cam->vb_vidq, &zr364xx_video_qops,
 				    NULL, &cam->slock,
 				    cam->type,