# HG changeset patch # User Matt Johnston # Date 1338995135 -28800 # Node ID 5de3fc71ce484700976fe56df57c5a13d6ef5009 # Parent 7ac6b8846eea3bea5637b55d02723cd5635e6e1b - Make the python work on openwrt - main.c: Stay awake for testing print CRC as unsigned diff -r 7ac6b8846eea -r 5de3fc71ce48 main.c --- a/main.c Wed Jun 06 22:32:49 2012 +0800 +++ b/main.c Wed Jun 06 23:05:35 2012 +0800 @@ -36,7 +36,7 @@ // limited to uint16_t for now #define COMMS_WAKE 3600 -#define WAKE_SECS 30 +#define WAKE_SECS 250 // XXX testing #define BAUD 19200 #define UBRR ((F_CPU)/8/(BAUD)-1) @@ -249,7 +249,7 @@ fputc('\n', crc_stdout); } fprintf_P(crc_stdout, PSTR("END\n")); - fprintf_P(stdout, PSTR("CRC=%d\n"), crc_out); + fprintf_P(stdout, PSTR("CRC=%hu\n"), crc_out); } static void @@ -745,6 +745,8 @@ sei(); + need_comms = 1; + #if 0 for (;;) { diff -r 7ac6b8846eea -r 5de3fc71ce48 server/ts.py --- a/server/ts.py Wed Jun 06 22:32:49 2012 +0800 +++ b/server/ts.py Wed Jun 06 23:05:35 2012 +0800 @@ -11,7 +11,7 @@ TESTING = True import sys -import httplib +#import httplib import time import traceback @@ -34,8 +34,6 @@ s.setblocking(False) - time.sleep(30) - return s # from http://blog.stalkr.net/2011/04/pctf-2011-32-thats-no-bluetooth.html @@ -87,6 +85,7 @@ recv_crc = None try: k, v = l.rstrip('\n').split('=') + print k,v if k == 'CRC': recv_crc = int(v) if recv_crc < 0 or recv_crc > 0xffff: @@ -122,6 +121,7 @@ return int(next_wake) def do_comms(sock): + print "do_comms" d = None # serial could be unreliable, try a few times for i in range(FETCH_TRIES): diff -r 7ac6b8846eea -r 5de3fc71ce48 server/utils.py --- a/server/utils.py Wed Jun 06 22:32:49 2012 +0800 +++ b/server/utils.py Wed Jun 06 23:05:35 2012 +0800 @@ -1,6 +1,6 @@ import os import sys -import ctypes +#import ctypes import time import select @@ -16,7 +16,7 @@ __all__ = ('monotonic_time', 'retry') clock_gettime = None -no_clock_gettime = False +no_clock_gettime = True def monotonic_time(): global clock_gettime global no_clock_gettime @@ -77,7 +77,7 @@ if c == '\r': continue - buf.append(c) + buf += c if c == '\n': return buf