summaryrefslogtreecommitdiff
path: root/libgpsd_core.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2006-11-14 07:28:44 +0000
committerEric S. Raymond <esr@thyrsus.com>2006-11-14 07:28:44 +0000
commitd3eff5b06eccf4ef3e52fcaf8b18fda31870b0a4 (patch)
treeffcc5e69b7b985c7ccc8b80fb66bf930a9dbece2 /libgpsd_core.c
parent8ceb9ed4cfebc51d2fdd7617f4fab313a2fde9a8 (diff)
downloadgpsd-d3eff5b06eccf4ef3e52fcaf8b18fda31870b0a4.tar.gz
Split wrapup method into revert and wrapup. The revert method is onlt called
if configuration is enabled.
Diffstat (limited to 'libgpsd_core.c')
-rw-r--r--libgpsd_core.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/libgpsd_core.c b/libgpsd_core.c
index 47cb404f..562ea121 100644
--- a/libgpsd_core.c
+++ b/libgpsd_core.c
@@ -37,8 +37,15 @@ int gpsd_switch_driver(struct gps_device_t *session, char* typename)
if (strcmp((*dp)->typename, typename) == 0) {
gpsd_report(LOG_PROG, "Selecting %s driver...\n", (*dp)->typename);
gpsd_assert_sync(session);
- if (session->device_type != NULL && session->device_type->wrapup != NULL)
- session->device_type->wrapup(session);
+ if (session->device_type != NULL) {
+#ifdef ALLOW_RECONFIGURE
+ if (session->context->enable_reconfigure
+ && session->device_type->revert != NULL)
+ session->device_type->revert(session);
+#endif /* ALLOW_RECONFIGURE */
+ if (session->device_type->wrapup != NULL)
+ session->device_type->wrapup(session);
+ }
/*@i@*/session->device_type = *dp;
if (session->device_type->probe_subtype != NULL)
session->device_type->probe_subtype(session, session->packet_counter = 0);
@@ -100,6 +107,11 @@ void gpsd_deactivate(struct gps_device_t *session)
session->shmTimeP = -1;
# endif /* PPS_ENABLE */
#endif /* NTPSHM_ENABLE */
+#ifdef ALLOW_RECONFIGURE
+ if (session->context->enable_reconfigure
+ && session->device_type->revert != NULL)
+ session->device_type->revert(session);
+#endif /* ALLOW_RECONFIGURE */
if (session->device_type != NULL && session->device_type->wrapup != NULL)
session->device_type->wrapup(session);
(void)gpsd_close(session);