From patchwork Mon Aug 7 21:51:39 2006 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Anssi Hannula X-Patchwork-Id: 12371 Received: from pne-smtpout4-sn2.hy.skanova.net ([81.228.8.154]) by www.linuxtv.org with esmtp (Exim 4.50) id 1GAD1B-00017O-Gh for vdr@linuxtv.org; Mon, 07 Aug 2006 23:52:13 +0200 Received: from mail.onse.fi (80.223.77.223) by pne-smtpout4-sn2.hy.skanova.net (7.2.075) id 44A2EAB8001300D8 for vdr@linuxtv.org; Mon, 7 Aug 2006 23:51:42 +0200 Received: from [10.0.0.3] (kone [10.0.0.3]) by mail.onse.fi (Postfix) with ESMTP id 3C1A0470C284 for ; Tue, 8 Aug 2006 00:51:42 +0300 (EEST) Message-ID: <44D7B5EB.2050207@gmail.com> Date: Tue, 08 Aug 2006 00:51:39 +0300 From: Anssi Hannula User-Agent: Mozilla Thunderbird 1.0.6-7.6.20060mdk (X11/20050322) X-Accept-Language: en-us, en MIME-Version: 1.0 To: VDR Mailing List Subject: Re: [vdr] VDR prefers my CI DVB device for recordings and blocks it unnecessarily References: <20060807231053.14951AbFkFe146@wizard.castle> In-Reply-To: <20060807231053.14951AbFkFe146@wizard.castle> X-Enigmail-Version: 0.92.0.0 X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Aug 2006 21:52:13 -0000 Status: O X-Status: X-Keywords: X-UID: 10362 Jörn Reder wrote: > Klaus Schmidinger wrote: > > >>Please try the attached patch. >>With this change "avoiding full featured or primary cards" gets >>less priority than "using the device with the lowest priority >>or the lowest number of CA methods". > > > Thanks for your patch, I played around with it. The ActualDevice() test > has a very high priority, so if I start a recording on the fly, my CI > device is still preferred. For testing purposes I commented out the > ActualDevice() test, then your patch worked for me. Yes, the ActualDevice() test has to be modified, too. Please try my attached patch (it is against 1.4.1-3). > I don't understand the device[i]->ProvidesCa(Channel) test, because it > checks for the currently requested channel. I dunno any internals (so > please be patient with me ;), but from reading the source code it looks > that the first if condition in the device loop > > device[i]->ProvidesChannel(Channel, Priority, &ndr) > > already checks if the device is basically capable of decoding the > requested channel, this must include a test for decryption capability > (if the channel is encrypted), not?. So why another ProvidesCA() test? > All devices in this if block should pass it anyway. The ProvidesCa() is done because it also returns the number of cam methods the device offers. Therefore we prefer a device that provides as few cam methods as possible. > What about adding a high priority test like hasCAM() (ideally with > weighting the number of channels the device is able to decrypt) to avoid > blocking a CA device unnecessarily? The attached patch will do fine (though it will not weigh the number of channels, but number of encryptions). diff -Nurp -x '*~' vdr-1.4.1-3/device.c vdr-1.4.1-3-fix/device.c --- vdr-1.4.1-3/device.c 2006-08-08 00:39:07.000000000 +0300 +++ vdr-1.4.1-3-fix/device.c 2006-08-08 00:43:09.000000000 +0300 @@ -294,11 +294,11 @@ cDevice *cDevice::GetDevice(const cChann uint imp = 0; imp <<= 1; imp |= !device[i]->Receiving(true) || ndr; // use receiving devices if we don't need to detach existing receivers imp <<= 1; imp |= device[i]->Receiving(); // avoid devices that are receiving - imp <<= 1; imp |= device[i] == ActualDevice(); // avoid the actual device (in case of Transfer Mode) - imp <<= 1; imp |= device[i]->IsPrimaryDevice(); // avoid the primary device - imp <<= 1; imp |= device[i]->HasDecoder(); // avoid full featured cards + imp <<= 1; imp |= device[i] == cTransferControl::ReceiverDevice(); // avoid the Transfer Mode receiver device imp <<= 8; imp |= min(max(device[i]->Priority() + MAXPRIORITY, 0), 0xFF); // use the device with the lowest priority (+MAXPRIORITY to assure that values -99..99 can be used) imp <<= 8; imp |= min(max(device[i]->ProvidesCa(Channel), 0), 0xFF); // use the device that provides the lowest number of conditional access methods + imp <<= 1; imp |= device[i]->IsPrimaryDevice(); // avoid the primary device + imp <<= 1; imp |= device[i]->HasDecoder(); // avoid full featured cards if (imp < Impact) { // This device has less impact than any previous one, so we take it. Impact = imp;