summaryrefslogtreecommitdiff
path: root/serial.c
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2006-11-30 07:29:25 +0000
committerEric S. Raymond <esr@thyrsus.com>2006-11-30 07:29:25 +0000
commit2f6775a8769ed7a2250bb90a68c5fa2617123604 (patch)
treeb0a90a20de3049daf781390419172d628bb83fc0 /serial.c
parent1c2b3463912566fa8a5841385a56ed1d966138db (diff)
downloadgpsd-2f6775a8769ed7a2250bb90a68c5fa2617123604.tar.gz
Split the packet-sniffer internals out of the session structure.
This is a big, super-intrusive patch but changes no logic at all -- it's all about ripping out some of the gps_device_t structure members into a new gps_packet_t structure. Even the driver API doesn't change at all, this is all libgpsd(3) internals being rearranged. The motivation here is that we want to kill off the ad-hoc Python implementation of a packet-sniffer in gpsfake. To do that we need to be able to write a "pure" packet sniffer that uses the same C code as the daemon's but without being welded to the rest of the libgpsd(3) code. This is the first step towards that.
Diffstat (limited to 'serial.c')
-rw-r--r--serial.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/serial.c b/serial.c
index 3843e799..49a1b304 100644
--- a/serial.c
+++ b/serial.c
@@ -194,7 +194,7 @@ void gpsd_set_speed(struct gps_device_t *session,
} else if (session->device_type->probe_wakeup != NULL)
session->device_type->probe_wakeup(session);
}
- packet_reset(session);
+ packet_reset(&session->packet);
}
int gpsd_open(struct gps_device_t *session)
@@ -219,7 +219,7 @@ int gpsd_open(struct gps_device_t *session)
(void)tcflush(session->gpsdata.gps_fd, TCIOFLUSH);
}
- session->packet_type = BAD_PACKET;
+ session->packet.type = BAD_PACKET;
if (isatty(session->gpsdata.gps_fd)!=0) {
/* Save original terminal parameters */
if (tcgetattr(session->gpsdata.gps_fd,&session->ttyset_old) != 0)
@@ -281,8 +281,8 @@ bool gpsd_next_hunt_setting(struct gps_device_t *session)
static unsigned int rates[] = {0, 4800, 9600, 19200, 38400, 57600};
#endif /* FIXED_PORT_SPEED defined */
- if (session->retry_counter++ >= SNIFF_RETRIES) {
- session->retry_counter = 0;
+ if (session->packet.retry_counter++ >= SNIFF_RETRIES) {
+ session->packet.retry_counter = 0;
if (session->baudindex++ >= (unsigned int)(sizeof(rates)/sizeof(rates[0]))-1) {
session->baudindex = 0;
if (session->gpsdata.stopbits++ >= 2)