From patchwork Fri Jul 24 10:37:52 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?QmFsw4PCoXpzIEjDg8KhbW9yc3preQ==?= X-Patchwork-Id: 37114 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6OAce04026318 for ; Fri, 24 Jul 2009 10:38:40 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752575AbZGXKh6 (ORCPT ); Fri, 24 Jul 2009 06:37:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752251AbZGXKh6 (ORCPT ); Fri, 24 Jul 2009 06:37:58 -0400 Received: from fg-out-1718.google.com ([72.14.220.153]:3804 "EHLO fg-out-1718.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752575AbZGXKh5 (ORCPT ); Fri, 24 Jul 2009 06:37:57 -0400 Received: by fg-out-1718.google.com with SMTP id e12so81751fga.17 for ; Fri, 24 Jul 2009 03:37:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :content-type; bh=4K5HCBiJajnA4GjoNQH9YrMNyQzqdG7109YHyxfqWO0=; b=grHId0Hz+OjCm2R1KQTSLDyKLMv3iBYcIcLkr5Iof6GsyU98u0lOpSMLOs4O522e6R U9cE2Cda/SbkwpdN1TLfWnAqe9wqpqxm/3heboQajchdPFSLDIsjn+J6EyAdbr//cGhm j9sQvJlDEzXBIGcGFe172qzmAsFMAF9dWhZaI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type; b=qv/kazzzLVJG4UGXz1wY7xXAwtj9FTIJ967TKZi8vQ0kBg2mQprNDUJwkMO13uUq50 8Roe9BilaezHI9XstCR13+gnn1yyYk6htE1FADktRK7e3vTWNJmZ8DggHwDD4OnCbje5 uVw7hGGVo5delCLg+zJhLKkcvxG1qqrhIkd10= Received: by 10.86.57.2 with SMTP id f2mr2879207fga.34.1248431874702; Fri, 24 Jul 2009 03:37:54 -0700 (PDT) Received: from ?192.168.0.2? (pool-6015.adsl.interware.hu [213.178.124.127]) by mx.google.com with ESMTPS id e11sm1850498fga.21.2009.07.24.03.37.53 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 24 Jul 2009 03:37:54 -0700 (PDT) Message-ID: <4A698F00.4060903@gmail.com> Date: Fri, 24 Jul 2009 12:37:52 +0200 From: =?ISO-8859-1?Q?H=E1morszky_Bal=E1zs?= User-Agent: Mozilla-Thunderbird 2.0.0.22 (X11/20090701) MIME-Version: 1.0 To: Andrew Morton CC: bugzilla-daemon@bugzilla.kernel.org, mchehab@infradead.org, linux-media@vger.kernel.org Subject: Re: [Bug 13708] Aiptek DV-T300 support is incomplete References: <200907201949.n6KJnOdY016111@demeter.kernel.org> <5c3736670907201337n41f08957r94fcde4383dd74d9@mail.gmail.com> <20090723160138.83a3579e.akpm@linux-foundation.org> In-Reply-To: <20090723160138.83a3579e.akpm@linux-foundation.org> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Andrew Morton wrote: > The patch doesn't apply to current kernels and fixing it looks non-trivial. I've attached a patch against the latest git tree. > There's no hurry - please email us a complete (tested, changelogged, > signed-off) patch when you have time to get onto it, thanks. I can't test it. The patch worked partially with kernel 2.6.29, but I can't get it working with 2.6.30. With 2.6.29 the driver dies after a few seconds, but with 2.6.30 the programs won't detect the camera. Also I only ported the patch to later kernels. I'm not the one who made it. The patch is originally from the creator of the driver. I also don't know how v4l works, so I have no idea how to fix the patch. --- a/zr364xx.c 2009-07-24 12:19:40.000000000 +0200 +++ b/zr364xx.c 2009-07-24 12:21:14.000000000 +0200 @@ -59,6 +59,7 @@ #define METHOD0 0 #define METHOD1 1 #define METHOD2 2 +#define METHOD3 3 /* Module parameters */ @@ -95,7 +96,7 @@ static struct usb_device_id device_table {USB_DEVICE(0x06d6, 0x003b), .driver_info = METHOD0 }, {USB_DEVICE(0x0a17, 0x004e), .driver_info = METHOD2 }, {USB_DEVICE(0x041e, 0x405d), .driver_info = METHOD2 }, - {USB_DEVICE(0x08ca, 0x2102), .driver_info = METHOD2 }, + {USB_DEVICE(0x08ca, 0x2102), .driver_info = METHOD3 }, {} /* Terminating entry */ }; @@ -213,7 +214,7 @@ static message m2[] = { }; /* init table */ -static message *init[3] = { m0, m1, m2 }; +static message *init[4] = { m0, m1, m2, m2 }; /* JPEG static data in header (Huffman table, etc) */ @@ -347,6 +348,11 @@ static int read_frame(struct zr364xx_cam cam->buffer[3], cam->buffer[4], cam->buffer[5], cam->buffer[6], cam->buffer[7], cam->buffer[8]); } else { + if (ptr + actual_length - jpeg > MAX_FRAME_SIZE) + { + DBG("frame too big!"); + return 0; + } memcpy(ptr, cam->buffer, actual_length); ptr += actual_length; } @@ -847,6 +853,22 @@ static int zr364xx_probe(struct usb_inte m0d1[0] = mode; m1[2].value = 0xf000 + mode; m2[1].value = 0xf000 + mode; + + /* special case for METHOD3, the modes are different */ + if (cam->method == METHOD3) { + switch (mode) { + case 1: + m2[1].value = 0xf000 + 4; + break; + case 2: + m2[1].value = 0xf000 + 0; + break; + default: + m2[1].value = 0xf000 + 1; + break; + } + } + header2[437] = cam->height / 256; header2[438] = cam->height % 256; header2[439] = cam->width / 256;