diff options
-rw-r--r-- | gpsd.h-tail | 3 | ||||
-rw-r--r-- | test_packet.c | 30 |
2 files changed, 32 insertions, 1 deletions
diff --git a/gpsd.h-tail b/gpsd.h-tail index f4f1582a..1474515a 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -297,6 +297,9 @@ typedef enum { typedef /*@unsignedintegraltype@*/ unsigned int driver_mask_t; #define DRIVER_NOFLAGS 0x00000000u +/* does this device have control methods or required initialization strings? */ +#define CONFIGURABLE(d) (((d)->speed_switcher != NULL) || ((d)->mode_switcher != NULL) || ((d)->rate_switcher != NULL)) + struct gps_type_t { /* GPS method table, describes how to talk to a particular GPS type */ /*@observer@*/char *type_name; diff --git a/test_packet.c b/test_packet.c index bb8bbe2c..c5335d11 100644 --- a/test_packet.c +++ b/test_packet.c @@ -324,6 +324,32 @@ static void runon_test(struct map *mp) /*@ +compdef +uniondef +usedef +formatcode @*/ } +static int property_check(void) +{ + const struct gps_type_t **dp; + + for (dp = gpsd_drivers; *dp; dp++) { + if ((*dp)->packet_type == COMMENT_PACKET) + continue; + + if (CONFIGURABLE(*dp)) + (void)fputs("config\t", stdout); + else + (void)fputs(".\t", stdout); + if ((*dp)->event_hook != NULL) + (void)fputs("hook\t", stdout); + else + (void)fputs(".\t", stdout); + if ((*dp)->packet_type > NMEA_PACKET) + (void)fputs("binary\t", stdout); + else + (void)fputs("NMEA\t", stdout); + (void)puts((*dp)->type_name); + } + + return EXIT_SUCCESS; +} + int main(int argc, char *argv[]) { struct map *mp; @@ -331,8 +357,10 @@ int main(int argc, char *argv[]) int option, singletest = 0; verbose = 0; - while ((option = getopt(argc, argv, "e:t:v:")) != -1) { + while ((option = getopt(argc, argv, "ce:t:v:")) != -1) { switch (option) { + case 'c': + exit(property_check()); case 'e': mp = singletests + atoi(optarg) - 1; (void)fwrite(mp->test, mp->testlen, sizeof(char), stdout); |