diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2006-10-26 17:31:15 +0000 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2006-10-26 17:31:15 +0000 |
commit | 8c4c1b38e7db2adc24528912d20486d386764327 (patch) | |
tree | 2b7e4d0a8acd1617eacaabab0fd15283857f3fcd /serial.c | |
parent | 0ad0dbab0d5a5b0d52bdcd1998a71b7eb924a5e3 (diff) | |
download | gpsd-8c4c1b38e7db2adc24528912d20486d386764327.tar.gz |
OK, I'm slow today.
If we don't already know the type of a device, we have to send it
*every* driver's wakeups on a baud-rate change. This does, basically,
the same thing the old probe function in the TrueNorth driver did
since at the moment only that driver has a wakeup.
Also, move the send so it gets done when we change baud rates without
closing the device.
Diffstat (limited to 'serial.c')
-rw-r--r-- | serial.c | 19 |
1 files changed, 15 insertions, 4 deletions
@@ -158,6 +158,21 @@ void gpsd_set_speed(struct gps_device_t *session, session->gpsdata.baudrate = (unsigned int)speed; session->gpsdata.parity = (unsigned int)parity; session->gpsdata.stopbits = stopbits; + + /* + * The device might need a wakeup string before it will send data. + * If we don't know the device type, ship it every driver's wakeup + * in hopes it will respond. + */ + if (isatty(session->gpsdata.gps_fd)!=0) { + struct gps_type_t **dp; + if (session->device_type == NULL) + session->device_type->wakeup(session); + else + for (dp = gpsd_drivers; *dp; dp++) + if ((*dp)->wakeup != NULL) + (*dp)->wakeup(session); + } packet_reset(session); } @@ -223,8 +238,6 @@ int gpsd_open(struct gps_device_t *session) session->baudindex = 0; gpsd_set_speed(session, gpsd_get_speed(&session->ttyset_old), 'N', 1); - if (session->device_type->wakeup != NULL) - session->device_type->wakeup(session); } return session->gpsdata.gps_fd; } @@ -271,8 +284,6 @@ bool gpsd_next_hunt_setting(struct gps_device_t *session) gpsd_set_speed(session, rates[session->baudindex], 'N', session->gpsdata.stopbits); - if (session->device_type->wakeup != NULL) - session->device_type->wakeup(session); } return true; /* keep hunting */ |