[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-dev] [PATCH] gpsd: Don't gratuitously switch drivers, if we al
From: |
Andy Walls |
Subject: |
Re: [gpsd-dev] [PATCH] gpsd: Don't gratuitously switch drivers, if we already have a driver that matches the packet type |
Date: |
Wed, 07 Aug 2013 18:33:04 -0400 |
Same bug reported in April of 2012:
http://lists.nongnu.org/archive/html/gpsd-dev/2012-04/msg00023.html
Regards,
Andy
On Wed, 2013-08-07 at 18:09 -0400, Andy Walls wrote:
> Don't gratuitously switch drivers if we already have a driver that
> matches the packet type.
>
> Without this patch gpsd switches away driver that supports the NMEA
> packet type and switches to the "Generic NMEA" driver.
>
> I have tested this patch with my device only.
>
> I discovered this problem while integrating a Trimble Condor (MT-3329?)
> based device into the MT-3301 driver.
>
> See also:
> http://savannah.nongnu.org/bugs/?38454
>
> There is also another list posting that I can't find right now, with
> someone with a similar problem.
>
> Regards,
> Andy
>
> diff --git a/libgpsd_core.c b/libgpsd_core.c
> index e806328..b0254ed 100644
> --- a/libgpsd_core.c
> +++ b/libgpsd_core.c
> @@ -954,11 +954,18 @@ gps_mask_t gpsd_poll(struct gps_device_t *session)
> /* FALL THROUGH */
> } else if (session->packet.type > COMMENT_PACKET) {
> first_sync = (session->device_type == NULL);
> - for (dp = gpsd_drivers; *dp; dp++)
> - if (session->packet.type == (*dp)->packet_type) {
> - (void)gpsd_switch_driver(session, (*dp)->type_name);
> - break;
> - }
> + /*
> + * Only switch drivers, if we don't already have one with the
> + * matching packet type.
> + */
> + if (first_sync ||
> + session->packet.type != session->device_type->packet_type) {
> + for (dp = gpsd_drivers; *dp; dp++)
> + if (session->packet.type == (*dp)->packet_type) {
> + (void)gpsd_switch_driver(session, (*dp)->type_name);
> + break;
> + }
> + }
> /* FALL THROUGH */
> } else if (session->getcount++>1 && !gpsd_next_hunt_setting(session)) {
> gpsd_run_device_hook(session->gpsdata.dev.path, "DEACTIVATE");
>