]> jspc29.x-matter.uni-frankfurt.de Git - trbnettools.git/commitdiff
update
authorhadaq <hadaq>
Wed, 21 Jul 2010 12:59:15 +0000 (12:59 +0000)
committerhadaq <hadaq>
Wed, 21 Jul 2010 12:59:15 +0000 (12:59 +0000)
trbrich/trbrichcmd.c

index bcacc81ab854efda281a14a528da143da7927165..f775c17de56bcb168a0541b731868dd6e417c5ac 100644 (file)
@@ -15,7 +15,7 @@
 
 static const uint16_t BroadCastRich = 0xfffb;
 
-static const char trbrichcmd_version[] = "$Revision: 1.11 $"; 
+static const char trbrichcmd_version[] = "$Revision: 1.12 $"; 
 
 static const uint16_t adcm_uid_register = 0xc000;
 
@@ -291,6 +291,7 @@ int main(int argc, char** argv)
     uint16_t trb_address = BroadCastRich;
     int status = 0;
     unsigned int timeOut = 0;
+    int success = 0;
     
     if (argc - optind == 2) {
       trb_address = (uint16_t)strtoul(argv[optind + 1], NULL, 0);
@@ -318,6 +319,7 @@ int main(int argc, char** argv)
       
       tmp = buffer;
       end = buffer + status;
+      success = 1;
       while (tmp < end) {
         unsigned int len = *tmp >> 16;
         uint16_t endPoint = *tmp & 0xffff;
@@ -331,10 +333,15 @@ int main(int argc, char** argv)
                     "TimeOut: %d Sync Failed on EndPoint: "
                     "0x%04x APV#: %02d\n", 
                     timeOut, endPoint, ((*tmp >> 16) &0xf)); 
+            success = 0;
           }
         }
       }
       timeOut++;
+      if (success == 1) break;
+    }
+    if (success == 0) {
+      fprintf(stderr, "sync_apv failed\n");
     }
     free(buffer);