[Gpsbabel-misc] partial fix for garmin on UNIX/Linux usb serial
Brought to you by:
robertl
From: Robert L. <rob...@us...> - 2005-01-04 03:40:14
|
Windows users and Magellan users are welcome to tune out now. A few months ago, I introduced a code path that added an open that was cut and pasted from the code that I later modified to remove the O_NDELAY that makes the Linux USB system so grumpy. If you're using a a Garmin on Linux or UNIX (esp. with a USB/serial converter) and have been having problems, please apply this fix and report success or failure. Joey, I think this will fix your problem with the MCT USB/serial parts. It works for me with Fedora Core 2. Bob, this is kind of a shot in the dark for you with OSX as I'm pretty clearly scratching my head with your situation. Alan, I still don't know whats up with those stupid PL-2303 device. It looks like we're losing data on the write, but I'm going to have to cobble up some kind of serial analyzer to confirm that. I'll continue to chase that problem independently. All testing was done with the Garmin 60. RJL Index: jeeps/gpsserial.c =================================================================== RCS file: /cvsroot/gpsbabel/gpsbabel/jeeps/gpsserial.c,v retrieving revision 1.20 diff -p -u -r1.20 gpsserial.c --- jeeps/gpsserial.c 22 Dec 2004 19:27:23 -0000 1.20 +++ jeeps/gpsserial.c 4 Jan 2005 03:37:09 -0000 @@ -61,6 +61,11 @@ char *rxdata[] = { * internal. This means we ignore that 'fd' number that gets passed in. */ +static HANDLE comport; + +/* + * Display an error from the serial subsystem. + */ void GPS_Serial_Error(char *hdr) { char msg[200]; @@ -76,8 +81,6 @@ void GPS_Serial_Error(char *hdr) GPS_Error(msg); } -static HANDLE comport; - int32 GPS_Serial_On(const char *port, int32 *fd) { DCB tio; @@ -248,7 +251,7 @@ int32 GPS_Serial_Savetty(const char *por if (gps_is_usb) return 1; - if((fd = open(port, O_RDWR|O_NDELAY))==-1) + if((fd = open(port, O_RDWR))==-1) { perror("open"); gps_errno = SERIAL_ERROR; @@ -264,7 +267,6 @@ int32 GPS_Serial_Savetty(const char *por return 0; } - if(!GPS_Serial_Close(fd,port)) { gps_errno = SERIAL_ERROR; @@ -291,7 +293,7 @@ int32 GPS_Serial_Restoretty(const char * if (gps_is_usb) return 1; - if((fd = open(port, O_RDWR|O_NDELAY))==-1) + if((fd = open(port, O_RDWR))==-1) { perror("open"); gps_errno = HARDWARE_ERROR; @@ -340,7 +342,6 @@ int32 GPS_Serial_Open(int32 *fd, const c return 0; } - if(tcgetattr(*fd,&tty)==-1) { perror("tcgetattr"); |