# HG changeset patch # User Daniele Nicolodi # Date 1396278211 -7200 # Node ID f105ac22da056fee3ad472421d3a3ca69845f576 # Parent 0fed60877099c2329fe6812a1fdfb0935d327aac Fixes diff -r 0fed60877099 -r f105ac22da05 kk-data-provider.c --- a/kk-data-provider.c Mon Mar 31 17:03:31 2014 +0200 +++ b/kk-data-provider.c Mon Mar 31 17:03:31 2014 +0200 @@ -39,18 +39,18 @@ /* get serial port name configuration */ rv = Ini_GetStringIntoBuffer(configuration, "KK", "port", port, sizeof(port)); - if (! rv) + if (rv < 1) strncpy(port, DEFAULT_PORT, sizeof(port)); /* channel number */ rv = Ini_GetInt(configuration, "KK", "nchan", &nchan); - if (! rv) + if (rv < 1) nchan = DEFAULT_NCHAN; /* enable scrambler */ rv = Ini_GetInt(configuration, "KK", "scrambler", &scrambler); - if (! rv) - scrambler = FALSE; + if (rv < 1) + scrambler = 0; /* free */ Ini_Dispose(configuration); @@ -140,7 +140,7 @@ /* scrambler */ cmd = "\x50"; cmd[0] += scrambler; - rv = FX_Send("\x50"); + rv = FX_Send(cmd); if (! rv) { SendMessage(mainThreadId, FX_Error()); goto error; @@ -171,7 +171,8 @@ break; } - if (strneq(resp, "2900", 4)) { + /* 2900 with scrambler off or 2910 with scrambler on */ + if (strneq(resp, "29", 2)) { /* timestamp */ gettimeofday(&event.time, NULL); @@ -200,10 +201,8 @@ with some other information */ } else if (strneq(resp, "7020", 4)) { /* undocumented packet. it probably reports the header for - subsequent data packets. match it against expected value */ - if (strcmp(resp + 6, "$2900")) { - SendMessage(mainThreadId, "KK Counter: %s", resp); - } + subsequent data packets */ + SendMessage(mainThreadId, "KK Counter packet header: %s", resp + 7); } else if (strneq(resp, "7F51", 4)) { /* measurement interval synchronized */ SendMessage(mainThreadId, "KK Counter measurement interval synchronized");