From patchwork Tue Jul 22 22:55:06 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauro Carvalho Chehab X-Patchwork-Id: 4607111 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 262659F295 for ; Tue, 22 Jul 2014 22:55:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3B7032018A for ; Tue, 22 Jul 2014 22:55:24 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B137D20155 for ; Tue, 22 Jul 2014 22:55:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932883AbaGVWzP (ORCPT ); Tue, 22 Jul 2014 18:55:15 -0400 Received: from mailout3.w2.samsung.com ([211.189.100.13]:51577 "EHLO usmailout3.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933466AbaGVWzN (ORCPT ); Tue, 22 Jul 2014 18:55:13 -0400 Received: from uscpsbgm1.samsung.com (u114.gpu85.samsung.co.kr [203.254.195.114]) by usmailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N9400BAPYBZ7LB0@usmailout3.samsung.com> for linux-media@vger.kernel.org; Tue, 22 Jul 2014 18:55:11 -0400 (EDT) X-AuditID: cbfec372-b7fe76d00000687e-f0-53ceebce88f4 Received: from ussync4.samsung.com ( [203.254.195.84]) by uscpsbgm1.samsung.com (USCPMTA) with SMTP id 67.7B.26750.FCBEEC35; Tue, 22 Jul 2014 18:55:11 -0400 (EDT) Received: from recife.lan ([105.144.134.215]) by ussync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N94002VYYBVDZ20@ussync4.samsung.com>; Tue, 22 Jul 2014 18:55:10 -0400 (EDT) Date: Tue, 22 Jul 2014 19:55:06 -0300 From: Mauro Carvalho Chehab To: Christoph Pfister Cc: linux-media@vger.kernel.org Subject: [Kaffeine PATCH] Be sure to select the delivery system Message-id: <20140722195506.76d8096c.m.chehab@samsung.com> X-Mailer: Claws Mail 3.10.1 (GTK+ 2.24.22; x86_64-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrLJMWRmVeSWpSXmKPExsVy+t/hEN3zr88FG2zOt5jwZxWzRc+GrawO TB47Z91l9/i8SS6AKYrLJiU1J7MstUjfLoEr49Ky6cwFL3Ur/qyewtjAuFuli5GTQ0LAROLc o52sELaYxIV769m6GLk4hASWMEp0H33CDuE0M0l8WbaYDaSKRUBVYuf0zWAdbAJGEq8aW8Bs ESC74/gkZhCbWUBeYv6lwywgtrCAvUTXuXNgcV4BK4n9K/6wQWxzlvg5cxIjRFxQ4sfkeywQ vVoSm7c1scLM2bzmLfMERr5ZSMpmISmbhaRsASPzKkbR0uLkguKk9FxDveLE3OLSvHS95Pzc TYyQICvawfhsg9UhRgEORiUe3oKac8FCrIllxZW5hxglOJiVRHijW4FCvCmJlVWpRfnxRaU5 qcWHGJk4OKUaGI1C4p6on2OW71vhGHolY2pLrM3Lt9oX333UmmUm3uAy/XZCdrBI+vIVj0QX qt5sspne963LcFnetktxWiqfj6lxWmvHfvolwbPQp7XrVNP83T8bOzmlMn8/tli6Jb8y4KrV oQ9VfBYLOm+I8ButWVHMmOf2tco0+iNbRfa93ml3i7OXNk5bpsRSnJFoqMVcVJwIAOsCxQ4Q AgAA Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Christoph, I know you don't have any time for Kaffeine anymore. Still, it is a very nice application, with helps me to test some stuff. However, its DVB support is too outdated, and doesn't work fine with devices with multiple delivery systems, as it doesn't have support yet for DTV_ENUM_DELSYS and DTV_DELIVERY_SYSTEM properties. The enclosed patch should fix it. Could you please commit it at the master repository? With that, devices like PCTV 292e that supports both DVB-C and DVB-T will open a dialog box that will allow configuring channels for both DVB-C and DVB-T. It will also change to the proper standard at tuner setting. I might eventually produce other patches for it if I have some time, in order to make it support ISDB-T and DVB-T2, likely via libdvbv5. Anyway, this one is an interesting to have, as it avoids the need of calling an external program to switch between DVB-C and DVB-T on devices that support both. Regards, Mauro PS.: I created a clone of the Kaffeine tree at: http://git.linuxtv.org/cgit.cgi/mchehab/kaffeine.git with the patch below, for those that want to test it. Regards, Mauro --- Subject: [PATCH] Be sure to select the delivery system Some devices support multiple delivery systems. Enumerate and select the right delivery system when needed. Signed-off-by: Mauro Carvalho Chehab -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/src/dvb/dvbdevice_linux.cpp b/src/dvb/dvbdevice_linux.cpp index 98da579..eee067c 100644 --- a/src/dvb/dvbdevice_linux.cpp +++ b/src/dvb/dvbdevice_linux.cpp @@ -63,6 +63,41 @@ void DvbLinuxDevice::startDevice(const QString &deviceId_) return; } + struct dtv_properties props; + struct dtv_property dvb_prop; + + dvb_prop.cmd = DTV_ENUM_DELSYS; + props.num = 1; + props.props = &dvb_prop; + + transmissionTypes = 0; + + if (!ioctl(fd, FE_GET_PROPERTY, &props)) { + HasDelSys = true; + + for (unsigned i = 0; i < dvb_prop.u.buffer.len; i++) { + switch (dvb_prop.u.buffer.data[i]) { + case SYS_DVBS: + transmissionTypes |= DvbS; + break; + case SYS_DVBS2: + transmissionTypes |= DvbS2; + break; + case SYS_DVBT: + transmissionTypes |= DvbT; + break; + case SYS_DVBC_ANNEX_A: + transmissionTypes |= DvbC; + break; + case SYS_ATSC: + transmissionTypes |= Atsc; + break; + } + } + } else { + HasDelSys = false; + } + dvb_frontend_info frontend_info; memset(&frontend_info, 0, sizeof(frontend_info)); @@ -77,31 +112,33 @@ void DvbLinuxDevice::startDevice(const QString &deviceId_) deviceId = deviceId_; frontendName = QString::fromUtf8(frontend_info.name); - switch (frontend_info.type) { - case FE_QAM: - transmissionTypes = DvbC; - break; - case FE_QPSK: - transmissionTypes = DvbS; - - if (((frontend_info.caps & FE_CAN_2G_MODULATION) != 0) || - (strcmp(frontend_info.name, "Conexant CX24116/CX24118") == 0) || - (strcmp(frontend_info.name, "Genpix 8psk-to-USB2 DVB-S") == 0) || - (strcmp(frontend_info.name, "STB0899 Multistandard") == 0)) { - transmissionTypes |= DvbS2; - } + if (!transmissionTypes) { + switch (frontend_info.type) { + case FE_QAM: + transmissionTypes = DvbC; + break; + case FE_QPSK: + transmissionTypes = DvbS; + + if (((frontend_info.caps & FE_CAN_2G_MODULATION) != 0) || + (strcmp(frontend_info.name, "Conexant CX24116/CX24118") == 0) || + (strcmp(frontend_info.name, "Genpix 8psk-to-USB2 DVB-S") == 0) || + (strcmp(frontend_info.name, "STB0899 Multistandard") == 0)) { + transmissionTypes |= DvbS2; + } - break; - case FE_OFDM: - transmissionTypes = DvbT; - break; - case FE_ATSC: - transmissionTypes = Atsc; - break; - default: - Log("DvbLinuxDevice::startDevice: unknown type") << frontend_info.type << - QLatin1String("for frontend") << frontendPath; - return; + break; + case FE_OFDM: + transmissionTypes = DvbT; + break; + case FE_ATSC: + transmissionTypes = Atsc; + break; + default: + Log("DvbLinuxDevice::startDevice: unknown type") << frontend_info.type << + QLatin1String("for frontend") << frontendPath; + return; + } } capabilities = 0; @@ -420,6 +457,45 @@ bool DvbLinuxDevice::tune(const DvbTransponder &transponder) stopDvr(); dvb_frontend_parameters params; + if (HasDelSys) { + struct dtv_properties props; + struct dtv_property dvb_prop[1]; + unsigned delsys; + + switch (transponder.getTransmissionType()) { + case DvbTransponderBase::DvbS: + delsys = SYS_DVBS; + break; + case DvbTransponderBase::DvbS2: + delsys = SYS_DVBS2; + break; + case DvbTransponderBase::DvbC: + delsys = SYS_DVBC_ANNEX_A; + break; + case DvbTransponderBase::DvbT: + delsys = SYS_DVBT; + break; + case DvbTransponderBase::Atsc: + delsys = SYS_ATSC; + break; + default: + Log("DvbLinuxDevice::tune: unknown transmission type") << + transponder.getTransmissionType(); + return false; + } + + dvb_prop[0].cmd = DTV_DELIVERY_SYSTEM; + dvb_prop[0].u.data = delsys; + props.num = 1; + props.props = dvb_prop; + if (ioctl(frontendFd, FE_SET_PROPERTY, &props) < 0) { + Log("DvbLinuxDevice::tune: couldn't switch delivery system to") << + transponder.getTransmissionType(); + return false; + } + } + + switch (transponder.getTransmissionType()) { case DvbTransponderBase::DvbC: { const DvbCTransponder *dvbCTransponder = transponder.as(); diff --git a/src/dvb/dvbdevice_linux.h b/src/dvb/dvbdevice_linux.h index a65e6ec..e5e4f13 100644 --- a/src/dvb/dvbdevice_linux.h +++ b/src/dvb/dvbdevice_linux.h @@ -73,6 +73,7 @@ private: void stopDvr(); void run(); + bool HasDelSys; bool ready; QString deviceId; QString frontendName;