public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: unlisted-recipients:; (no To-header on input)@casper.infradead.org
Cc: dhowells@redhat.com, Antti Palosaari <crope@iki.fi>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	linux-media@vger.kernel.org,
	Jarkko Korpi <jarkko_korpi@hotmail.com>
Subject: Re: I2C transfer logs for Antti's DS3103 driver and DVBSky's DS3103 driver
Date: Fri, 15 Nov 2013 02:15:12 +0000	[thread overview]
Message-ID: <10636.1384481712@warthog.procyon.org.uk> (raw)
In-Reply-To: <20271.1384472102@warthog.procyon.org.uk>

David Howells <dhowells@redhat.com> wrote:

> Here are four logs from doing:
> 
> 	scandvb -a1 ./e.1
> 
> where the contents of file e.1 are:
> 
> 	S 11919000 V 27500000 3/4
> 
> which is probing a region on the Eutelsat-9A satellite broadcast.

Here's a script for turning the logs from:

	I2C cx23885[0]: RD 60 1
	I2C m88ds3103: WR 60 2 [0003]
	I2C cx23885[0]: WR 68 2 [0311]
	I2C cx23885[0]: WR 60 2 [0003]
	I2C m88ds3103: WR 60 1 [00]

into something that looks like:

	demod_read(23)
	demod_write(23, [1f])
	TUNER_read(00)
	TUNER_write(00, [03])
	TUNER_read(00)

and checks for and hides the tuner gate opening commands to the ds3103.

David
---
#!/usr/bin/perl -w

use strict;

my $last_adap = 0;
my $last_dev = 0;
my $last_reg = 0;
my $tuner_gate = 0;

while (<>) {
    chomp;
    if (/^I2C ([^:]*): RD ([0-9A-Fa-f]{2}) ([0-9]{1,2})/) {
	my $adap = $1;
	my $dev = $2;
	my $n = $3;

	die if ($dev ne "6b" && $dev ne $last_dev);

	if ($dev eq "68") {
	    # Demodulator register
	    die if ($tuner_gate);
	    print "demod_read(", $last_reg, ")\n";
	} elsif ($dev eq "60") {
	    # Tuner register

	    # Ignore stuff on the internal tuner->demod bus in Antti's driver
	    next if ($adap eq "m88ds3103");

	    die if (!$tuner_gate);
	    $tuner_gate = 0;
	    print "TUNER_read(", $last_reg, ")\n";
	} else {
	    print "RD ", $adap, " ", $dev, " ", $n, "\n";
	}

    } elsif (/^I2C ([^:]*): WR ([0-9A-Fa-f]{2}) ([0-9]{1,2}) [[]([0-9A-Fa-f]{2,})[]]/) {
	my $adap = $1;
	my $dev = $2;
	my $n = $3;
	my $data = $4;

	$last_adap = $adap;
	$last_dev = $dev;

	die if (int($n) <= 0);
	die if (length($data) != int($n) * 2);

	if ($dev eq "68") {
	    # Demodulator register
	    die if ($tuner_gate);
	    my $reg = substr($data, 0, 2);
	    if ($n == 2 && $data eq "0311") {
		$tuner_gate = 1;
	    } elsif ($n > 1) {
		print "demod_write(", $reg, ", [", substr($data, 2), "])\n";
		$last_dev = 0;
	    } else {
		$last_reg = $reg;
	    }
	} elsif ($dev eq "60") {
	    # Tuner register

	    # Ignore stuff on the internal tuner->demod bus in Antti's driver
	    next if ($adap eq "m88ds3103");

	    die if (!$tuner_gate);
	    my $reg = substr($data, 0, 2);
	    if ($n > 1) {
		print "TUNER_write(", $reg, ", [", substr($data, 2), "])\n";
		$last_dev = 0;
		$tuner_gate = 0;
	    } else {
		$last_reg = $reg;
	    }
	} else {
	    print "WR ", $1, " ", $2, " ", $3, " ", $4, "\n";
	}
    } else {
	print;
	print "\n";
    }
}

  parent reply	other threads:[~2013-11-15  2:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14 23:35 I2C transfer logs for Antti's DS3103 driver and DVBSky's DS3103 driver David Howells
2013-11-14 23:48 ` Antti Palosaari
2013-11-15  2:15 ` David Howells [this message]
2013-11-15 11:33 ` David Howells
2013-11-15 13:06   ` Antti Palosaari
2013-11-15 13:32     ` David Howells
2013-11-15 13:36       ` Devin Heitmueller
2013-11-15 13:54       ` Antti Palosaari
2013-11-15 14:17         ` David Howells
2013-11-15 13:56       ` David Howells
2013-11-15 13:59         ` Antti Palosaari
2013-11-15 14:25           ` David Howells
2013-11-15 14:01         ` David Howells

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=10636.1384481712@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=crope@iki.fi \
    --cc=jarkko_korpi@hotmail.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox