From owner-freebsd-multimedia@FreeBSD.ORG Mon Mar 21 15:24:21 2011 Return-Path: Delivered-To: freebsd-multimedia@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 90DFF106566B for ; Mon, 21 Mar 2011 15:24:21 +0000 (UTC) (envelope-from bu7cher@yandex.ru) Received: from forward9.mail.yandex.net (forward9.mail.yandex.net [77.88.61.48]) by mx1.freebsd.org (Postfix) with ESMTP id 6F3D98FC19 for ; Mon, 21 Mar 2011 15:24:20 +0000 (UTC) Received: from smtp9.mail.yandex.net (smtp9.mail.yandex.net [77.88.61.35]) by forward9.mail.yandex.net (Yandex) with ESMTP id B7312CE1261; Mon, 21 Mar 2011 18:24:16 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.ru; s=mail; t=1300721056; bh=1G2Ff/r+sqNs3CLjpVtWQ6LMhnCDEwqxkM2U04XMIqw=; h=Message-ID:Date:From:MIME-Version:To:CC:Subject:References: In-Reply-To:Content-Type; b=JV1hNKOTpTld6+Jnuc7acfoWZESibCkruzgVcG1exuHXkmZnug3dcf8nxArcrlhfP V9oy0W5+GuDtFVIrnCxzI27mTePxUzQ27du10QxoM8Mff/aqdZ+asIv8PGNsj6xSGO tq2zBwrj6RS1Sl8Bfxy2Gtt1WUyc4PcnLeN4gH5s= Received: from [178.141.127.59] (dynamic-178-141-127-59.kirov.comstar-r.ru [178.141.127.59]) by smtp9.mail.yandex.net (Yandex) with ESMTPSA id 271284BA0068; Mon, 21 Mar 2011 18:24:16 +0300 (MSK) Message-ID: <4D876D8B.6000103@yandex.ru> Date: Mon, 21 Mar 2011 18:23:55 +0300 From: "Andrey V. Elsukov" User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.2.15) Gecko/20110309 Thunderbird/3.1.9 MIME-Version: 1.0 To: Hans Petter Selasky References: <20110321112141.GA23421@sh4-5.1blu.de> <201103211242.15230.hselasky@c2i.net> <201103211301.36287.hselasky@c2i.net> In-Reply-To: <201103211301.36287.hselasky@c2i.net> X-Enigmail-Version: 1.1.2 Content-Type: multipart/mixed; boundary="------------030402030904060207030305" Cc: freebsd-multimedia@freebsd.org Subject: Re: Webcam recommendations X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Mar 2011 15:24:21 -0000 This is a multi-part message in MIME format. --------------030402030904060207030305 Content-Type: text/plain; charset=KOI8-R Content-Transfer-Encoding: 8bit On 21.03.2011 15:01, Hans Petter Selasky wrote: > Looks like I was too quick about that. Anyway, maybe you could bother to add > some prints in: > > v4l-dvb/linux/drivers/media/video/v4l2-ioctl.c > > Because the V4l1 -> V4L2 translation should already be in place. Hi, After some time of reading code i understand several things. webcamd contains a bunch of linux kernel drivers. Also any freebsd's application can use v4l1 and v4l2 with /dev/videoX, but linux's binaries can not. They can only use v4l1, because linux.ko supports only v4l1. Anyway webcamd has some v4l1 to v4l2 translation inside. But it does not work for my UVC webcam (translation works, but camera does not) :( I have not any linux host where i can test my webcam, but i think it will not work with skype out of the box in linux too. But it seems linux users can try LD_PRELOAD with libv4l's libraries (v4l1compat.so or v4l2convert.so). We can not, because we does not have V4L2 support in linux.ko. I added these two patches to webcamd port, they enable addition debug. Also i enabled debug in libcuse4bsd. When i run skype i have in log: cuse4bsd: Command = open, flags = 3, arg = 0x00000000, ptr = 0x00000000 uvcvideo: uvc_v4l2_open cuse4bsd: Command error = 0 cuse4bsd: Command = ioctl, flags = 7, arg = 0x40047601, ptr = 0x00010000 uvcvideo: uvc_v4l2_ioctl(VIDIOCGCAP) uvcvideo: Unknown ioctl 0x40047601 cuse4bsd: Command error = -3 it seems there skype calls iotctl(VIDOCGCAP) with incorrect argument's size = 0x04. cuse4bsd: Command = ioctl, flags = 7, arg = 0x403c7601, ptr = 0x00010000 uvcvideo: uvc_v4l2_ioctl(VIDIOCGCAP) uvcvideo: Trying format 0x56595559 (YUYV): 10000x10000. uvcvideo: Using default frame interval 111111.1 us (9.0 fps). cuse4bsd: copy_out(0x7fffff1f8cf0,0x10000,60), cmd = 5 cuse4bsd: Command error = 0 But second call is correct. cuse4bsd: Command = close, flags = 3, arg = 0x00000000, ptr = 0x00000000 uvcvideo: uvc_v4l2_release cuse4bsd: Command error = 0 Now i'm trying to test video in skype's preferences: cuse4bsd: Command = open, flags = 3, arg = 0x00000000, ptr = 0x00000000 uvcvideo: uvc_v4l2_open cuse4bsd: Command error = 0 cuse4bsd: Command = ioctl, flags = 7, arg = 0x40047601, ptr = 0x00010000 uvcvideo: uvc_v4l2_ioctl(VIDIOCGCAP) uvcvideo: Unknown ioctl 0x40047601 cuse4bsd: Command error = -3 cuse4bsd: Command = ioctl, flags = 7, arg = 0x403c7601, ptr = 0x00010000 uvcvideo: uvc_v4l2_ioctl(VIDIOCGCAP) uvcvideo: Trying format 0x56595559 (YUYV): 10000x10000. uvcvideo: Using default frame interval 111111.1 us (9.0 fps). cuse4bsd: copy_out(0x7fffffffd4f0,0x10000,60), cmd = 5 cuse4bsd: Command error = 0 cuse4bsd: Command = ioctl, flags = 7, arg = 0x400e7606, ptr = 0x00010000 uvcvideo: uvc_v4l2_ioctl(VIDIOCGPICT) cuse4bsd: copy_out(0x7fffff1f8cf0,0x10000,14), cmd = 5 cuse4bsd: Command error = 0 cuse4bsd: Command = ioctl, flags = 7, arg = 0x800e7607, ptr = 0x00010000 uvcvideo: uvc_v4l2_ioctl(VIDIOCSPICT) cuse4bsd: copy_in(0x10000,0x7ffffeff7cf0,14), cmd = 5 uvcvideo: Trying format 0x32315559 (YU12): 160x120. uvcvideo: Unsupported format 0x32315559. v4l1-compat: VIDIOCSPICT / VIDIOC_S_FMT: -22 uvcvideo: Unknown ioctl 0x4030560a v4l1-compat: VIDIOCSPICT / VIDIOC_G_FBUF: -513 cuse4bsd: Command error = -3 cuse4bsd: Command = ioctl, flags = 7, arg = 0x800e7607, ptr = 0x00010000 uvcvideo: uvc_v4l2_ioctl(VIDIOCSPICT) cuse4bsd: copy_in(0x10000,0x7ffffebf5cf0,14), cmd = 5 uvcvideo: Unknown ioctl 0x4030560a v4l1-compat: VIDIOCSPICT / VIDIOC_G_FBUF: -513 cuse4bsd: Command error = 0 cuse4bsd: Command = ioctl, flags = 7, arg = 0x40287609, ptr = 0x00010000 uvcvideo: uvc_v4l2_ioctl(VIDIOCGWIN) v4l1-compat: VIDIOCGWIN / VIDIOC_G_WIN: -22 cuse4bsd: copy_out(0x7ffffedf6cf0,0x10000,40), cmd = 5 cuse4bsd: Command error = 0 cuse4bsd: Command = ioctl, flags = 7, arg = 0x8028760a, ptr = 0x00010000 uvcvideo: uvc_v4l2_ioctl(VIDIOCSWIN) cuse4bsd: copy_in(0x10000,0x7fffffffd4f0,40), cmd = 5 uvcvideo: Trying format 0x56595559 (YUYV): 320x240. uvcvideo: Using default frame interval 33333.3 us (30.0 fps). v4l1-compat: VIDIOCSWIN / VIDIOC_S_FMT #2: -22 cuse4bsd: Command error = 0 cuse4bsd: Command = poll, flags = 7, arg = 0x00000005, ptr = 0x00000000 uvcvideo: uvc_v4l2_poll cuse4bsd: Command error = 0 cuse4bsd: Command = poll, flags = 7, arg = 0x00000005, ptr = 0x00000000 uvcvideo: uvc_v4l2_poll cuse4bsd: Command error = 0 So, as you can see v4l1-compat code works by default. But camera does not. I looked to pwc driver code and try to reimplement VIDIOCSPICT and VIDIOCSWIN iocts. I just call v4l_compat_translate_ioctl and it it success i call uvc_video_enable(), with this changes skype is able to turn on webcam, but it still can not get any pictures. I need similar log from working camera to understand what is needed skype to work with webcam. -- WBR, Andrey V. Elsukov --------------030402030904060207030305 Content-Type: text/plain; name="patch-aa" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="patch-aa" --- v4l-dvb/linux/drivers/media/video/uvc/uvc_driver.c 2011-03-20 02:12:1= 1.280845495 +0300 +++ v4l-dvb/linux/drivers/media/video/uvc/uvc_driver.c 2011-03-20 02:12:1= 5.917841538 +0300 @@ -47,7 +47,7 @@ unsigned int uvc_clock_param =3D CLOCK_MONOTONIC; unsigned int uvc_no_drop_param; static unsigned int uvc_quirks_param =3D -1; -unsigned int uvc_trace_param; +unsigned int uvc_trace_param =3D UVC_TRACE_FORMAT | UVC_TRACE_CALLS | UV= C_TRACE_IOCTL; unsigned int uvc_timeout_param =3D UVC_CTRL_STREAMING_TIMEOUT; =20 /* ---------------------------------------------------------------------= --- --------------030402030904060207030305 Content-Type: text/plain; name="patch-bb" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="patch-bb" --- v4l-dvb/linux/drivers/media/video/v4l1-compat.c.orig 2011-03-20 02:13= :51.352845149 +0300 +++ v4l-dvb/linux/drivers/media/video/v4l1-compat.c 2011-03-20 02:14:00.6= 41842493 +0300 @@ -37,7 +37,7 @@ #include #include "compat.h" =20 -static unsigned int debug; +static unsigned int debug =3D 1; module_param(debug, int, 0644); MODULE_PARM_DESC(debug, "enable debug messages"); MODULE_AUTHOR("Bill Dirks"); --------------030402030904060207030305 Content-Type: text/plain; name="cuse4bsd_lib.c.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="cuse4bsd_lib.c.diff" --- cuse4bsd_lib.c.orig 2010-05-07 14:33:51.000000000 +0400 +++ cuse4bsd_lib.c 2011-03-21 18:08:42.486322494 +0300 @@ -43,7 +43,7 @@ =20 #include "cuse4bsd.h" =20 -#if 0 +#if 1 #define CUSE4BSD_DEBUG #endif =20 @@ -409,8 +409,12 @@ cuse_wait_and_process(void) cuse_unlock(); =20 #ifdef CUSE4BSD_DEBUG - printf("Command =3D %d, flags =3D %d, arg =3D 0x%08x, ptr =3D 0x%08x\n"= , - (int)info.command, (int)info.fflags, + const char *cmd[CUSE_CMD_MAX] =3D { + "none", "open", "close", "read", "write", "ioctl", "poll", + "signal", "sync" + }; + printf("cuse4bsd: Command =3D %s, flags =3D %d, arg =3D 0x%08x, ptr =3D= 0x%08x\n", + cmd[info.command], (int)info.fflags, (int)info.argument, (int)info.data_pointer); #endif =20 @@ -475,7 +479,7 @@ cuse_wait_and_process(void) case CUSE_CMD_IOCTL: if (cdev->mtod->cm_ioctl !=3D NULL) { error =3D (cdev->mtod->cm_ioctl) (cdev, (int)info.fflags, - (unsigned long)info.argument, (void *)info.data_pointer); + (unsigned int)info.argument, (void *)info.data_pointer); } else { error =3D CUSE_ERR_INVALID; } @@ -506,7 +510,7 @@ cuse_wait_and_process(void) } =20 #ifdef CUSE4BSD_DEBUG - printf("Command error =3D %d\n", error); + printf("cuse4bsd: Command error =3D %d\n", error); #endif cuse_lock(); if (info.command < CUSE_CMD_MAX) { @@ -612,7 +616,7 @@ cuse_copy_out(const void *src, void *use return (CUSE_ERR_INVALID); =20 #ifdef CUSE4BSD_DEBUG - printf("copy_out(%p,%p,%d), cmd =3D %d\n", src, user_dst, len, cmd); + printf("cuse4bsd: copy_out(%p,%p,%d), cmd =3D %d\n", src, user_dst, len= , cmd); #endif if (cuse_dev_get_local(cdev, cmd)) { memcpy(user_dst, src, len); @@ -624,7 +628,7 @@ cuse_copy_out(const void *src, void *use error =3D ioctl(f_cuse, CUSE_IOCTL_WRITE_DATA, &info); if (error) { #ifdef CUSE4BSD_DEBUG - printf("copy_out() error =3D %d\n", errno); + printf("cuse4bsd: copy_out() error =3D %d\n", errno); #endif return (CUSE_ERR_FAULT); } @@ -649,7 +653,7 @@ cuse_copy_in(const void *user_src, void=20 return (CUSE_ERR_INVALID); =20 #ifdef CUSE4BSD_DEBUG - printf("copy_in(%p,%p,%d), cmd =3D %d\n", user_src, dst, len, cmd); + printf("cuse4bsd: copy_in(%p,%p,%d), cmd =3D %d\n", user_src, dst, len,= cmd); #endif if (cuse_dev_get_local(cdev, cmd)) { memcpy(dst, user_src, len); @@ -661,7 +665,7 @@ cuse_copy_in(const void *user_src, void=20 error =3D ioctl(f_cuse, CUSE_IOCTL_READ_DATA, &info); if (error) { #ifdef CUSE4BSD_DEBUG - printf("copy_in() error =3D %d\n", errno); + printf("cuse4bsd: copy_in() error =3D %d\n", errno); #endif return (CUSE_ERR_FAULT); } --------------030402030904060207030305--