summaryrefslogtreecommitdiff
path: root/sirf.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-01-06 15:30:38 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-01-06 15:30:38 +0000
commitcbc05c4883051d6fbb7b4d72f0016543d6f4370d (patch)
treefd295e40367e801e66a57388a35152881e47a03d /sirf.c
parent649df04ceb10762b70916d9c58bbc86179fb8896 (diff)
downloadgpsd-cbc05c4883051d6fbb7b4d72f0016543d6f4370d.tar.gz
A control_send method for the SiRf driver.
Diffstat (limited to 'sirf.c')
-rw-r--r--sirf.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sirf.c b/sirf.c
index 00183290..2cc26704 100644
--- a/sirf.c
+++ b/sirf.c
@@ -124,6 +124,20 @@ bool sirf_write(int fd, unsigned char *msg) {
return(ok);
}
+static ssize_t sirf_control_send(struct gps_device_t *session, char *msg, size_t len) {
+ /*@ +charint +matchanyintegral -initallelements @*/
+ static unsigned char buf[MAX_PACKET_LENGTH] = {0xa0, 0xa2,};
+
+ buf[2] = (len >> 8) & 0xff;
+ buf[3] = len & 0xff;
+ memcpy(buf+4, msg, len);
+ buf[len + 6] = 0xb0;
+ buf[len + 7] = 0xb3;
+
+ return sirf_write(session->gpsdata.gps_fd, buf) ? (len + 8) : -1;
+ /*@ -charint -matchanyintegral +initallelements @*/
+}
+
static bool sirf_speed(int ttyfd, speed_t speed)
/* change speed in binary mode */
{
@@ -963,7 +977,7 @@ struct gps_type_t sirf_binary =
.type_name = "SiRF binary", /* full name of type */
.trigger = NULL, /* no trigger */
.channels = SIRF_CHANNELS, /* consumer-grade GPS */
- .control_send = NULL, /* no control sender yet */
+ .control_send = sirf_control_send,/* how to send a control string */
.probe_wakeup = NULL, /* no wakeup to be done before hunt */
.probe_detect = NULL, /* no probe */
.probe_subtype = NULL, /* can't probe more in NMEA mode */