From owner-freebsd-multimedia@FreeBSD.ORG Tue Feb 1 08:10:11 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 AC340106566C for ; Tue, 1 Feb 2011 08:10:11 +0000 (UTC) (envelope-from hselasky@freebsd.org) Received: from swip.net (mailfe03.c2i.net [212.247.154.66]) by mx1.freebsd.org (Postfix) with ESMTP id 244DB8FC08 for ; Tue, 1 Feb 2011 08:10:10 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=0KkIQGagYCvnrzE3Z2Lmid87OPdbX6VLcZYwAuLMZ50= c=1 sm=1 a=qO45us2aTv8A:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=uy63mRslNQ2YOn9Ev1YA:9 a=DSlYUr1y-eD7idum0Ld9phY0XosA:4 a=wPNLvfGTeEIA:10 a=tAl9Cu84zSju7Yq_8mkA:9 a=pZOptNKUGzQqDrmO0ZcA:7 a=tAsi9b1TaPSiDBvLsVNgb7d_CnYA:4 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe03.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 81868064; Tue, 01 Feb 2011 09:00:07 +0100 Received-SPF: softfail receiver=mailfe03.swip.net; client-ip=188.126.198.129; envelope-from=hselasky@freebsd.org From: Hans Petter Selasky To: freebsd-multimedia@freebsd.org Date: Tue, 1 Feb 2011 09:00:11 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.4.5; amd64; ; ) References: <20110131212710.GA85739@triton8.kn-bremen.de> In-Reply-To: <20110131212710.GA85739@triton8.kn-bremen.de> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_L27RNamZ1cT03VL" Message-Id: <201102010900.11121.hselasky@freebsd.org> Cc: Juergen Lock Subject: Re: New dvb-s2 tuner, and a hack to get remaining remotes working 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: Tue, 01 Feb 2011 08:10:11 -0000 --Boundary-00=_L27RNamZ1cT03VL Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit On Monday 31 January 2011 22:27:10 Juergen Lock wrote: > (also copied below) - I wasn't able to test this with the lirc > port yet (it complained that it can't set /dev/lirc0 to O_NONBLOCK), Can you try the attached patch and report back? --HPS --Boundary-00=_L27RNamZ1cT03VL Content-Type: text/x-patch; charset="iso-8859-1"; name="non-blocking-io.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="non-blocking-io.patch" Index: kernel/linux_file.c =================================================================== --- kernel/linux_file.c (revision 1701) +++ kernel/linux_file.c (working copy) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2009-2010 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2009-2011 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,6 +26,8 @@ #include #include +#include + struct cdev_handle * linux_open(int f_v4b, int fflags) { @@ -96,7 +98,7 @@ static void linux_fix_f_flags(struct file *fp, int fflags) { - if (fflags & O_NONBLOCK) { + if (fflags & CUSE_FFLAG_NONBLOCK) { if (!(fp->f_flags & O_NONBLOCK)) fp->f_flags |= O_NONBLOCK; } else { Index: webcamd.c =================================================================== --- webcamd.c (revision 1701) +++ webcamd.c (working copy) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2010 Hans Petter Selasky. All rights reserved. + * Copyright (c) 2010-2011 Hans Petter Selasky. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -27,6 +27,7 @@ #include #include #include +#include #include #include @@ -237,14 +238,20 @@ handle = cuse_dev_get_per_file_handle(cdev); + /* we support blocking/non-blocking I/O */ + if (cmd == FIONBIO) + return (0); + /* execute ioctl */ error = linux_ioctl(handle, fflags & CUSE_FFLAG_NONBLOCK, cmd, peer_data); - if (cmd == VIDIOC_QUERYBUF) { + if ((cmd == VIDIOC_QUERYBUF) && (error >= 0)) { - if (copy_from_user(&buf, peer_data, sizeof(buf)) != 0) + if (copy_from_user(&buf, peer_data, sizeof(buf)) != 0) { + error = -EFAULT; goto done; + } ptr = linux_mmap(handle, fflags, NULL, buf.length, buf.m.offset); @@ -255,8 +262,10 @@ buf.m.offset = 0x80000000UL; } - if (copy_to_user(peer_data, &buf, sizeof(buf)) != 0) + if (copy_to_user(peer_data, &buf, sizeof(buf)) != 0) { + error = -EFAULT; goto done; + } } done: return (v4b_convert_error(error)); --Boundary-00=_L27RNamZ1cT03VL--