Skip to content

Commit

Permalink
Change the API so the yermios strucytture is not publicly exposed.
Browse files Browse the repository at this point in the history
Becauser this changed the libgpsd API but not the libgps one, libgpsd now
has its own version number. (Doing otherwise would have inflicted a gratuitous
binary-compatibility break on application developers).

All regression tests pass.  Audit check runs clean.
  • Loading branch information
eric-s-raymond committed Sep 7, 2012
1 parent d6312e3 commit a5f284d
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 13 deletions.
13 changes: 9 additions & 4 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,12 @@
gpsd_version = "3.8~dev"

# library version
libgps_version_current = 20
libgps_version_revision = 0
libgps_version_age = 0
libgps_version_current = 20
libgps_version_revision = 0
libgps_version_age = 0
libgpsd_version_current = 21
libgpsd_version_revision = 0
libgpsd_version_age = 0

# Release identification ends here

Expand Down Expand Up @@ -677,6 +680,8 @@ else:

libgps_version_soname = libgps_version_current - libgps_version_age
libgps_version = "%d.%d.%d" %(libgps_version_soname, libgps_version_age, libgps_version_revision)
libgpsd_version_soname = libgpsd_version_current - libgpsd_version_age
libgpsd_version = "%d.%d.%d" %(libgpsd_version_soname, libgpsd_version_age, libgpsd_version_revision)

libgps_sources = [
"ais_json.c",
Expand Down Expand Up @@ -838,7 +843,7 @@ env.Clean(compiled_gpslib, "gps_maskdump.c")
compiled_gpsdlib = Library(env=env,
target="gpsd",
sources=libgpsd_sources,
version=libgps_version,
version=libgpsd_version,
parse_flags=usblibs + rtlibs + bluezlibs)

libraries = [compiled_gpslib, compiled_gpsdlib]
Expand Down
2 changes: 1 addition & 1 deletion drivers.c
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ static bool fury_rate_switcher(struct gps_device_t *session, double rate)

static void fury_event_hook(struct gps_device_t *session, event_t event)
{
if (event == event_wakeup && gpsd_get_speed(&session->ttyset) == 115200)
if (event == event_wakeup && gpsd_get_speed(session) == 115200)
(void)fury_rate_switcher(session, 1.0);
else if (event == event_deactivate)
(void)fury_rate_switcher(session, 0.0);
Expand Down
2 changes: 1 addition & 1 deletion gpsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1217,7 +1217,7 @@ static void handle_request(struct subscriber_t *sub,
/* interpret defaults */
if (devconf.baudrate == DEVDEFAULT_BPS)
devconf.baudrate =
(uint) gpsd_get_speed(&device->ttyset);
(uint) gpsd_get_speed(device);
if (devconf.parity == DEVDEFAULT_PARITY)
devconf.stopbits = device->gpsdata.dev.stopbits;
if (devconf.stopbits == DEVDEFAULT_STOPBITS)
Expand Down
3 changes: 2 additions & 1 deletion gpsd.h-tail
Original file line number Diff line number Diff line change
Expand Up @@ -723,7 +723,8 @@ extern ssize_t gpsd_write(struct gps_device_t *, const char *, size_t);
extern bool gpsd_next_hunt_setting(struct gps_device_t *);
extern int gpsd_switch_driver(struct gps_device_t *, char *);
extern void gpsd_set_speed(struct gps_device_t *, speed_t, char, unsigned int);
extern speed_t gpsd_get_speed(const struct termios *);
extern speed_t gpsd_get_speed(const struct gps_device_t *);
extern speed_t gpsd_get_speed_old(const struct gps_device_t *);
extern void gpsd_assert_sync(struct gps_device_t *);
extern void gpsd_close(struct gps_device_t *);

Expand Down
2 changes: 1 addition & 1 deletion gpsd_json.c
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ void json_device_dump(const struct gps_device_t *device,
(void)snprintf(reply + strlen(reply), replylen - strlen(reply),
"\"native\":%d,\"bps\":%d,\"parity\":\"%c\",\"stopbits\":%u,\"cycle\":%2.2f",
device->gpsdata.dev.driver_mode,
(int)gpsd_get_speed(&device->ttyset),
(int)gpsd_get_speed(device),
device->gpsdata.dev.parity,
device->gpsdata.dev.stopbits,
device->gpsdata.dev.cycle);
Expand Down
2 changes: 1 addition & 1 deletion libgpsd_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)

/* track the packet count since achieving sync on the device */
if (first_sync) {
speed_t speed = gpsd_get_speed(&session->ttyset);
speed_t speed = gpsd_get_speed(session);

/*@-nullderef@*/
gpsd_report(LOG_INF,
Expand Down
16 changes: 13 additions & 3 deletions serial.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void cfmakeraw(struct termios *termios_p)
}
#endif /* defined(__CYGWIN__) */

speed_t gpsd_get_speed(const struct termios *ttyctl)
static speed_t gpsd_get_speed_termios(const struct termios *ttyctl)
{
speed_t code = cfgetospeed(ttyctl);
switch (code) {
Expand Down Expand Up @@ -168,6 +168,16 @@ speed_t gpsd_get_speed(const struct termios *ttyctl)
}
}

speed_t gpsd_get_speed(const struct gps_device_t *dev)
{
return gpsd_get_speed_termios(&dev->ttyset);
}

speed_t gpsd_get_speed_old(const struct gps_device_t *dev)
{
return gpsd_get_speed_termios(&dev->ttyset_old);
}

bool gpsd_set_raw(struct gps_device_t * session)
{
(void)cfmakeraw(&session->ttyset);
Expand Down Expand Up @@ -306,7 +316,7 @@ void gpsd_set_speed(struct gps_device_t *session,
(void)tcflush(session->gpsdata.gps_fd, TCIOFLUSH);
}
gpsd_report(LOG_INF, "speed %u, %d%c%d\n",
gpsd_get_speed(&session->ttyset), 9 - stopbits, parity,
gpsd_get_speed(session), 9 - stopbits, parity,
stopbits);

session->gpsdata.dev.baudrate = (unsigned int)speed;
Expand Down Expand Up @@ -485,7 +495,7 @@ int gpsd_serial_open(struct gps_device_t *session)
#ifdef FIXED_PORT_SPEED
FIXED_PORT_SPEED,
#else
gpsd_get_speed(&session->ttyset_old),
gpsd_get_speed(session),
#endif /* FIXED_PORT_SPEED */
'N',
#ifdef FIXED_STOP_BITS
Expand Down
2 changes: 1 addition & 1 deletion subframe.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ gps_mask_t gpsd_interpret_subframe_raw(struct gps_device_t *session,
uint32_t parity;

if (session->subframe_count++ == 0) {
speed_t speed = gpsd_get_speed(&session->ttyset);
speed_t speed = gpsd_get_speed(session);

if (speed < 38400)
gpsd_report(LOG_WARN, "speed less than 38,400 may cause data lag and loss of functionality\n");
Expand Down

0 comments on commit a5f284d

Please sign in to comment.