From 14107d9b1ddfcfbd739e151e8c5de26d9e657c61 Mon Sep 17 00:00:00 2001 From: Stefan `Sec` Zehl Date: Thu, 5 Jan 2012 12:53:28 +0100 Subject: [PATCH] mesh/dbg.pl: fix dequoting. Add "c"orrupt packet --- tools/mesh/dbg.pl | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/tools/mesh/dbg.pl b/tools/mesh/dbg.pl index 65a64bf..fd90e1e 100755 --- a/tools/mesh/dbg.pl +++ b/tools/mesh/dbg.pl @@ -43,12 +43,12 @@ if($cmd =~ /^r/){ my $rr=""; if (@fh = $sel->can_read(100)) { sysread($fh[0],$rr,1024); - $rr=~s/\\\\/\\/g; $read.=$rr; } }; while ($read =~ s/\\1(.*?)\\0//){ my $str=$1; + $str=~s/\\\\/\\/g; my $cs=substr($str,0,length($str)-2); my $crc=unpack("n",substr($str,length($str)-2,2)); my $crc2= crcccitt($cs),"\n"; @@ -167,6 +167,21 @@ if($cmd =~ /^r/){ $par.=chr(shift); #gen $par.=pack("N",scalar(time)+1*60*60+ 600); + $par.= pack("C",shift||0); + $par.= pack("C",0); + $par.= pack("C",0); + $par.= pack("C",0); + + $par.=pack("N",0); + $par.=pack("N",0); + $par.=pack("N",0); + $par.=pack("N",0); + $par.=pack("N",0); + }elsif($scmd eq "c"){ + $par.="\x1"; + $par.=chr(shift); #gen + $par.=pack("N",scalar(time)+1*60*60+ 600); + $par.= pack("C",shift||0); $par.= pack("C",0); $par.= pack("C",0);