[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gpsd-users] Proposed 9600 baud option for gpspipe
From: |
IT1 Stuart Blake Tener, USNR |
Subject: |
[gpsd-users] Proposed 9600 baud option for gpspipe |
Date: |
Thu, 27 Jun 2013 08:07:10 -0400 |
User-agent: |
Internet Messaging Program (IMP) H3 (4.3.9) |
List members,
After a quick non invasive look at gpspipe code, I could not see why
it spits the first batch of JSON code in "-r" mode (I only figure it
must be buried in the libgps code somewhere I guess), however, I was
able to generate some code that would offer up the 9600 baud option.
Here are a set of proposed patches to gpspipe that would add the 9600
baud command line switch "-9". These were generated using the 3.9 code
base.
It's not that often that I have reason to sit and write code these
days (scripts at most, as a UNIX Admin), but boy, several cups of
strong coffee (yeah, yeah, I know I use a Keurig machine, so what, its
convenient, ok?) and some source code to modify...it's a good day! :)
I also added the comments, not because I am interested in credit for
my work, so much as not wanting to have lowly my code appear as if it
is the work of far better programmers than I.
--- gpspipe.c.org 2013-06-21 13:31:50.073470368 -0400
+++ gpspipe.c 2013-06-27 08:05:39.529346405 -0400
@@ -18,6 +18,9 @@
*
* Original code by: Gary E. Miller <address@hidden>. Cleanup by ESR.
*
+ * Modifications to add 9600 baud command line option added 27 JUN 2013
+ * By IT1 Stuart Blake Tener, N3GWG <address@hidden>
+ *
* This file is Copyright (c) 2010 by the GPSD project
* BSD terms apply: see the file COPYING in the distribution root
for details.
*
@@ -48,6 +51,8 @@
/* NMEA-0183 standard baud rate */
#define BAUDRATE B4800
+#define BAUDRATE2 B9600
+bool baud9600 = false;
/* Serial port variables */
static struct termios oldtio, newtio;
@@ -79,7 +84,14 @@
/* make it raw */
(void)cfmakeraw(&newtio);
/* set speed */
- /address@hidden@*/ (void)cfsetospeed(&newtio, BAUDRATE);
+ if (baud9600)
+ {
+ /address@hidden@*/ (void)cfsetospeed(&newtio, BAUDRATE2);
+ }
+ else
+ {
+ /address@hidden@*/ (void)cfsetospeed(&newtio, BAUDRATE);
+ }
/* Clear the modem line and activate the settings for the port. */
(void)tcflush(fd_out, TCIFLUSH);
@@ -105,6 +117,7 @@
"-T [format] set the timestamp format (strftime(3)-like; implies
'-t')\n"
"-u usec time stamp, implies -t. Use -uu to output sec.usec\n"
"-s [serial dev] emulate a 4800bps NMEA GPS on serial port (use
with '-r').\n"
+ "-9 instruct gpspipe to use 9600bps instead of 4800bps if -s is
being used.\n"
"-n [count] exit after count packets.\n"
"-v Print a little spinner.\n"
"-p Include profiling info in the JSON.\n"
@@ -141,7 +154,7 @@
/address@hidden@*/
flags = WATCH_ENABLE;
- while ((option = getopt(argc, argv, "?dD:lhrRwStT:vVn:s:o:pu")) != -1) {
+ while ((option = getopt(argc, argv, "?dD:9lhrRwStT:vVn:s:o:pu")) != -1) {
switch (option) {
case 'D':
debug = atoi(optarg);
@@ -201,6 +214,9 @@
case 's':
serialport = optarg;
break;
+ case '9':
+ baud9600 = true;
+ break;
case 'o':
outfile = optarg;
break;
V/R and 73,
Stuart, N3GWG
--
IT1 Stuart Blake Tener, USNR, N3GWG (Extra), MROP
NR N-NC JTF EAST DET UIC 84245
Las Vegas, NV / Boulder, CO / Philadelphia, PA / Beverly Hills, CA
(310) 358-0202 Mobile Phone
(215) 338-6005 Google Voice
e-mail: address@hidden
- [gpsd-users] Proposed 9600 baud option for gpspipe,
IT1 Stuart Blake Tener, USNR <=