Revision: 9068
          http://playerstage.svn.sourceforge.net/playerstage/?rev=9068&view=rev
Author:   jpgr87
Date:     2011-08-04 21:53:43 +0000 (Thu, 04 Aug 2011)

Log Message:
-----------
Applied patch #3385742: yet another compatibility patch

Modified Paths:
--------------
    code/player/trunk/server/drivers/mixed/rmp/segwayrmp.cc
    code/player/trunk/server/drivers/mixed/rmp/usb_packet.cc
    code/player/trunk/server/drivers/mixed/rmp/usb_packet.h

Modified: code/player/trunk/server/drivers/mixed/rmp/segwayrmp.cc
===================================================================
--- code/player/trunk/server/drivers/mixed/rmp/segwayrmp.cc     2011-07-24 
18:34:54 UTC (rev 9067)
+++ code/player/trunk/server/drivers/mixed/rmp/segwayrmp.cc     2011-08-04 
21:53:43 UTC (rev 9068)
@@ -1260,7 +1260,7 @@
 SegwayRMP::Diff(uint32_t from, uint32_t to, bool first)
 {
        int diff1, diff2;
-       static uint32_t max = (uint32_t)pow(2,32)-1;
+       static uint32_t max = (uint32_t)pow(2.0,32)-1;
 
        // if this is the first time, report no change
        if(first)

Modified: code/player/trunk/server/drivers/mixed/rmp/usb_packet.cc
===================================================================
--- code/player/trunk/server/drivers/mixed/rmp/usb_packet.cc    2011-07-24 
18:34:54 UTC (rev 9067)
+++ code/player/trunk/server/drivers/mixed/rmp/usb_packet.cc    2011-08-04 
21:53:43 UTC (rev 9068)
@@ -27,18 +27,19 @@
 #include <stdio.h>
 #include <termios.h>
 #include <sys/time.h>
+#include <replace/replace.h>
 #include "usb_packet.h"
 
 
 USBpacket::USBpacket( ) {
-       pkt.usb_message_header = 0xf0;
-       pkt.usb_command_identifier = 0x55;
+       pkt.pkt.usb_message_header = 0xf0;
+       pkt.pkt.usb_command_identifier = 0x55;
        // the docs say send 0x01 but the sample code sends a 0
-       pkt.command_type = 0;
-       pkt.unused0 = 0;
-       pkt.unused1 = 0;
-       pkt.unused2 = 0;
-       pkt.unused3 = 0;
+       pkt.pkt.command_type = 0;
+       pkt.pkt.unused0 = 0;
+       pkt.pkt.unused1 = 0;
+       pkt.pkt.unused2 = 0;
+       pkt.pkt.unused3 = 0;
 
        return;
 }
@@ -65,18 +66,18 @@
 
 
 USBpacket::USBpacket( const CanPacket &can ) {
-       pkt.usb_message_header = 0xf0;
-       pkt.usb_command_identifier = 0x55;
+       pkt.pkt.usb_message_header = 0xf0;
+       pkt.pkt.usb_command_identifier = 0x55;
        // the docs say send 0x01 but the sample code sends a 0
-       pkt.command_type = 0;
-       pkt.unused0 = 0;
-       pkt.unused1 = 0;
-       pkt.unused2 = 0;
-       pkt.can_message_header = make_can_header( can.id, can.dlc, can.flags );
-       pkt.unused3 = 0;
-       memcpy( pkt.can_message, can.msg, sizeof(pkt.can_message) );
+       pkt.pkt.command_type = 0;
+       pkt.pkt.unused0 = 0;
+       pkt.pkt.unused1 = 0;
+       pkt.pkt.unused2 = 0;
+       pkt.pkt.can_message_header = make_can_header( can.id, can.dlc, 
can.flags );
+       pkt.pkt.unused3 = 0;
+       memcpy( pkt.pkt.can_message, can.msg, sizeof(pkt.pkt.can_message) );
 
-       pkt.usb_message_checksum = compute_checksum();
+       pkt.pkt.usb_message_checksum = compute_checksum();
        return;
 }
 
@@ -84,8 +85,8 @@
        CanPacket can;
        unsigned short hi, lo;
        /* not really a CANBUS header
-        can.id = pkt.can_message_header >> 5;
-       can.dlc = pkt.can_message_header & 0x000f;
+        can.id = pkt.pkt.can_message_header >> 5;
+       can.dlc = pkt.pkt.can_message_header & 0x000f;
         */
        hi = pkt.pkt_data[5];
        hi = (hi>>5) & 0x0007;
@@ -93,16 +94,16 @@
        lo = (lo<<3);
        can.id = ( hi | lo ) & 0x0fff;
 
-       if( pkt.can_message_header & 0x0010 )
+       if( pkt.pkt.can_message_header & 0x0010 )
                can.flags = canMSG_RTR;
        else
                can.flags = canMSG_STD;
-       memcpy( can.msg, pkt.can_message, sizeof(can.msg) );
+       memcpy( can.msg, pkt.pkt.can_message, sizeof(can.msg) );
        return can;
 }
 
 bool USBpacket::check() {
-       return compute_checksum() == pkt.usb_message_checksum;
+       return compute_checksum() == pkt.pkt.usb_message_checksum;
 }
 
 unsigned char USBpacket:: compute_checksum() {
@@ -210,7 +211,7 @@
                }
 
 
-               if( p.pkt.usb_message_header != 0xf0 )
+               if( p.pkt.pkt.usb_message_header != 0xf0 )
                        synced = false;
                else if( !p.check() )
                        continue;
@@ -235,7 +236,7 @@
                gettimeofday( &now, 0 );
        }
 
-       return (int) (p.pkt.can_message_header & 0x000f);
+       return (int) (p.pkt.pkt.can_message_header & 0x000f);
 }
 
 int USBIO::SyncRead( USBpacket &p ) {

Modified: code/player/trunk/server/drivers/mixed/rmp/usb_packet.h
===================================================================
--- code/player/trunk/server/drivers/mixed/rmp/usb_packet.h     2011-07-24 
18:34:54 UTC (rev 9067)
+++ code/player/trunk/server/drivers/mixed/rmp/usb_packet.h     2011-08-04 
21:53:43 UTC (rev 9068)
@@ -26,22 +26,23 @@
 #include "canio.h"
 #include <libplayercommon/playercommon.h>
 
-typedef struct usb_packet {
-       union {
+
+struct usb_struct {
+       unsigned char usb_message_header;
+       unsigned char usb_command_identifier;
+       unsigned char command_type;
+       unsigned char unused0;
+       unsigned char unused1;
+       unsigned char unused2;
+       unsigned short can_message_header;
+       unsigned char unused3;
+       unsigned char can_message[8];
+       unsigned char usb_message_checksum;
+};
+
+typedef union usb_packet {
                unsigned char pkt_data[18];
-               struct {
-                       unsigned char usb_message_header;
-                       unsigned char usb_command_identifier;
-                       unsigned char command_type;
-                       unsigned char unused0;
-                       unsigned char unused1;
-                       unsigned char unused2;
-                       unsigned short can_message_header;
-                       unsigned char unused3;
-                       unsigned char can_message[8];
-                       unsigned char usb_message_checksum;
-               };
-       };
+               struct usb_struct pkt;
 } usb_packet_t;
 
 class USBpacket {


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
_______________________________________________
Playerstage-commit mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/playerstage-commit

Reply via email to