diff -u ./Makefile ../garble-1.0.1/Makefile --- ./Makefile Mon Feb 21 01:21:08 2000 +++ ../garble-1.0.1/Makefile Tue May 30 11:23:14 2000 @@ -1,5 +1,5 @@ # Garble-C++ Makefile -# $Id: Makefile,v 1.1.1.1 2000/02/21 06:17:19 decouto Exp $ +# $Id: Makefile,v 1.2 2000/05/23 18:07:35 decouto Exp $ GARMIN_SRCS = \ garmin_application.cp \ @@ -58,34 +58,3 @@ echo "unix serial:" $(UNIX_SERIAL_OBJS) echo "test:" $(TEST_OBJS) -# DO NOT DELETE - -test.o: ../../serial-src/unix/serial.h /usr/include/string.h -test.o: /usr/include/features.h /usr/include/sys/cdefs.h -test.o: /usr/include/gnu/stubs.h -test.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h -test.o: garmin_serial_unix.h garmin_phys.h garmin_types.h garmin_error.h -test.o: garmin_link.h garmin_packet.h garmin_application.h garmin_util.h -garmin_application.o: garmin_application.h garmin_link.h garmin_phys.h -garmin_application.o: garmin_types.h garmin_error.h garmin_packet.h -garmin_application.o: garmin_command.h garmin_util.h -garmin_link.o: garmin_link.h garmin_phys.h garmin_types.h garmin_error.h -garmin_link.o: garmin_packet.h -garmin_util.o: garmin_types.h garmin_util.h -garmin_serial_unix.o: garmin_serial_unix.h garmin_phys.h garmin_types.h -garmin_serial_unix.o: garmin_error.h /usr/include/fcntl.h -garmin_serial_unix.o: /usr/include/features.h /usr/include/sys/cdefs.h -garmin_serial_unix.o: /usr/include/gnu/stubs.h /usr/include/bits/fcntl.h -garmin_serial_unix.o: /usr/include/sys/types.h /usr/include/bits/types.h -garmin_serial_unix.o: /usr/lib/gcc-lib/i386-redhat-linux/egcs-2.91.66/include/stddef.h -garmin_serial_unix.o: /usr/include/time.h /usr/include/endian.h -garmin_serial_unix.o: /usr/include/bits/endian.h /usr/include/sys/select.h -garmin_serial_unix.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -garmin_serial_unix.o: /usr/include/sys/sysmacros.h /usr/include/termios.h -garmin_serial_unix.o: /usr/include/bits/termios.h -garmin_serial_unix.o: /usr/include/sys/ttydefaults.h /usr/include/unistd.h -garmin_serial_unix.o: /usr/include/bits/posix_opt.h -garmin_serial_unix.o: /usr/include/bits/confname.h /usr/include/getopt.h -garmin_serial_unix.o: /usr/include/errno.h /usr/include/bits/errno.h -garmin_serial_unix.o: /usr/include/linux/errno.h /usr/include/asm/errno.h -garmin_serial_unix.o: /usr/include/string.h diff -u ./README ../garble-1.0.1/README --- ./README Mon Feb 21 01:21:08 2000 +++ ../garble-1.0.1/README Tue May 30 11:23:14 2000 @@ -1,10 +1,10 @@ -$Id: README,v 1.2 2000/02/21 06:20:39 decouto Exp $ +$Id: README,v 1.3 2000/05/29 18:08:35 decouto Exp $ -21 Feburary 2000 +29 May 2000 Douglas S. J. De Couto decouto@lcs.mit.edu -README -- Garble v1.0 +README -- Garble v1.0.1 http://www.pdos.lcs.mit.edu/~decouto/garble Contents: @@ -17,6 +17,8 @@ 6. The Insides 7. Mailing Lists / Contact 8. Source Code +9. Changes in New Version + 0. License @@ -48,7 +50,7 @@ 2. Compatibility and Feature -Garble v1.0 supports downloading waypoints, proximity waypoints, +Garble v1.0.1 supports downloading waypoints, proximity waypoints, routes, and track data from most Garmin GPS units. The underlying library supports uploading waypoints, proximity waypoints, and routes to GPS 12, GPS 12 XL, GPS 48, GPS II Plus, GPS 128 models, although @@ -123,13 +125,13 @@ untar and gunzip the archive, e.g. -gzip -d garble-1.0.tar.gz -tar xf garble-1.0.tar +gzip -d garble-1.0.1.tar.gz +tar xf garble-1.0.1.tar If you are running Linux on an i386, it is very simple: -Type "make" in the garble-1.0 directory, it should give you an -executable named garble in that directory. That's it! +Type "make dep; make" in the garble-1.0.1 directory, it should give you +an executable named garble in that directory. That's it! If you are running on a different architecture, e.g. PowerPC, change the CPPFLAGS line in the Makefile to have -DDO_BYTE_SWAP instead of @@ -181,10 +183,6 @@ garble-users-request, or garble-announce-requests, all @lists.sourceforge.net for information. -The web site isn't really going yet, but -http://www.pdos.lcs.mit.edu/~decouto/garble will eventually have -something going. - I can be contacted personally at decouto@lcs.mit.edu Please let me know if you have any comments! @@ -196,5 +194,15 @@ module garble/garble-src; see http://sfdocs.sourceforge.net/sfdocs/site/cvs.php for more information. + + +9. Changes in New Version + +Version 1.0.1 is a bug fix from version 1.0, which makes Garble work +even with serial port devices which are normally ``cooked'' -- that +is, they perform some form of processing on serial port data. One +work around is to use raw devies (e.g. /dev/cua0), or to ``stty -f +/dev/gps raw'' (or the appropriate device if you are not using +/dev/gps). Only in .: garble-src diff -u ./garble.cp ../garble-1.0.1/garble.cp --- ./garble.cp Mon Feb 21 01:21:08 2000 +++ ../garble-1.0.1/garble.cp Tue May 30 11:23:14 2000 @@ -1,4 +1,4 @@ -// $Id: garble.cp,v 1.1.1.1 2000/02/21 06:17:24 decouto Exp $ +// $Id: garble.cp,v 1.2 2000/05/29 18:08:35 decouto Exp $ // garble.cp // Douglas S. J. De Couto // 17 February 2000 @@ -20,7 +20,9 @@ // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -static const char *garble_version = "$Id: garble.cp,v 1.1.1.1 2000/02/21 06:17:24 decouto Exp $"; +// $Id: garble.cp,v 1.2 2000/05/29 18:08:35 decouto Exp $ + +static const char *garble_version = "Garble v1.0.1 29 May 2000"; #include diff -u ./garmin_serial_unix.cp ../garble-1.0.1/garmin_serial_unix.cp --- ./garmin_serial_unix.cp Mon Feb 21 01:21:08 2000 +++ ../garble-1.0.1/garmin_serial_unix.cp Tue May 30 11:23:15 2000 @@ -1,4 +1,4 @@ -// $Id: garmin_serial_unix.cp,v 1.1.1.1 2000/02/21 06:17:23 decouto Exp $ +// $Id: garmin_serial_unix.cp,v 1.2 2000/05/23 18:07:35 decouto Exp $ // garmin_serial_unix.cp // Douglas S. J. De Couto // February 13, 2000 @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -62,24 +61,25 @@ } m_timeout = timeout; m_port_dev = port_dev; - m_fd = open(m_port_dev.c_str(), O_RDWR); + m_fd = open(m_port_dev.c_str(), O_RDWR | O_NOCTTY); if (m_fd == -1) throw garmin::not_possible(m_build_err_string("Unable to open serial port device ")); // set proper speed, parity, char size int err; - struct termios options; - err = tcgetattr(m_fd, &options); + err = tcgetattr(m_fd, &m_old_options); if (err == -1) - throw garmin::not_possible(m_build_err_string("Unable to get device options for ")); - + throw garmin::not_possible(m_build_err_string("Unable to get old device options for ")); + + struct termios options; + memset(&options, 0, sizeof(options)); options.c_cflag |= (CLOCAL | CREAD); // enable local mode, reading characters // speed, 9600 bps for garmin physical layer err = cfsetispeed(&options, B9600); if (err == -1) - throw garmin::not_possible(m_build_err_string("Unable to set output speed to 9600 bps for ")); + throw garmin::not_possible(m_build_err_string("Unable to set input speed to 9600 bps for ")); err = cfsetospeed(&options, B9600); if (err == -1) @@ -97,7 +97,7 @@ // set the new options err = tcsetattr(m_fd, TCSADRAIN, &options); if (err == -1) - throw garmin::not_possible(string("Unable to set device options for ")); + throw garmin::not_possible(m_build_err_string("Unable to set device options for ")); m_init = true; } @@ -163,9 +163,14 @@ garmin_serial::~garmin_serial() { if (m_init) { - int err = close(m_fd); + // reset port to how we found it + int err = tcsetattr(m_fd, TCSADRAIN, &m_old_options); if (err == -1) { // too bad, what are we going to do? + } + err = close(m_fd); + if (err == -1) { + // punt } } } diff -u ./garmin_serial_unix.h ../garble-1.0.1/garmin_serial_unix.h --- ./garmin_serial_unix.h Mon Feb 21 01:21:08 2000 +++ ../garble-1.0.1/garmin_serial_unix.h Tue May 30 11:23:15 2000 @@ -1,4 +1,4 @@ -// $Id: garmin_serial_unix.h,v 1.1.1.1 2000/02/21 06:17:23 decouto Exp $ +// $Id: garmin_serial_unix.h,v 1.2 2000/05/23 18:07:35 decouto Exp $ // garmin_serial_unix.h // Douglas S. J. De Couto // Feburary 13, 2000 @@ -22,6 +22,8 @@ #include +#include + #include "garmin_phys.h" // adapter class to use unix serial port for garmin physical layer @@ -47,6 +49,7 @@ private: std::string m_build_err_string(char * msg); + struct termios m_old_options; bool m_init; // true iff succesfully initialized port string m_port_dev; // name of serial port device int m_fd; // serial port file descriptor