From fa168027b31e51af34d768eeb7aa62554ce294f3 Mon Sep 17 00:00:00 2001 From: Andy Bauer Date: Sun, 24 Jan 2016 07:45:04 -0600 Subject: [PATCH] Fix PelcoP checksum calculation --- scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoP.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoP.pm b/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoP.pm index c8fafe023..794393644 100644 --- a/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoP.pm +++ b/scripts/ZoneMinder/lib/ZoneMinder/Control/PelcoP.pm @@ -133,8 +133,10 @@ sub sendCmd my $result = undef; + # Pelco P protocol checksum is created by XOR'ing the first seven bytes in the message + # including the first byte, the STX sync packet my $checksum = 0x00; - for ( my $i = 1; $i < int(@$cmd); $i++ ) + for ( my $i = 0; $i < int(@$cmd); $i++ ) { $checksum ^= $cmd->[$i]; }