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

2010-02-14 Thread Antoine Jacquet

Hi,

Someone reported similar behavior recently, and was apparently able to 
fix the issue by adding more delay between open/close sequences.


No search tags to find it on the list, can You remember device model?


Yes, this was an off-list discussion, available here:
http://royale.zerezo.com/forum/viewtopic.php?t=355

Didn't work, same -110 errors, sorry, no v4l-dvb git here, vdr 
production machine on 2.6.32.7.


Just checked and the differences in the zr364xx driver are minor.
Would be better if you could work on LinuxTV hg/git tree so we have the 
same basis for patches.


1. Patch with optimized delay below, slow but works, 1st try was 
delaying subsequent msg at open sequence i=6, worked until the last 2 
open() before capture start.
From the windows snoopy log I sent yesterday I can see only 1-2 URBs 
with relevant delay of ~1s but 

cannot see the sequence point.


Ok this is a bit hardcore but nice if it works.
What do you mean by until the last 2 open()?
Also, you may want to try with simpler tools like dd to do only one 
clean open/close.
Ekiga/Cheese/Skype tend to do many open/close and this may not be the 
ideal tools for debugging, but great to trigger the bugs ;-)



What is error -22, can not find it in errno.h?


I think it's -EINVAL.

2. Picture with (640-320) lines alignment error with ekiga+cheese 
*attached*, wether cam is configured internally for 640x480 or 320x240, 
not affecting.
setting the driver to mode=2 fails with libv4l jpeg decoding errors. I 
try to correct this.


Do you know if the Windows driver support this mode?
If so, it would be helpful to have the snoop too.

3. Driver oops on modprobe -r or device firmware crash, I need to unplug 
first or null pointer fault occours (mutex locks), see below


Ok that's bad, let me know if you find the issue.

Regards,

Antoine


--
Antoine Royale Jacquet
http://royale.zerezo.com
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2010-02-12 Thread thomas schorpp

Hi Antoine,

Antoine Jacquet wrote:

Hi Thomas,

Looks like the device does not like to be fed with the (full) init 
METHOD2 on every open()...

Since the VIDIOC_QUERYCAP worked it should not be the wrong METHOD.


Someone reported similar behavior recently, and was apparently able to 
fix the issue by adding more delay between open/close sequences.


No search tags to find it on the list, can You remember device model?



Could you try the attached patch to see if it solves the issue?


Didn't work, same -110 errors, sorry, no v4l-dvb git here, vdr production 
machine on 2.6.32.7.



If not, we can also try to add some mdelay() after each usb_control_msg().


1. Patch with optimized delay below, slow but works, 1st try was delaying subsequent msg 
at open sequence i=6, worked until the last 2 open() before capture start.
From the windows snoopy log I sent yesterday I can see only 1-2 URBs with relevant delay of ~1s but 

cannot see the sequence point.

What is error -22, can not find it in errno.h?

2. Picture with (640-320) lines alignment error with ekiga+cheese 
*attached*, wether cam is configured internally for 640x480 or 320x240, not affecting.

setting the driver to mode=2 fails with libv4l jpeg decoding errors. I try to 
correct this.

3. Driver oops on modprobe -r or device firmware crash, 
I need to unplug first or null pointer fault occours (mutex locks), see below




Regards,

Antoine



y
tom

--- drivers/media/video/zr364xx.c.orig  2009-12-18 23:27:07.0 +0100
+++ drivers/media/video/zr364xx.c   2010-02-12 12:57:54.0 +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,


usb 1-2: new high speed USB device using ehci_hcd and address 7
usb 1-2: New USB device found, idVendor=08ca, idProduct=2062
usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-2: Product: DV 8800
usb 1-2: Manufacturer: AIPTEK
usb 1-2: configuration #1 chosen from 1 choice
zr364xx probing...
zr364xx 1-2:1.0: Zoran 364xx compatible webcam plugged
zr364xx 1-2:1.0: model 08ca:2062 detected
usb 1-2: 320x240 mode selected
zr364xx dev: 880039379000, udev 8800388d1800 interface 880039380a00
zr364xx num endpoints 3
zr364xx board init: 880039379000
zr364xx valloc 880039379028, idx 0, pdata c900019ef000
zr364xx zr364xx_start_readpipe: start pipe IN x81
zr364xx submitting URB 8800393a1900
zr364xx : board initialized
usb 1-2: Zoran 364xx controlling 

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

2010-02-11 Thread thomas schorpp
Hi, 


Linux 2.6.30+32.x

Great there's a driver but seems to be untested/stub for this device:

usb 1-2: new high speed USB device using ehci_hcd and address 9
usb 1-2: New USB device found, idVendor=08ca, idProduct=2062
usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
usb 1-2: Product: DV 8800
usb 1-2: Manufacturer: AIPTEK
usb 1-2: configuration #1 chosen from 1 choice
zr364xx probing...
zr364xx 1-2:1.0: Zoran 364xx compatible webcam plugged
zr364xx 1-2:1.0: model 08ca:2062 detected
usb 1-2: 320x240 mode selected
zr364xx dev: 88001eb62000, udev 88001e84c000 interface 88001ea35400
zr364xx num endpoints 3
zr364xx board init: 88001eb62000
zr364xx valloc 88001eb62028, idx 0, pdata c900039d9000
zr364xx zr364xx_start_readpipe: start pipe IN x81
zr364xx submitting URB 88001eafccc0
zr364xx : board initialized
usb 1-2: Zoran 364xx controlling video device 3
zr364xx zr364xx_open
zr364xx zr364xx_open: 0
Zoran 364xx: VIDIOC_QUERYCAP driver=Zoran 364xx, card=DV 8800, bus=1-2, 
version=0x0703, capabilities=0x0501
zr364xx zr364xx_release
zr364xx zr364xx_open
usb 1-2: Failed sending control message, error -110.
usb 1-2: error during open sequence: 6
zr364xx zr364xx_open: -110
usb 1-2: USB disconnect, address 9
zr364xx read_pipe_completion, err shutdown
zr364xx 1-2:1.0: Zoran 364xx webcam unplugged
zr364xx stop read pipe
zr364xx vfree c900039d9000

Same with mode=2 like the cam is configured (VGA+QVGA available in settings).

I'll sniff out the cmd sequences on an old win xp32 installation, no x64/vista/7 drivers found, 
or do You see the failure reason already?


Looks like the device does not like to be fed with the (full) init METHOD2 on 
every open()...
Since the VIDIOC_QUERYCAP worked it should not be the wrong METHOD.

y
tom

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


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

2010-02-11 Thread Antoine Jacquet

Hi Thomas,

Looks like the device does not like to be fed with the (full) init 
METHOD2 on every open()...

Since the VIDIOC_QUERYCAP worked it should not be the wrong METHOD.


Someone reported similar behavior recently, and was apparently able to 
fix the issue by adding more delay between open/close sequences.


Could you try the attached patch to see if it solves the issue?

If not, we can also try to add some mdelay() after each usb_control_msg().

Regards,

Antoine

--
Antoine Royale Jacquet
http://royale.zerezo.com
diff -r 77e731753c15 linux/drivers/media/video/zr364xx.c
--- a/linux/drivers/media/video/zr364xx.c	Thu Feb 11 12:02:16 2010 -0200
+++ b/linux/drivers/media/video/zr364xx.c	Thu Feb 11 16:01:44 2010 +0100
@@ -1005,7 +1005,7 @@
 	/* Added some delay here, since opening/closing the camera quickly,
 	 * like Ekiga does during its startup, can crash the webcam
 	 */
-	mdelay(100);
+	mdelay(200);
 	cam-skip = 2;
 	ret = 0;
 
@@ -1310,7 +1310,7 @@
 	/* Added some delay here, since opening/closing the camera quickly,
 	 * like Ekiga does during its startup, can crash the webcam
 	 */
-	mdelay(100);
+	mdelay(200);
 	err = 0;
 
 out:
@@ -1396,7 +1396,7 @@
 	/* Added some delay here, since opening/closing the camera quickly,
 	 * like Ekiga does during its startup, can crash the webcam
 	 */
-	mdelay(100);
+	mdelay(200);
 	err = 0;
 
 out: