From patchwork Mon Dec 30 12:48:39 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andr=C3=A9_Roth?= X-Patchwork-Id: 3419261 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 1943CC02DC for ; Mon, 30 Dec 2013 12:50:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 2B7A5200F2 for ; Mon, 30 Dec 2013 12:50:01 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7130820107 for ; Mon, 30 Dec 2013 12:49:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755771Ab3L3Mtd (ORCPT ); Mon, 30 Dec 2013 07:49:33 -0500 Received: from mail-ee0-f48.google.com ([74.125.83.48]:62468 "EHLO mail-ee0-f48.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755685Ab3L3Mt2 (ORCPT ); Mon, 30 Dec 2013 07:49:28 -0500 Received: by mail-ee0-f48.google.com with SMTP id e49so4963353eek.21 for ; Mon, 30 Dec 2013 04:49:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=w8ss8CaVY/QTzXU8qydrGwWO4Bniyh6tKSr8aLKkC6U=; b=HOR0sp5+g5+rSUDZ5WErSFhdcUWZdK707xMVHPZ+bc5OShV7hNwVnPK35puwfjyt2k tVjZo4lxIOp51b8MRgTydv6w6aWaTaRbHcOMxjUgTYbR7RsnB6CH6IL8emUnzYqdeH29 76YgPHLT/od9xP+g6EQ0JLeAE41pqdVI67V9WFc3lHOslbZfU9Lk/BnqCMCrM188JYmf sxiagi9+n3Te6+aadpiVaJoLfZuoDdU1Mqt576vT6UnfCBOSB9L+ASYL/fkjSzpIAIGh M5XZOhjw6oR4u4jFJFLehgmRlXkZtBz+6htFdNXRhCLL1LYE5fZbs6OUkIIAxCTy1pp6 DhAw== X-Received: by 10.14.225.2 with SMTP id y2mr1479643eep.62.1388407767590; Mon, 30 Dec 2013 04:49:27 -0800 (PST) Received: from neutrino.exnihilo (140-227.61-188.cust.bluewin.ch. [188.61.227.140]) by mx.google.com with ESMTPSA id z42sm108428856eeo.17.2013.12.30.04.49.27 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 30 Dec 2013 04:49:27 -0800 (PST) From: =?UTF-8?q?Andr=C3=A9=20Roth?= To: linux-media@vger.kernel.org Cc: =?UTF-8?q?Andr=C3=A9=20Roth?= Subject: [PATCH 06/18] libdvbv5: implement dvb_fe_dummy for logging Date: Mon, 30 Dec 2013 13:48:39 +0100 Message-Id: <1388407731-24369-6-git-send-email-neolynx@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1388407731-24369-1-git-send-email-neolynx@gmail.com> References: <1388407731-24369-1-git-send-email-neolynx@gmail.com> MIME-Version: 1.0 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, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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 The dvbv5 functions use the dvb_v5_fe_parms struct for logging. This struct is normally obtained by opening a dvb device. For situations where the opening of a dvb device is not desired, the dvb_fe_dummy can be used. Signed-off-by: André Roth --- lib/include/descriptors.h | 6 ++++++ lib/include/dvb-fe.h | 2 ++ lib/libdvbv5/descriptors.c | 2 ++ lib/libdvbv5/dvb-fe.c | 7 +++++++ 4 files changed, 17 insertions(+) diff --git a/lib/include/descriptors.h b/lib/include/descriptors.h index 5ab29a0..6f89aeb 100644 --- a/lib/include/descriptors.h +++ b/lib/include/descriptors.h @@ -63,7 +63,13 @@ struct dvb_desc { } __attribute__((packed)); void dvb_desc_default_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, struct dvb_desc *desc); +#ifdef __cplusplus +extern "C" { +#endif void dvb_desc_default_print (struct dvb_v5_fe_parms *parms, const struct dvb_desc *desc); +#ifdef __cplusplus +} +#endif #define dvb_desc_foreach( _desc, _tbl ) \ for( struct dvb_desc *_desc = _tbl->descriptor; _desc; _desc = _desc->next ) \ diff --git a/lib/include/dvb-fe.h b/lib/include/dvb-fe.h index b0e2bf9..8cf2697 100644 --- a/lib/include/dvb-fe.h +++ b/lib/include/dvb-fe.h @@ -119,6 +119,8 @@ struct dvb_v5_fe_parms { extern "C" { #endif +struct dvb_v5_fe_parms *dvb_fe_dummy(); + struct dvb_v5_fe_parms *dvb_fe_open(int adapter, int frontend, unsigned verbose, unsigned use_legacy_call); struct dvb_v5_fe_parms *dvb_fe_open2(int adapter, int frontend, diff --git a/lib/libdvbv5/descriptors.c b/lib/libdvbv5/descriptors.c index 437b2f4..bc3d51a 100644 --- a/lib/libdvbv5/descriptors.c +++ b/lib/libdvbv5/descriptors.c @@ -69,6 +69,8 @@ void dvb_desc_default_init(struct dvb_v5_fe_parms *parms, const uint8_t *buf, st void dvb_desc_default_print(struct dvb_v5_fe_parms *parms, const struct dvb_desc *desc) { + if (!parms) + parms = dvb_fe_dummy(); dvb_log("| %s (%#02x)", dvb_descriptors[desc->type].name, desc->type); hexdump(parms, "| ", desc->data, desc->length); } diff --git a/lib/libdvbv5/dvb-fe.c b/lib/libdvbv5/dvb-fe.c index cc32ec0..4672267 100644 --- a/lib/libdvbv5/dvb-fe.c +++ b/lib/libdvbv5/dvb-fe.c @@ -35,6 +35,13 @@ static void dvb_v5_free(struct dvb_v5_fe_parms *parms) free(parms); } +struct dvb_v5_fe_parms dummy_fe; +struct dvb_v5_fe_parms *dvb_fe_dummy() +{ + dummy_fe.logfunc = dvb_default_log; + return &dummy_fe; +} + struct dvb_v5_fe_parms *dvb_fe_open(int adapter, int frontend, unsigned verbose, unsigned use_legacy_call) {