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: 14970 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1TLwbE-0007k3-2i for patchwork@linuxtv.org; Wed, 10 Oct 2012 15:45:24 +0200 X-tubIT-Incoming-IP: 209.132.180.67 Received: from vger.kernel.org ([209.132.180.67]) by mail.tu-berlin.de (exim-4.75/mailfrontend-4) with esmtp for id 1TLwbD-0007Zf-Ao; Wed, 10 Oct 2012 15:45:23 +0200 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 X-PMX-Version: 5.6.1.2065439, Antispam-Engine: 2.7.2.376379, Antispam-Data: 2012.10.10.133624 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' MULTIPLE_RCPTS 0.1, HTML_00_01 0.05, HTML_00_10 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_2000_2999 0, BODY_SIZE_5000_LESS 0, BODY_SIZE_7000_LESS 0, URI_ENDS_IN_HTML 0, __ANY_URI 0, __CP_URI_IN_BODY 0, __HAS_FROM 0, __HAS_MSGID 0, __HAS_X_MAILER 0, __HAS_X_MAILING_LIST 0, __MIME_TEXT_ONLY 0, __MULTIPLE_RCPTS_CC_X2 0, __SANE_MSGID 0, __STOCK_PHRASE_7 0, __SUBJ_ALPHA_END 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NS ' 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);