diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2011-01-19 20:03:47 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2011-01-19 20:03:47 -0500 |
commit | c22430b526bf35912aba88dcb249264530cd5128 (patch) | |
tree | 89801f03d3b834f68a08d24789e84fcb4e2ff7c2 | |
parent | 901d73928207e94b22e7edcf88df064590161eb6 (diff) | |
download | gpsd-c22430b526bf35912aba88dcb249264530cd5128.tar.gz |
Added a driver-type flags member to the driver method structure.
All regression tests pass.
-rw-r--r-- | driver_evermore.c | 1 | ||||
-rw-r--r-- | driver_garmin.c | 3 | ||||
-rw-r--r-- | driver_geostar.c | 1 | ||||
-rw-r--r-- | driver_italk.c | 1 | ||||
-rw-r--r-- | driver_navcom.c | 1 | ||||
-rw-r--r-- | driver_oncore.c | 46 | ||||
-rw-r--r-- | driver_proto.c | 2 | ||||
-rw-r--r-- | driver_sirf.c | 1 | ||||
-rw-r--r-- | driver_superstar2.c | 2 | ||||
-rw-r--r-- | driver_tsip.c | 3 | ||||
-rw-r--r-- | driver_ubx.c | 1 | ||||
-rw-r--r-- | driver_zodiac.c | 1 | ||||
-rw-r--r-- | drivers.c | 58 | ||||
-rw-r--r-- | gpsd.h-tail | 4 | ||||
-rw-r--r-- | www/writing-a-driver.xml | 12 |
15 files changed, 79 insertions, 58 deletions
diff --git a/driver_evermore.c b/driver_evermore.c index 27958192..c4a767ad 100644 --- a/driver_evermore.c +++ b/driver_evermore.c @@ -610,6 +610,7 @@ const struct gps_type_t evermore_binary = { .type_name = "EverMore binary", /* full name of type */ .packet_type = EVERMORE_PACKET, /* lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = "$PEMT,", /* recognize the type */ .channels = EVERMORE_CHANNELS, /* consumer-grade GPS */ .probe_detect = NULL, /* no probe */ diff --git a/driver_garmin.c b/driver_garmin.c index 344c70ce..efcf51ef 100644 --- a/driver_garmin.c +++ b/driver_garmin.c @@ -1329,6 +1329,7 @@ const struct gps_type_t garmin_usb_binary_old = { .type_name = "Garmin USB binary", /* full name of type */ .packet_type = GARMIN_PACKET; /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = NULL, /* no trigger, it has a probe */ .channels = GARMIN_CHANNELS, /* consumer-grade GPS */ .probe_detect = garmin_usb_detect,/* how to detect at startup time */ @@ -1357,6 +1358,7 @@ const struct gps_type_t garmin_usb_binary = { .type_name = "Garmin USB binary", /* full name of type */ .packet_type = GARMIN_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = NULL, /* no trigger, it has a probe */ .channels = GARMIN_CHANNELS, /* consumer-grade GPS */ .probe_detect = garmin_usb_detect,/* how to detect at startup time */ @@ -1384,6 +1386,7 @@ const struct gps_type_t garmin_ser_binary = { .type_name = "Garmin Serial binary", /* full name of type */ .packet_type = GARMIN_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = NULL, /* no trigger, it has a probe */ .channels = GARMIN_CHANNELS, /* consumer-grade GPS */ .probe_detect = NULL, /* how to detect at startup time */ diff --git a/driver_geostar.c b/driver_geostar.c index 7ed64847..42ef3ed9 100644 --- a/driver_geostar.c +++ b/driver_geostar.c @@ -571,6 +571,7 @@ const struct gps_type_t geostar_binary = { .type_name = "GeoStar binary", /* full name of type */ .packet_type = GEOSTAR_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = NULL, /* no trigger */ .channels = GEOSTAR_CHANNELS, /* consumer-grade GPS/GLONASS */ .probe_detect = geostar_detect, /* probe for device */ diff --git a/driver_italk.c b/driver_italk.c index c780d076..816af154 100644 --- a/driver_italk.c +++ b/driver_italk.c @@ -472,6 +472,7 @@ const struct gps_type_t italk_binary = { .type_name = "iTalk binary", /* full name of type */ .packet_type = ITALK_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no rollover or other flags */ .trigger = NULL, /* recognize the type */ .channels = 12, /* consumer-grade GPS */ .probe_detect = NULL, /* how to detect at startup time */ diff --git a/driver_navcom.c b/driver_navcom.c index 36c6d649..87a02330 100644 --- a/driver_navcom.c +++ b/driver_navcom.c @@ -1290,6 +1290,7 @@ const struct gps_type_t navcom_binary = { .type_name = "Navcom binary", /* full name of type */ .packet_type = NAVCOM_PACKET, /* lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = NULL, /* none */ .channels = NAVCOM_CHANNELS, /* 12 L1 + 12 L2 + 2 Inmarsat L-Band */ .probe_detect = NULL, /* no probe */ diff --git a/driver_oncore.c b/driver_oncore.c index 7069cf7e..0f40c6a9 100644 --- a/driver_oncore.c +++ b/driver_oncore.c @@ -520,41 +520,29 @@ static gps_mask_t oncore_parse_input(struct gps_device_t *session) /* This is everything we export */ /* *INDENT-OFF* */ const struct gps_type_t oncore_binary = { - /* Full name of type */ - .type_name = "oncore binary", - /* associated lexer packet type */ - .packet_type = ONCORE_PACKET, - /* Response string that identifies device (not active) */ - .trigger = NULL, - /* Number of satellite channels supported by the device */ - .channels = 12, - /* Startup-time device detector */ - .probe_detect = NULL, - /* Wakeup to be done before each baud hunt */ - .get_packet = generic_get, - /* Parse message packets */ - .parse_packet = oncore_parse_input, - /* RTCM handler (using default routine) */ - .rtcm_writer = pass_rtcm, - /* Fire on various lifetime events */ - .event_hook = oncore_event_hook, + + .type_name = "oncore binary", /* Full name of type */ + .packet_type = ONCORE_PACKET, /* numeric packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ + .trigger = NULL, /* identifying response */ + .channels = 12, /* device channel count */ + .probe_detect = NULL, /* no probe */ + .get_packet = generic_get, /* packet getter */ + .parse_packet = oncore_parse_input, /* packet parser */ + .rtcm_writer = pass_rtcm, /* device accepts RTCM */ + .event_hook = oncore_event_hook, /* lifetime event hook */ #ifdef ALLOW_RECONFIGURE - /* Speed (baudrate) switch */ - .speed_switcher = oncore_set_speed, - /* Switch to NMEA mode */ - .mode_switcher = oncore_set_mode, - /* Message delivery rate switcher (not active) */ - .rate_switcher = NULL, - /* Minimum cycle time of the device */ - .min_cycle = 1, - /* Undo actions at configure_event time */ + .speed_switcher = oncore_set_speed, /* no speed setter */ + .mode_switcher = oncore_set_mode, /* no mode setter */ + .rate_switcher = NULL, /* no speed setter */ + .min_cycle = 1, /* 1Hz */ #endif /* ALLOW_RECONFIGURE */ #ifdef ALLOW_CONTROLSEND /* Control string sender - should provide checksum and headers/trailer */ - .control_send = oncore_control_send, + .control_send = oncore_control_send, /* to send control strings */ #endif /* ALLOW_CONTROLSEND */ #ifdef NTPSHM_ENABLE - .ntp_offset = oncore_ntp_offset, + .ntp_offset = oncore_ntp_offset, /* NTP offset array */ #endif /* NTPSHM_ENABLE */ }; /* *INDENT-ON* */ diff --git a/driver_proto.c b/driver_proto.c index 716294e2..a8a94d79 100644 --- a/driver_proto.c +++ b/driver_proto.c @@ -510,6 +510,8 @@ const struct gps_type_t _proto__binary = { .type_name = "_proto_ binary", /* Associated lexer packet type */ .packet_type = _PROTO__PACKET, + /* Driver tyoe flags */ + .flags = DRIVER_NOFLAGS, /* Response string that identifies device (not active) */ .trigger = NULL, /* Number of satellite channels supported by the device */ diff --git a/driver_sirf.c b/driver_sirf.c index 4ce598ba..131b36ce 100644 --- a/driver_sirf.c +++ b/driver_sirf.c @@ -1339,6 +1339,7 @@ const struct gps_type_t sirf_binary = { .type_name = "SiRF binary", /* full name of type */ .packet_type = SIRF_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = NULL, /* no trigger */ .channels = SIRF_CHANNELS, /* consumer-grade GPS */ .probe_detect = NULL, /* no probe */ diff --git a/driver_superstar2.c b/driver_superstar2.c index d6524f71..fd8e2c1b 100644 --- a/driver_superstar2.c +++ b/driver_superstar2.c @@ -543,6 +543,8 @@ const struct gps_type_t superstar2_binary = { .type_name = "SuperStarII binary", /* Associated lexer packet type */ .packet_type = SUPERSTAR2_PACKET, + /* Driver type flags */ + .flags = DRIVER_NOFLAGS, /* Response string that identifies device (not active) */ .trigger = NULL, /* Number of satellite channels supported by the device */ diff --git a/driver_tsip.c b/driver_tsip.c index 9874aca6..43eb1b2e 100644 --- a/driver_tsip.c +++ b/driver_tsip.c @@ -1161,7 +1161,8 @@ const struct gps_type_t tsip_binary = { .type_name = "Trimble TSIP", /* full name of type */ .packet_type = TSIP_PACKET, /* associated lexer packet type */ - .trigger = NULL, /* no trigger */ + .flags = DRIVER_NOFLAGS, /* no flags set */ + .trigger = NULL, /* no trigger */ .channels = TSIP_CHANNELS, /* consumer-grade GPS */ .probe_detect = tsip_detect, /* probe for 9600O81 device */ .get_packet = generic_get, /* use the generic packet getter */ diff --git a/driver_ubx.c b/driver_ubx.c index 6c2da657..2ed6961f 100644 --- a/driver_ubx.c +++ b/driver_ubx.c @@ -749,6 +749,7 @@ static bool ubx_rate(struct gps_device_t *session, double cycletime) const struct gps_type_t ubx_binary = { .type_name = "uBlox UBX binary", /* Full name of type */ .packet_type = UBX_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = "$GPTXT,01,01,02,MOD", .channels = 50, /* Number of satellite channels supported by the device */ .probe_detect = NULL, /* Startup-time device detector */ diff --git a/driver_zodiac.c b/driver_zodiac.c index 9f76ee1f..7e61db17 100644 --- a/driver_zodiac.c +++ b/driver_zodiac.c @@ -482,6 +482,7 @@ const struct gps_type_t zodiac_binary = { .type_name = "Zodiac binary", /* full name of type */ .packet_type = ZODIAC_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = NULL, /* no trigger */ .channels = 12, /* consumer-grade GPS */ .probe_detect = NULL, /* no probe */ @@ -87,6 +87,7 @@ ssize_t pass_rtcm(struct gps_device_t * session, char *buf, size_t rtcmbytes) const struct gps_type_t unknown = { .type_name = "Unknown", /* full name of type */ .packet_type = COMMENT_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = NULL, /* it's the default */ .channels = 12, /* consumer-grade GPS */ .probe_detect = NULL, /* no probe */ @@ -253,6 +254,7 @@ static void nmea_mode_switch(struct gps_device_t *session, int mode) const struct gps_type_t nmea = { .type_name = "Generic NMEA", /* full name of type */ .packet_type = NMEA_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = NULL, /* it's the default */ .channels = 12, /* consumer-grade GPS */ .probe_detect = NULL, /* no probe */ @@ -351,6 +353,7 @@ static void garmin_nmea_event_hook(struct gps_device_t *session, const struct gps_type_t garmin = { .type_name = "Garmin NMEA", /* full name of type */ .packet_type = NMEA_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = "$PGRMC,", /* Garmin private */ .channels = 12, /* not used by this driver */ .probe_detect = NULL, /* no probe */ @@ -409,6 +412,7 @@ static void ashtech_event_hook(struct gps_device_t *session, event_t event) const struct gps_type_t ashtech = { .type_name = "Ashtech", /* full name of type */ .packet_type = NMEA_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = "$PASHR,RID,", /* Ashtech receivers respond thus */ .channels = 24, /* not used, GG24 has 24 channels */ .probe_detect = NULL, /* no probe */ @@ -456,6 +460,7 @@ static void fv18_event_hook(struct gps_device_t *session, event_t event) const struct gps_type_t fv18 = { .type_name = "San Jose Navigation FV18", /* full name of type */ .packet_type = NMEA_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = "$PFEC,GPint,", /* FV18s should echo the probe */ .channels = 12, /* not used by this driver */ .probe_detect = NULL, /* no probe */ @@ -506,6 +511,7 @@ static void gpsclock_event_hook(struct gps_device_t *session, event_t event) const struct gps_type_t gpsclock = { .type_name = "Furuno Electric GH-79L4", /* full name of type */ .packet_type = NMEA_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = "$PFEC,GPssd", /* GPSclock should return this */ .channels = 12, /* not used by this driver */ .probe_detect = NULL, /* no probe */ @@ -558,6 +564,7 @@ static void tripmate_event_hook(struct gps_device_t *session, event_t event) static const struct gps_type_t tripmate = { .type_name = "Delorme TripMate", /* full name of type */ .packet_type = NMEA_PACKET, /* lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no rollover or other flags */ .trigger ="ASTRAL", /* tells us to switch */ .channels = 12, /* consumer-grade GPS */ .probe_detect = NULL, /* no probe */ @@ -606,6 +613,7 @@ static void earthmate_event_hook(struct gps_device_t *session, event_t event) static const struct gps_type_t earthmate = { .type_name = "Delorme EarthMate (pre-2003, Zodiac chipset)", .packet_type = NMEA_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no rollover or other flags */ .trigger = "EARTHA", /* Earthmate trigger string */ .channels = 12, /* not used by NMEA parser */ .probe_detect = NULL, /* no probe */ @@ -730,6 +738,7 @@ static void tnt_event_hook(struct gps_device_t *session, event_t event) const struct gps_type_t trueNorth = { .type_name = "True North", /* full name of type */ .packet_type = NMEA_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = "$PTNTHTM", /* their proprietary sentence */ .channels = 0, /* not an actual GPS at all */ .probe_detect = NULL, /* no probe in run mode */ @@ -803,6 +812,7 @@ static void oceanserver_event_hook(struct gps_device_t *session, static const struct gps_type_t oceanServer = { .type_name = "OceanServer Digital Compass OS5000", /* full name of type */ .packet_type = NMEA_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no rollover or other flags */ .trigger = "$OHPR,", /* detect their main sentence */ .channels = 0, /* not an actual GPS at all */ .probe_detect = NULL, @@ -849,6 +859,7 @@ static gps_mask_t rtcm104v2_analyze(struct gps_device_t *session) static const struct gps_type_t rtcm104v2 = { .type_name = "RTCM104V2", /* full name of type */ .packet_type = RTCM2_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no rollover or other flags */ .trigger = NULL, /* no recognition string */ .channels = 0, /* not used */ .probe_detect = NULL, /* no probe */ @@ -896,6 +907,7 @@ static gps_mask_t rtcm104v3_analyze(struct gps_device_t *session) static const struct gps_type_t rtcm104v3 = { .type_name = "RTCM104V3", /* full name of type */ .packet_type = RTCM3_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no rollover or other flags */ .trigger = NULL, /* no recognition string */ .channels = 0, /* not used */ .probe_detect = NULL, /* no probe */ @@ -930,6 +942,7 @@ static const struct gps_type_t rtcm104v3 = { static const struct gps_type_t garmintxt = { .type_name = "Garmin Simple Text", /* full name of type */ .packet_type = GARMINTXT_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no rollover or other flags */ .trigger = NULL, /* no recognition string */ .channels = 0, /* not used */ .probe_detect = NULL, /* no probe */ @@ -1043,6 +1056,7 @@ static bool mtk3301_rate_switcher(struct gps_device_t *session, double rate) const struct gps_type_t mtk3301 = { .type_name = "MTK-3301", /* full name of type */ .packet_type = NMEA_PACKET, /* associated lexer packet type */ + .flags = DRIVER_NOFLAGS, /* no flags set */ .trigger = "$PMTK705,", /* MTK-3301s send firmware release name and version */ .channels = 12, /* not used by this driver */ .probe_detect = NULL, /* no probe */ @@ -1094,39 +1108,27 @@ static gps_mask_t aivdm_analyze(struct gps_device_t *session) /* *INDENT-OFF* */ static const struct gps_type_t aivdm = { /* Full name of type */ - .type_name = "AIVDM", - /* Associated lexer packet type */ - .packet_type = AIVDM_PACKET, - /* Response string that identifies device (not active) */ - .trigger = NULL, - /* Number of satellite channels supported by the device */ - .channels = 0, - /* Startup-time device detector */ - .probe_detect = NULL, - /* Packet getter (using default routine) */ - .get_packet = generic_get, - /* Parse message packets */ - .parse_packet = aivdm_analyze, - /* RTCM handler (using default routine) */ - .rtcm_writer = NULL, - /* Handle various lifetime events */ - .event_hook = NULL, + .type_name = "AIVDM", /* associated lexer packet type */ + .packet_type = AIVDM_PACKET, /* numeric packet type */ + .flags = DRIVER_NOFLAGS, /* no rollover or other flags */ + .trigger = NULL, /* identifying response */ + .channels = 0, /* not used by this driver */ + .probe_detect = NULL, /* no probe */ + .get_packet = generic_get, /* how to get a packet */ + .parse_packet = aivdm_analyze, /* how to analyze a packet */ + .rtcm_writer = NULL, /* don't send RTCM data, */ + .event_hook = NULL, /* lifetime event handler */ #ifdef ALLOW_RECONFIGURE - /* Speed (baudrate) switch */ - .speed_switcher = NULL, - /* Switch to NMEA mode */ - .mode_switcher = NULL, - /* Message delivery rate switcher (not active) */ - .rate_switcher = NULL, - /* Minimum cycle time of the device */ - .min_cycle = 1, + .speed_switcher = NULL, /* no speed switcher */ + .mode_switcher = NULL, /* no mode switcher */ + .rate_switcher = NULL, /* no rate switcher */ + .min_cycle = 1, /* max 1Hz */ #endif /* ALLOW_RECONFIGURE */ #ifdef ALLOW_CONTROLSEND - /* Control string sender - should provide checksum and headers/trailer */ - .control_send = NULL, + .control_send = NULL, /* no control sender */ #endif /* ALLOW_CONTROLSEND */ #ifdef NTPSHM_ENABLE - .ntp_offset = NULL, + .ntp_offset = NULL, /* no NTP communication */ #endif /* NTPSHM_ ENABLE */ }; /* *INDENT-ON* */ diff --git a/gpsd.h-tail b/gpsd.h-tail index 5384fb1e..bebc581a 100644 --- a/gpsd.h-tail +++ b/gpsd.h-tail @@ -262,10 +262,14 @@ typedef enum { #define NODATA_IS 0x80000000u /* no data read from fd */ #define DATA_IS ~(ONLINE_IS|PACKET_IS|CLEAR_IS|REPORT_IS) +typedef /*@unsignedintegraltype@*/ unsigned int driver_mask_t; +#define DRIVER_NOFLAGS 0x00000000u + struct gps_type_t { /* GPS method table, describes how to talk to a particular GPS type */ /*@observer@*/char *type_name; int packet_type; + driver_mask_t flags; /* reserved for expansion */ /*@observer@*//*@null@*/char *trigger; int channels; /*@null@*/bool (*probe_detect)(struct gps_device_t *session); diff --git a/www/writing-a-driver.xml b/www/writing-a-driver.xml index 8a34d6be..eccf3866 100644 --- a/www/writing-a-driver.xml +++ b/www/writing-a-driver.xml @@ -16,6 +16,14 @@ <revhistory> <revision> + <revnumber>1.11</revnumber> + <date>19 Jan 2011</date> + <authorinitials>er</authorinitials> + <revremark> + Updated by esr; driver type flag field added. + </revremark> + </revision> + <revision> <revnumber>1.10</revnumber> <date>9 Jan 2011</date> <authorinitials>er</authorinitials> @@ -598,6 +606,10 @@ packet sniffer and <emphasis>must be unique to each driver</emphasis>. It is used internally to dispatch to the correct driver when it collects a complete packet.</para> +<!-- added by ESR, 2010 --> +<para><structfield>.flags</structfield> Driver property flags. This +field is rserved for future expansion.</para> + <para><structfield>.trigger</structfield> is the unique string that, when seen, will confirm your device is present. This will be detected in <quote><filename>drivers.c</filename></quote> and will probably |