summaryrefslogtreecommitdiff
path: root/gpsfake
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2006-10-28 16:33:36 +0000
committerEric S. Raymond <esr@thyrsus.com>2006-10-28 16:33:36 +0000
commitac6e993c3b8f4ca6280961c753354ed7e1749ccd (patch)
tree2a2985625ffae9adea577a13b620d2e43738a306 /gpsfake
parentd0edc65590cf2a90440ac97aa29a2b0c737b3146 (diff)
downloadgpsd-ac6e993c3b8f4ca6280961c753354ed7e1749ccd.tar.gz
Add undocumented -f option for J flicker checking.
Diffstat (limited to 'gpsfake')
-rwxr-xr-xgpsfake30
1 files changed, 26 insertions, 4 deletions
diff --git a/gpsfake b/gpsfake
index 8b6ac8e7..67010a05 100755
--- a/gpsfake
+++ b/gpsfake
@@ -46,7 +46,7 @@ class Baton:
return
try:
- (options, arguments) = getopt.getopt(sys.argv[1:], "1bc:D:ghilm:o:pr:s:v")
+ (options, arguments) = getopt.getopt(sys.argv[1:], "1bc:D:fghilm:o:pr:s:v")
except getopt.GetoptError, msg:
print "gpsfake: " + str(msg)
raise SystemExit, 1
@@ -59,6 +59,7 @@ speed = 4800
linedump = False
pipe = False
singleshot = False
+flicker = False
promptme = False
init = "w+r+"
doptions = ""
@@ -73,6 +74,11 @@ for (switch, val) in options:
cycle = float(val)
elif (switch == '-D'):
doptions += " -D " + val
+ elif (switch == '-f'): # Undocumented option for flicker checking
+ flicker = pipe = singleshot = True
+ port = fakeport
+ cycle = 0.05
+ init = "w+"
elif (switch == '-g'):
monitor = "xterm -e gdb -tui --args "
elif (switch == '-i'):
@@ -87,7 +93,10 @@ for (switch, val) in options:
pipe = True
cycle = 0.05
elif (switch == '-r'):
- init = val
+ if flicker:
+ init += val
+ else:
+ init = val
elif (switch == '-s'):
speed = int(val)
elif (switch == '-v'):
@@ -104,7 +113,7 @@ def fakehook(linenumber, fakegps):
return False
if progress:
baton.twirl('*\010')
- else:
+ elif not singleshot:
sys.stderr.write("gpsfake: log cycle begins.\n")
time.sleep(cycle)
if linedump and fakegps.testload.legend:
@@ -126,7 +135,20 @@ if progress:
test = gpsfake.TestSession(prefix=monitor, port=port, options=doptions, verbose=verbose)
-if pipe:
+def flickerdigest(line):
+ if line.startswith("GPSD,Y="):
+ return
+ elif line.startswith("GPSD,O="):
+ fields = line.split()
+ (sentence, time, mode) = (fields[0],fields[1],fields[14])
+ sentence=sentence[7:]
+ sys.stdout.write("sentence=%s, time=%s, mode=%s\n" % (sentence, time, mode))
+ else:
+ sys.stdout.write(line)
+
+if flicker:
+ test.reporter = flickerdigest
+elif pipe:
test.reporter = sys.stdout.write
try: