comparison server/utils.py @ 331:5de3fc71ce48

- Make the python work on openwrt - main.c: Stay awake for testing print CRC as unsigned
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Jun 2012 23:05:35 +0800
parents 7ac6b8846eea
children d3e5934fe55c
comparison
equal deleted inserted replaced
330:7ac6b8846eea 331:5de3fc71ce48
1 import os 1 import os
2 import sys 2 import sys
3 import ctypes 3 #import ctypes
4 import time 4 import time
5 import select 5 import select
6 6
7 lightblue = None 7 lightblue = None
8 try: 8 try:
14 READLINE_SELECT_TIMEOUT = 20 14 READLINE_SELECT_TIMEOUT = 20
15 15
16 __all__ = ('monotonic_time', 'retry') 16 __all__ = ('monotonic_time', 'retry')
17 17
18 clock_gettime = None 18 clock_gettime = None
19 no_clock_gettime = False 19 no_clock_gettime = True
20 def monotonic_time(): 20 def monotonic_time():
21 global clock_gettime 21 global clock_gettime
22 global no_clock_gettime 22 global no_clock_gettime
23 if no_clock_gettime: 23 if no_clock_gettime:
24 return time.time() 24 return time.time()
75 # lightblue timeout 75 # lightblue timeout
76 return None 76 return None
77 if c == '\r': 77 if c == '\r':
78 continue 78 continue
79 79
80 buf.append(c) 80 buf += c
81 if c == '\n': 81 if c == '\n':
82 return buf 82 return buf
83 83