1
|
#!/bin/sh
|
2
|
#
|
3
|
# Kneel to zod. :-(
|
4
|
#
|
5
|
# The unit powers on in NMEA mode at 4800bps. Ensure our rate is matched.
|
6
|
# If the Jupiter unit has been cold started, it may be necessary to
|
7
|
# reset its RTC contents to get correct time output.
|
8
|
# If NTPD itself has reconfigured the receiver, all bets are off;
|
9
|
# you will either need to reconfigure it manually, or wait for
|
10
|
# a full GPS cold start?
|
11
|
#
|
12
|
zoddev=/dev/cuau0
|
13
|
|
14
|
_zod_1330_set_port1_9600='\x32\x05\x00\x00\x01\x00\x01\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xf8\xff'
|
15
|
|
16
|
# Get-out clause:
|
17
|
#_zod_revert_nmea='\x33\x05\x00\x00\x00\x00\x01\x00\xff\xff'
|
18
|
#gpsctl -f -t Zodiac -x $_zod_revert_nmea ${PORT}
|
19
|
|
20
|
stty < ${zoddev}.init speed 4800
|
21
|
stty < ${zoddev}.lock speed 4800
|
22
|
|
23
|
# Perform a full bootstrap. Reset the UTC time to what we have.
|
24
|
# This requires exact arguments (and UTC time) -- see strftime(3).
|
25
|
# This will also reset the unit to 4800bps if it was in another mode.
|
26
|
# NOTE: This should probably be done after 'ntpdate' against
|
27
|
# a trusted reliable source.
|
28
|
ntpdate -bvu 192.168.1.250
|
29
|
_zod_time=$(date -u '+%H%M%S')
|
30
|
_zod_date=$(date -u '+%d%m%g')
|
31
|
printf > ${zoddev} '$PRWIINIT,A,,,,,,,,,,,,%s,%s\r\n' $_zod_time $_zod_date
|
32
|
|
33
|
## Perform only a soft set of the date and time
|
34
|
#printf > ${zoddev} '$PRWIINIT,V,,,,,,,,,,,,%s,%s\r\n' $_zod_time $_zod_date
|
35
|
|
36
|
# Put the unit into ZODIAC binary mode at 4800bps.
|
37
|
printf > ${zoddev} '$PRWIIPRO,,RBIN\r\n'
|
38
|
|
39
|
# Take the unit into 9600bps in binary mode.
|
40
|
# I'm not convinced that gpsctl does this correctly automatically,
|
41
|
# so send it a raw ZODIAC packet, trusting it to compute the header OK.
|
42
|
gpsctl -f -t Zodiac -x $_zod_1330_set_port1_9600 ${zoddev}
|
43
|
|
44
|
# Finally, leave rate set to 9600 for ntpd.
|
45
|
stty < ${zoddev}.init speed 9600
|
46
|
stty < ${zoddev}.lock speed 9600
|