Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for Sierra Wireless qcserial NMEA-0183 interface #54

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <pwd.h>

#define DEFSERIALQSIZE 32
#define SIERRA_GPS_START "$GPS_START\n"

struct if_serial {
int fd;
Expand Down Expand Up @@ -290,7 +291,8 @@ struct iface *init_serial (struct iface *ifa)
int ret;
struct kopts *opt;
int qsize=DEFSERIALQSIZE;

int send_gps_start = 0;

for(opt=ifa->options;opt;opt=opt->next) {
if (!strcasecmp(opt->var,"filename"))
devname=opt->val;
Expand Down Expand Up @@ -324,7 +326,9 @@ struct iface *init_serial (struct iface *ifa)
logerr(0,"Invalid queue size specified: %s",opt->val);
return(NULL);
}
} else {
} else if (!strcasecmp(opt->var, "sierragpsstart")) {
send_gps_start=atoi(opt->val);
} else {
logerr(0,"unknown interface option %s",opt->var);
return(NULL);
}
Expand All @@ -337,7 +341,7 @@ struct iface *init_serial (struct iface *ifa)
}

/* Open interface or die */
if ((ifs->fd=ttyopen(devname,ifa->direction)) < 0) {
if ((ifs->fd=ttyopen(devname, send_gps_start?BOTH:ifa->direction)) < 0) {
return(NULL);
}
DEBUG(3,"%s: opened serial device %s for %s",ifa->name,devname,
Expand All @@ -358,6 +362,9 @@ struct iface *init_serial (struct iface *ifa)
ifs->saved=1;
ifs->slavename=NULL;

if (send_gps_start)
write(ifs->fd, SIERRA_GPS_START, strlen(SIERRA_GPS_START));

/* Assign pointers to read, write and cleanup routines */
ifa->read=do_read;
ifa->readbuf=read_serial;
Expand Down