From patchwork Wed Oct 10 13:39:21 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Antonio Ospite X-Patchwork-Id: 1573861 Return-Path: X-Original-To: patchwork-linux-media@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 788B040135 for ; Wed, 10 Oct 2012 13:45:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756359Ab2JJNpU (ORCPT ); Wed, 10 Oct 2012 09:45:20 -0400 Received: from smtp207.alice.it ([82.57.200.103]:54917 "EHLO smtp207.alice.it" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756334Ab2JJNpT (ORCPT ); Wed, 10 Oct 2012 09:45:19 -0400 Received: from jcn (87.1.92.64) by smtp207.alice.it (8.6.023.02) id 504697000562F2F5; Wed, 10 Oct 2012 15:39:28 +0200 Received: from ao2 by jcn with local (Exim 4.80) (envelope-from ) id 1TLwVR-00039z-IE; Wed, 10 Oct 2012 15:39:25 +0200 From: Antonio Ospite To: linux-media@vger.kernel.org Cc: Aapo Tahkola , Antonio Ospite , CityK Subject: [PATCH 4/5] m920x_parse.pl: fix strict and warnings checks Date: Wed, 10 Oct 2012 15:39:21 +0200 Message-Id: <1349876363-12098-5-git-send-email-ospite@studenti.unina.it> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1349876363-12098-1-git-send-email-ospite@studenti.unina.it> References: <1349876363-12098-1-git-send-email-ospite@studenti.unina.it> X-Face: z*RaLf`X<@C75u6Ig9}{oW$H; 1_\2t5)({*|jhM/Vb; ]yA5\I~93>J<_`<4)A{':UrE Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Signed-off-by: Antonio Ospite --- contrib/m920x/m920x_parse.pl | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/contrib/m920x/m920x_parse.pl b/contrib/m920x/m920x_parse.pl index 9093e16..b315400 100755 --- a/contrib/m920x/m920x_parse.pl +++ b/contrib/m920x/m920x_parse.pl @@ -3,8 +3,15 @@ # This ULi M920x specific script processes usbsnoop log files (as well as those which have been parsed by mrec's parser.pl utility). # Taken from http://www.linuxtv.org/wiki/index.php/ULi_M920x_parse +use strict; +use warnings; use Getopt::Std; +my $line; +my $mode; +my $input; +my %opt; + sub expand_string { my @arr = (); my ($str) = @_; @@ -85,6 +92,7 @@ sub get_line { my @ret; my @cmp; my $i; + my $foo; again: while($line = ) { @@ -169,32 +177,34 @@ if ($mode ne "fw" && $mode ne "i2c") { usage(); } +my @bytes; + if ($mode eq "fw") { - open(out, ">fw") || die "Can't open fw"; + open(OUT, ">", "fw") || die "Can't open fw"; while(@bytes = get_line()) { if(scalar(@bytes) <= 1) { last; } - $len = hex($bytes[6] . $bytes[7]); + my $len = hex($bytes[6] . $bytes[7]); if ($len < 32) { next; } - @fw_bytes = us_get_write(); + my @fw_bytes = us_get_write(); if ($len != scalar(@fw_bytes)) { #note: usbmon will not log bulk writes longer than 32 bytes by default print "bulk size doesn't match! Check usbmon.\n"; print $len . " != " . scalar(@fw_bytes) . "\n"; exit(0); } - print out pack("v", hex($bytes[2] . $bytes[3])); - print out pack("v", hex($bytes[4] . $bytes[5])); - print out pack("v", scalar(@fw_bytes)); + print OUT pack("v", hex($bytes[2] . $bytes[3])); + print OUT pack("v", hex($bytes[4] . $bytes[5])); + print OUT pack("v", scalar(@fw_bytes)); foreach(@fw_bytes) { - print out pack("C", hex($_)); + print OUT pack("C", hex($_)); } } exit(1); @@ -205,7 +215,7 @@ while(@bytes = get_line("-1")) { last; } - $master_line = $. - 1; + my $master_line = $. - 1; if ($bytes[0] eq "40" && $bytes[1] eq "23") { @@ -224,7 +234,7 @@ while(@bytes = get_line("-1")) { @bytes = get_line("40 23"); - $reg = $bytes[2]; + my $reg = $bytes[2]; if ($bytes[4] eq "80") { $multibyte = 1; } else { @@ -236,7 +246,7 @@ while(@bytes = get_line("-1")) { if ($bytes[4] eq "80") { if ($multibyte == 0) { - $raddr = sprintf("%02x", hex($addr) | 0x1); + my $raddr = sprintf("%02x", hex($addr) | 0x1); check("40 23 $raddr 00 80 00 00 00", @bytes);