Thursday, December 20, 2007

Writing extra geocache information into tomtom description field with gpsbabel

I wrote a patch for gpsbabel 1.3.3 to make the tomtom descriptions of caches more useful. Invoke it like:

gpsbabel -i gpx -f 1483978.gpx -o tomtom,cache=1 -F Geocaching.ov2


I have sent the patch to the authors of tomtom.c so we will see what happens.


--- tomtom.c 2007-12-22 23:41:56.000000000 -0500
+++ /home/gpsbabel-1.3.3/tomtom.c 2006-07-17 14:38:56.000000000 -0400
@@ -44,12 +44,9 @@

static FILE *file_in;
static FILE *file_out;
-static char *opt_geocache = NULL;

static
arglist_t tomtom_args[] = {
- { "cache", &opt_geocache, "Cram geocaching info into description field",
- NULL, ARGTYPE_BOOL, ARG_NOMINMAX },
ARG_TERMINATOR
};

@@ -216,20 +213,6 @@
struct blockheader *ch2;
};

-static int get_desc(char *desc_field, waypoint *wpt) {
- if (opt_geocache) {
- snprintf(desc_field,256,"%s(t%ud%u)%s(type%dcont%d)",wpt->description,
- wpt->gc_data.terr/10,
- wpt->gc_data.diff/10,
- wpt->shortname,
- (int) wpt->gc_data.type,
- (int) wpt->gc_data.container);
- } else {
- strcpy(desc_field,wpt->description);
- }
- return strlen(desc_field);
-}
-
static void
write_blocks( FILE *f, struct blockheader *blocks ) {
int i;
@@ -248,13 +231,10 @@
if ( !blocks->ch1 && !blocks->ch2 ) {
for ( i = 0; i < blocks->count; i++ ) {
write_char( f, 2 );
- char desc_field [256];
- get_desc(desc_field,blocks->start[i].wpt);
- //Unfortunately enums mean we get numbers for cache type and container.
- write_long( f, strlen( desc_field ) + 14 );
+ write_long( f, strlen( blocks->start[i].wpt->description ) + 14 );
write_float_as_long( f, blocks->start[i].wpt->longitude*100000);
write_float_as_long( f, blocks->start[i].wpt->latitude*100000);
- write_string( f, desc_field);
+ write_string( f, blocks->start[i].wpt->description);
}
}
}
@@ -280,8 +260,7 @@
newblock->size += 4 * 3 + 1;
/* wpt const part 3 longs, 1 char */
wpt = start[i].wpt;
- char tempstr [256];
- newblock->size += get_desc(tempstr,wpt) + 1;
+ newblock->size += strlen( wpt->description ) + 1;
}
}
else {

HOWTO Convert geocaching gpx files to TomTom Points of Interest (POI)

Use gpsbabel:

gpsbabel -i gpx -f 1483978.gpx -o tomtom -F Geocaching.ov2

Dump it in the maps directory on your TomTom with a Geocaching.bmp icon (mine is on the left). I use the 720 which comes pre-loaded with maps. You can mount the device's memory itself and find the maps directory in there.



Tuesday, December 18, 2007

Installing the bro IDS on Debian Etch

Here's how I installed bro-1.2-stable on Debian etch (mostly the same as the Ubuntu instructions):

sudo apt-get install libncurses-dev, autoconf, automake, build-essential, flex, bison
./configure
make
sudo make install
sudo make install-brolite

Added following to configure.in to get around the problem of the Clam AV function cl_scanbuff disappearing from newer versions:

AC_CHECK_LIB(clamav,cl_scanbuff,,have_libclamav=No)

Got "error compiling pattern" so deleted necessary files and ran make again. Finally, started with:
sudo /usr/local/bro/etc/bro.rc start

Bro wouldn't run as a non-root user because it requires permissions on the interface.