Hi,

some further tests on the real hardware showed, that the 2.1.2 version
of player has a regression of no longer be able to connect to a real
Pioneer 3-AT robot.

The problem is within the checksum code for the p2os driver and was
already fixed upstream in svn revisions 7539 and 7543.

I have attached the dpatch, generated out of the upstream changes, that
I am currently using.

Please include this two changes (maybe through the new upstream release
you are asking for).

TIA

Daniel
#! /bin/sh /usr/share/dpatch/dpatch-run
## 04-fixp2oschecksum.dpatch by  <[email protected]>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Cherry pick upstream svn commits 7539 and 7543 to fix
## DP: checksum calculation in the p2os driver

@DPATCH@

diff -Nur player-2.1.2.orig/server/drivers/mixed/p2os/packet.cc 
player-2.1.2/server/drivers/mixed/p2os/packet.cc
--- player-2.1.2.orig/server/drivers/mixed/p2os/packet.cc       2009-01-15 
19:56:08.000000000 +0100
+++ player-2.1.2/server/drivers/mixed/p2os/packet.cc    2009-07-15 
17:24:11.000000000 +0200
@@ -56,14 +56,10 @@
 
 
 bool P2OSPacket::Check() {
-  short chksum;
-  chksum = CalcChkSum();
+  unsigned short recv_chksum = static_cast<unsigned short> (CalcChkSum() & 
0xffff);
+  unsigned short pkt_chksum = (static_cast<unsigned short>(packet[size-2]) << 
8) | packet[size-1];
 
-  if ( chksum == (packet[size-2] << 8 | packet[size-1]))
-    return(true);
-
-
-  return(false);
+  return recv_chksum == pkt_chksum;
 }
 
 int P2OSPacket::CalcChkSum() {
@@ -136,7 +132,7 @@
 }
 
 int P2OSPacket::Build( unsigned char *data, unsigned char datasize ) {
-  short chksum;
+  unsigned short chksum;
 
   size = datasize + 5;
 
@@ -152,7 +148,7 @@
 
   memcpy( &packet[3], data, datasize );
 
-  chksum = CalcChkSum();
+  chksum = static_cast<unsigned short> (CalcChkSum() & 0xffff);
   packet[3+datasize] = chksum >> 8;
   packet[3+datasize+1] = chksum & 0xFF;
 

Attachment: signature.asc
Description: Digital signature

Reply via email to