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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.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,


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: ffff880039379000, udev ffff8800388d1800 interface ffff880039380a00
zr364xx num endpoints 3
zr364xx board init: ffff880039379000
zr364xx valloc ffff880039379028, idx 0, pdata ffffc900019ef000
zr364xx zr364xx_start_readpipe: start pipe IN x81
zr364xx submitting URB ffff8800393a1900
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=0x00000703, capabilities=0x05000001
zr364xx zr364xx_release
zr364xx zr364xx_open
zr364xx zr364xx_open: 0
zr364xx zr364xx_release
zr364xx zr364xx_open
zr364xx zr364xx_open: 0
Zoran 364xx: VIDIOC_QUERYCAP driver=Zoran 364xx, card=DV 8800, bus=1-2, version=0x00000703, capabilities=0x05000001
zr364xx zr364xx_release
zr364xx zr364xx_open
zr364xx zr364xx_open: 0
zr364xx zr364xx_release
zr364xx zr364xx_open
zr364xx zr364xx_open: 0
Zoran 364xx: VIDIOC_QUERYCAP driver=Zoran 364xx, card=DV 8800, bus=1-2, version=0x00000703, capabilities=0x05000001
Zoran 364xx: VIDIOC_ENUMINPUT index=0, name=Zoran 364xx Camera, type=2, audioset=0, tuner=0, std=00000000, status=0
Zoran 364xx: VIDIOC_ENUMINPUT error -22
Zoran 364xx: VIDIOC_ENUM_FMT index=0, type=1, flags=1, pixelformat=JPEG, description='JPG'
Zoran 364xx: VIDIOC_TRY_FMT type=vid-cap
zr364xx zr364xx_vidioc_try_fmt_vid_cap: V4L2_PIX_FMT_JPEG (1) ok!
Zoran 364xx: width=320, height=240, format=JPEG, field=none, bytesperline=640 sizeimage=153600, colorspace=0
zr364xx zr364xx_release
zr364xx zr364xx_open
zr364xx zr364xx_open: 0
zr364xx zr364xx_release
zr364xx zr364xx_open
zr364xx zr364xx_open: 0
Zoran 364xx: VIDIOC_QUERYCAP driver=Zoran 364xx, card=DV 8800, bus=1-2, version=0x00000703, capabilities=0x05000001
zr364xx zr364xx_release
zr364xx zr364xx_open
zr364xx zr364xx_open: 0
zr364xx zr364xx_release
zr364xx zr364xx_open
zr364xx zr364xx_open: 0
Zoran 364xx: VIDIOC_QUERYCAP driver=Zoran 364xx, card=DV 8800, bus=1-2, version=0x00000703, capabilities=0x05000001
zr364xx zr364xx_release
zr364xx zr364xx_open
zr364xx zr364xx_open: 0
Zoran 364xx: VIDIOC_QUERYCAP driver=Zoran 364xx, card=DV 8800, bus=1-2, version=0x00000703, capabilities=0x05000001
Zoran 364xx: VIDIOC_G_FMT type=vid-cap
Zoran 364xx: width=320, height=240, format=JPEG, field=none, bytesperline=640 sizeimage=153600, colorspace=0
Zoran 364xx: VIDIOC_ENUM_FMT index=0, type=1, flags=1, pixelformat=JPEG, description='JPG'
Zoran 364xx: VIDIOC_ENUM_FRAMESIZES error -22
Zoran 364xx: VIDIOC_ENUM_FMT error -22
Zoran 364xx: VIDIOC_QUERYCAP driver=Zoran 364xx, card=DV 8800, bus=1-2, version=0x00000703, capabilities=0x05000001
Zoran 364xx: VIDIOC_G_INPUT value=0
Zoran 364xx: VIDIOC_ENUMINPUT index=0, name=Zoran 364xx Camera, type=2, audioset=0, tuner=0, std=00000000, status=0
Zoran 364xx: VIDIOC_QUERYCTRL id=0x80000000
Zoran 364xx: VIDIOC_QUERYCTRL error -22
Zoran 364xx: VIDIOC_QUERYCAP driver=Zoran 364xx, card=DV 8800, bus=1-2, version=0x00000703, capabilities=0x05000001
Zoran 364xx: VIDIOC_G_PARM type=1
Zoran 364xx: VIDIOC_G_PARM error -22
Zoran 364xx: VIDIOC_S_STD std=000000ff
Zoran 364xx: VIDIOC_S_STD error -22
Zoran 364xx: VIDIOC_ENUMINPUT index=0, name=Zoran 364xx Camera, type=2, audioset=0, tuner=0, std=00000000, status=0
Zoran 364xx: VIDIOC_ENUMINPUT error -22
Zoran 364xx: VIDIOC_S_INPUT value=0
Zoran 364xx: VIDIOC_QUERYBUF error -22
Zoran 364xx: VIDIOC_G_PARM type=1
Zoran 364xx: VIDIOC_G_PARM error -22
Zoran 364xx: VIDIOC_TRY_FMT type=vid-cap
zr364xx zr364xx_vidioc_try_fmt_vid_cap: V4L2_PIX_FMT_JPEG (1) ok!
Zoran 364xx: width=320, height=240, format=JPEG, field=none, bytesperline=640 sizeimage=153600, colorspace=0
Zoran 364xx: VIDIOC_TRY_FMT type=vid-cap
zr364xx zr364xx_vidioc_try_fmt_vid_cap: V4L2_PIX_FMT_JPEG (1) ok!
Zoran 364xx: width=320, height=240, format=JPEG, field=none, bytesperline=640 sizeimage=153600, colorspace=0
Zoran 364xx: VIDIOC_TRY_FMT type=vid-cap
zr364xx zr364xx_vidioc_try_fmt_vid_cap: V4L2_PIX_FMT_JPEG (1) ok!
Zoran 364xx: width=320, height=240, format=JPEG, field=none, bytesperline=640 sizeimage=153600, colorspace=0
Zoran 364xx: VIDIOC_QUERYBUF error -22
Zoran 364xx: VIDIOC_G_PARM type=1
Zoran 364xx: VIDIOC_G_PARM error -22
Zoran 364xx: VIDIOC_REQBUFS count=4, type=vid-cap, memory=mmap
Zoran 364xx: VIDIOC_QUERYBUF 00:00:00.00000000 index=0, type=vid-cap, bytesused=0, flags=0x00000000, field=0, sequence=0, memory=mmap, offset/userptr=0x00000000, length=233472
...
Zoran 364xx: VIDIOC_QUERYBUF 351661:46:32.00475137 index=3, type=vid-cap, bytesused=230400, flags=0x00000001, field=1, sequence=9, memory=mmap, offset/userptr=0x000ab000, length=233472
Zoran 364xx: timecode=00:00:00 type=0, flags=0x00000000, frames=0, userbits=0x00000000
Zoran 364xx: VIDIOC_QUERYBUF error -22
zr364xx zr364xx_release
usb 1-2: USB disconnect, address 7
zr364xx read_pipe_completion, err shutdown
zr364xx 1-2:1.0: Zoran 364xx webcam unplugged
zr364xx stop read pipe
zr364xx vfree ffffc900019ef000


Feb 12 07:35:17 tom1 kernel: usb 1-2: USB disconnect, address 9
Feb 12 07:35:17 tom1 kernel: zr364xx read_pipe_completion, err shutdown
Feb 12 07:35:17 tom1 kernel: BUG: unable to handle kernel NULL pointer dereference at (null)
Feb 12 07:35:17 tom1 kernel: IP: [<ffffffff8160f168>] __mutex_lock_slowpath+0x48/0x140
Feb 12 07:35:17 tom1 kernel: PGD 3cf8f067 PUD 2fd36067 PMD 0 Feb 12 07:35:17 tom1 kernel: Oops: 0002 [#1] PREEMPT Feb 12 07:35:17 tom1 kernel: last sysfs file: /sys/devices/platform/w83627hf.656/fan2_input Feb 12 07:35:17 tom1 kernel: CPU 0 Feb 12 07:35:17 tom1 kernel: Modules linked in: zr364xx videobuf_vmalloc isofs ehci_hcd dvb_usb_dibusb_mc dvb_usb_dibusb_common dib3000mc dibx000_common dvb_usb mt2060 radeon ttm drm_kms_helper drm i2c_algo_bit cfbcopyarea cfbimgblt cfbfillrect ppdev lp parport sco bridge stp llc bnep l2cap bluetooth rfkill battery cpufreq_userspace cpufreq_powersave cpufreq_conservative cpufreq_stats cpufreq_ondemand freq_table nfsd nfs lockd sunrpc ipv6 af_packet joydev hid_sunplus fuse w83627hf hwmon_vid usbhid snd_usb_audio hid snd_usb_lib uvcvideo snd_hwdep ves1820 snd_via82xx gameport snd_ac97_codec ac97_bus snd_pcm_oss snd_mixer_oss snd_pcm dvb_ttpci snd_page_alloc snd_mpu401_uart tda10021 snd_seq_dummy snd_seq_oss snd_seq_midi snd_rawmidi snd_seq_midi_event budget_av budget_core saa7146_vv uhci_hcd snd_seq videodev v4l1_compat v4l2_compat_ioctl32 videobuf_dma_sg snd_timer snd_seq_device videobuf_core dvb_core psmouse ohci1394 k8temp saa7146 snd ttpci_eeprom usbcore rtc_cmos evdev proc
essor thermal hwmon button serio_r
Feb 12 07:35:17 tom1 kernel: w pcspkr ieee1394 i2c_viapro sata_promise r8169 mii soundcore i2c_core unix [last unloaded: videobuf_vmalloc]
Feb 12 07:35:17 tom1 kernel: Pid: 1474, comm: khubd Not tainted 2.6.32.7 #4 MS-6702E
Feb 12 07:35:17 tom1 kernel: RIP: 0010:[<ffffffff8160f168>]  [<ffffffff8160f168>] __mutex_lock_slowpath+0x48/0x140
Feb 12 07:35:17 tom1 kernel: RSP: 0018:ffff88003da73b50  EFLAGS: 00010213
Feb 12 07:35:17 tom1 kernel: RAX: ffff88003da73b50 RBX: ffff880001e0a500 RCX: ffff88003ba3fc00
Feb 12 07:35:17 tom1 kernel: RDX: 0000000000000000 RSI: 0000000000000083 RDI: 0000000000000001
Feb 12 07:35:17 tom1 kernel: RBP: ffff88003da73ba0 R08: 0000000000000000 R09: 00000000000043c1
Feb 12 07:35:17 tom1 kernel: R10: 0000000000000000 R11: 0000000000000000 R12: ffff88002c514000
Feb 12 07:35:17 tom1 kernel: R13: ffff88003df95320 R14: ffff880019289800 R15: ffff880001e0a508
Feb 12 07:35:17 tom1 kernel: FS:  00007f0a41208910(0000) GS:ffffffff817e6000(0000) knlGS:0000000000000000
Feb 12 07:35:17 tom1 kernel: CS:  0010 DS: 0018 ES: 0018 CR0: 000000008005003b
Feb 12 07:35:17 tom1 kernel: CR2: 0000000000000000 CR3: 000000003ebde000 CR4: 00000000000006f0
Feb 12 07:35:17 tom1 kernel: DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
Feb 12 07:35:17 tom1 kernel: DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
Feb 12 07:35:17 tom1 kernel: Process khubd (pid: 1474, threadinfo ffff88003da72000, task ffff88003df95320)
Feb 12 07:35:17 tom1 kernel: Stack:
Feb 12 07:35:17 tom1 kernel:  ffff880001e0a508 0000000000000000 ffff88003da73b88 ffff88003da73fd8
Feb 12 07:35:17 tom1 kernel: <0> ffff88003da73fd8 ffff880001e0a500 ffff88002c514000 ffff880001e0a400
Feb 12 07:35:17 tom1 kernel: <0> ffff880019289800 ffff880019289890 ffff88003da73bb0 ffffffff8160f08d
Feb 12 07:35:17 tom1 kernel: Call Trace:
Feb 12 07:35:17 tom1 kernel:  [<ffffffff8160f08d>] mutex_lock+0xd/0x10
Feb 12 07:35:17 tom1 kernel:  [<ffffffffa01645b9>] videobuf_mmap_free+0x19/0x40 [videobuf_core]
Feb 12 07:35:17 tom1 kernel:  [<ffffffffa01bb12b>] zr364xx_disconnect+0x2b/0x1a0 [zr364xx]
Feb 12 07:35:17 tom1 kernel:  [<ffffffffa00bc78c>] usb_unbind_interface+0xac/0x100 [usbcore]
Feb 12 07:35:17 tom1 kernel:  [<ffffffff814690f0>] __device_release_driver+0x70/0xd0
Feb 12 07:35:17 tom1 kernel:  [<ffffffff81469268>] device_release_driver+0x28/0x40
Feb 12 07:35:17 tom1 kernel:  [<ffffffff8146856c>] bus_remove_device+0x9c/0xd0
Feb 12 07:35:17 tom1 kernel:  [<ffffffff814666ab>] device_del+0x12b/0x1d0
Feb 12 07:35:17 tom1 kernel:  [<ffffffffa00b9885>] usb_disable_device+0x95/0x110 [usbcore]
Feb 12 07:35:17 tom1 kernel:  [<ffffffffa00b3d23>] usb_disconnect+0xb3/0x140 [usbcore]
Feb 12 07:35:17 tom1 kernel:  [<ffffffffa00b4ce9>] hub_thread+0x339/0x1340 [usbcore]
Feb 12 07:35:17 tom1 kernel:  [<ffffffff81038488>] ? pick_next_task_fair+0xc8/0x110
Feb 12 07:35:17 tom1 kernel:  [<ffffffff8105c3a0>] ? autoremove_wake_function+0x0/0x40
Feb 12 07:35:17 tom1 kernel:  [<ffffffffa00b49b0>] ? hub_thread+0x0/0x1340 [usbcore]
Feb 12 07:35:17 tom1 kernel:  [<ffffffffa00b49b0>] ? hub_thread+0x0/0x1340 [usbcore]
Feb 12 07:35:17 tom1 kernel:  [<ffffffff8105bfae>] kthread+0x8e/0xa0
Feb 12 07:35:17 tom1 kernel:  [<ffffffff8100c14a>] child_rip+0xa/0x20
Feb 12 07:35:17 tom1 kernel:  [<ffffffff8105bf20>] ? kthread+0x0/0xa0
Feb 12 07:35:17 tom1 kernel:  [<ffffffff8100c140>] ? child_rip+0x0/0x20
Feb 12 07:35:17 tom1 kernel: Code: 48 83 ec 28 e8 7a 97 a2 ff bf 01 00 00 00 e8 70 97 a2 ff 48 8b 53 10 48 8d 45 b0 4c 8d 7b 08 48 89 43 10 4c 89 7d b0 48 89 55 b8 <48> 89 02 48 c7 c2 ff ff ff ff 4c 89 6d c0 48 89 d0 87 03 ff c8 Feb 12 07:35:17 tom1 kernel: RIP [<ffffffff8160f168>] __mutex_lock_slowpath+0x48/0x140
Feb 12 07:35:17 tom1 kernel:  RSP <ffff88003da73b50>
Feb 12 07:35:17 tom1 kernel: CR2: 0000000000000000
Feb 12 07:35:17 tom1 kernel: ---[ end trace 6a5f37e07ec8365f ]---


JPEG image


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux