diff --git a/CHANGES.md b/CHANGES.md index 0bed884..be27c3f 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -14,6 +14,8 @@ This is a snapshot of ongoing development towards version of 1.5. Some features - New document ***Bluetooth-KISS-TNC.pdf*** explaining how to use KISS over Bluetooth. +- decode_aprs utility can now accept KISS frames and AX.25 frames as series of two digit hexadecimal numbers. + ### Bugs Fixed: ### - Little spelling errors in messages ???? diff --git a/Makefile.linux b/Makefile.linux index 5d45380..72bafd4 100644 --- a/Makefile.linux +++ b/Makefile.linux @@ -2,6 +2,9 @@ # Makefile for Linux version of Dire Wolf. # + + + APPS := direwolf decode_aprs text2tt tt2text ll2utm utm2ll aclients atest log2gpx gen_packets ttcalc all : $(APPS) direwolf.desktop direwolf.conf @@ -259,6 +262,16 @@ endif CFLAGS += -DUSE_ALSA LDFLAGS += -lasound +ifeq ($(wildcard /usr/include/pthread.h),) +$(error /usr/include/pthread.h does not exist. Install it with "sudo apt-get install libc6-dev" or "sudo yum install libc6-dev" ) +endif + +ifneq ($(USE_ALSA),) +ifeq ($(wildcard /usr/include/alsa/asoundlib.h),) +$(error /usr/include/alsa/asoundlib.h does not exist. Install it with "sudo apt-get install libasound2-dev" or "sudo yum install libasound2-dev" ) +endif +endif + # Enable GPS if header file is present. # Finding libgps.so* is more difficult because it @@ -355,7 +368,9 @@ tocalls-symbols : # Separate application to decode raw data. -decode_aprs : decode_aprs.c dwgpsnmea.o dwgps.o dwgpsd.o serial_port.o symbols.o ax25_pad.o textcolor.o fcs_calc.o latlong.o log.o telemetry.o tt_text.o misc.a +# First two use .c rather than .o because they depend on DECAMAIN definition. + +decode_aprs : decode_aprs.c kiss_frame.c dwgpsnmea.o dwgps.o dwgpsd.o serial_port.o symbols.o ax25_pad.o textcolor.o fcs_calc.o latlong.o log.o telemetry.o tt_text.o misc.a $(CC) $(CFLAGS) -DDECAMAIN -o $@ $^ $(LDFLAGS) @@ -638,7 +653,8 @@ install-conf : direwolf.conf cp -n telemetry-toolkit/telem-*.conf ~ ifneq ($(wildcard $(HOME)/Desktop),) @echo " " - @echo "This will add a desktop icon on some systems:" + @echo "This will add a desktop icon on some systems." + @echo "This is known to work on Raspberry Pi but might not be compatible with other desktops." @echo " " @echo " make install-rpi" @echo " " diff --git a/Makefile.macosx b/Makefile.macosx index ee9e42e..c28a8f1 100644 --- a/Makefile.macosx +++ b/Makefile.macosx @@ -430,7 +430,9 @@ install-conf : direwolf.conf # Separate application to decode raw data. -decode_aprs : decode_aprs.c dwgpsnmea.o dwgps.o dwgpsd.o serial_port.o symbols.o ax25_pad.o textcolor.o fcs_calc.o latlong.o log.o telemetry.o tt_text.o +# First two use .c rather than .o because they depend on DECAMAIN definition. + +decode_aprs : decode_aprs.c kiss_frame.c dwgpsnmea.o dwgps.o dwgpsd.o serial_port.o symbols.o ax25_pad.o textcolor.o fcs_calc.o latlong.o log.o telemetry.o tt_text.o $(CC) $(CFLAGS) -DDECAMAIN -o $@ $^ -lm # Convert between text and touch tone representation. diff --git a/Makefile.win b/Makefile.win index 95e94d6..1a49554 100644 --- a/Makefile.win +++ b/Makefile.win @@ -159,7 +159,9 @@ tocalls-symbols : # Separate application to decode raw data. -decode_aprs : decode_aprs.c dwgpsnmea.o dwgps.o serial_port.o symbols.o ax25_pad.o textcolor.o fcs_calc.o latlong.o log.o telemetry.o tt_text.c regex.a misc.a geotranz.a +# First two use .c rather than .o because they depend on DECAMAIN definition. + +decode_aprs : decode_aprs.c kiss_frame.c dwgpsnmea.o dwgps.o serial_port.o symbols.o ax25_pad.o textcolor.o fcs_calc.o latlong.o log.o telemetry.o tt_text.o regex.a misc.a geotranz.a $(CC) $(CFLAGS) -DDECAMAIN -o decode_aprs $^ diff --git a/ax25_pad.c b/ax25_pad.c index 37bc316..bbf2561 100644 --- a/ax25_pad.c +++ b/ax25_pad.c @@ -760,12 +760,18 @@ int ax25_parse_addr (int position, char *in_addr, int strict, char *out_addr, in maxlen = strict ? 6 : (AX25_MAX_ADDR_LEN-1); p = in_addr; i = 0; - for (p = in_addr; isalnum(*p); p++) { + for (p = in_addr; *p != '\0' && *p != '-'; p++) { if (i >= maxlen) { text_color_set(DW_COLOR_ERROR); dw_printf ("%sAddress is too long. \"%s\" has more than %d characters.\n", position_name[position], in_addr, maxlen); return 0; } + if ( ! isalnum(*p)) { + text_color_set(DW_COLOR_ERROR); + dw_printf ("%sAddress, \"%s\" contains character other than letter or digit in character position %d.\n", position_name[position], in_addr, (int)(long)(p-in_addr)+1); + return 0; + } + out_addr[i++] = *p; out_addr[i] = '\0'; if (strict && islower(*p)) { @@ -1257,13 +1263,22 @@ void ax25_get_addr_with_ssid (packet_t this_p, int n, char *station) return; } - memset (station, 0, 7); - for (i=0; i<6; i++) { - unsigned char ch; + // At one time this would stop at the first space, on the assumption we would have only trailing spaces. + // Then there was a forum discussion where someone encountered the address " WIDE2" with a leading space. + // In that case, we would have returned a zero length string here. + // Now we return exactly what is in the address field and trim trailing spaces. + // This will provide better information for troubleshooting. - ch = (this_p->frame_data[n*7+i] >> 1) & 0x7f; - if (ch <= ' ') break; - station[i] = ch; + for (i=0; i<6; i++) { + station[i] = (this_p->frame_data[n*7+i] >> 1) & 0x7f; + } + station[6] = '\0'; + + for (i=5; i>=0; i--) { + if (station[i] == ' ') + station[i] = '\0'; + else + break; } ssid = ax25_get_ssid (this_p, n); @@ -1322,13 +1337,22 @@ void ax25_get_addr_no_ssid (packet_t this_p, int n, char *station) return; } - memset (station, 0, 7); - for (i=0; i<6; i++) { - unsigned char ch; + // At one time this would stop at the first space, on the assumption we would have only trailing spaces. + // Then there was a forum discussion where someone encountered the address " WIDE2" with a leading space. + // In that case, we would have returned a zero length string here. + // Now we return exactly what is in the address field and trim trailing spaces. + // This will provide better information for troubleshooting. - ch = (this_p->frame_data[n*7+i] >> 1) & 0x7f; - if (ch <= ' ') break; - station[i] = ch; + for (i=0; i<6; i++) { + station[i] = (this_p->frame_data[n*7+i] >> 1) & 0x7f; + } + station[6] = '\0'; + + for (i=5; i>=0; i--) { + if (station[i] == ' ') + station[i] = '\0'; + else + break; } } /* end ax25_get_addr_no_ssid */ diff --git a/decode_aprs.c b/decode_aprs.c index 00f8e80..ab89140 100644 --- a/decode_aprs.c +++ b/decode_aprs.c @@ -1,7 +1,7 @@ // // This file is part of Dire Wolf, an amateur radio packet TNC. // -// Copyright (C) 2011, 2012, 2013, 2014, 2015 John Langner, WB2OSZ +// Copyright (C) 2011, 2012, 2013, 2014, 2015, 2017 John Langner, WB2OSZ // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -4583,6 +4583,14 @@ static void process_comment (decode_aprs_t *A, char *pstart, int clen) * * WB2OSZ-1>APN383,qAR,N1EDU-2:!4237.14NS07120.83W#PHG7130Chelmsford, MA * + * New for 1.5: + * + * Also allow hexadecimal bytes for raw AX.25 or KISS. e.g. + * + * 00 82 a0 ae ae 62 60 e0 82 96 68 84 40 40 60 9c 68 b0 ae 86 40 e0 40 ae 92 88 8a 64 63 03 f0 3e 45 4d 36 34 6e 65 2f 23 20 45 63 68 6f 6c 69 6e 6b 20 31 34 35 2e 33 31 30 2f 31 30 30 68 7a 20 54 6f 6e 65 + * + * If it begins with 00 or C0 (which would be impossible for AX.25 address) process as KISS. + * Also print these formats. * * Outputs: stdout * @@ -4614,11 +4622,16 @@ static void process_comment (decode_aprs_t *A, char *pstart, int clen) * TODO: To make it more useful, * - Remove any leading timestamp. * - Remove any "qA*" and following from the path. + * - Handle non-APRS frames properly. * *------------------------------------------------------------------*/ #if DECAMAIN +#include "kiss_frame.h" + + + /* Stub for stand-alone decoder. */ void nmea_send_waypoint (char *wname_in, double dlat, double dlong, char symtab, char symbol, @@ -4627,11 +4640,48 @@ void nmea_send_waypoint (char *wname_in, double dlat, double dlong, char symtab, return; } +// TODO: hex_dump is currently in server.c and we don't want to drag that in. +// Someday put it in a more reasonable place, with other general utilities, and remove the private copy here. +static void hex_dump (unsigned char *p, int len) +{ + int n, i, offset; + + offset = 0; + while (len > 0) { + n = len < 16 ? len : 16; + dw_printf (" %03x: ", offset); + for (i=0; iAPRS,TCPIP*,qAC,SEVENTH:@212127z43.2333n/77.1w_338/002g001t025P000h65b10208.wview_5_19_0 .P K0YTH-10>APNU3B,NULL,qAR,K0DMF-10:!4601.5NS09255.52W#PHG6360/W2,MNn 444.575 +.P +00 82 a0 ae ae 62 60 e0 82 96 68 84 40 40 60 9c 68 b0 ae 86 40 e0 40 ae 92 88 8a 64 63 03 f0 3e 45 4d 36 34 6e 65 2f 23 20 45 63 68 6f 6c 69 6e 6b 20 31 34 35 2e 33 31 30 2f 31 30 30 68 7a 20 54 6f 6e 65 .RE .P If you simply fed this into decode_aprs, it would complain about the @@ -67,7 +71,7 @@ Address has lower case letters. "n2cma" must be all upper case. .P After changing the source address to upper case, there are other issues. Identifying them is left as an exercise for the reader. .P -And in the second example, +In the second example, .P .RS .PD 0 @@ -77,6 +81,17 @@ Invalid character in longitude. Found '9' when expecting 0 or 1 for hundreds of .PD .RE +.P +In the third example, +.P +.RS +.PD 0 +Warning: Lower case letter in Maidenhead locator. Specification requires upper case. +.P +Digi2 Address, " WIDE2-1" contains character other than letter or digit in character position 1. +.PD +.RE + .SH SEE ALSO