gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[gpsd-dev] Fw: [PATCH] gpsd: Don't gratuitously switch drivers, if we al


From: Gary E. Miller
Subject: [gpsd-dev] Fw: [PATCH] gpsd: Don't gratuitously switch drivers, if we already have a driver that matches the packet type
Date: Wed, 7 Aug 2013 16:19:43 -0700

Yo All!

For some reason the list did not accept the post below which I also got
directly.

The patch looks good to me, but is in a delicate place.  All regessions
pass for me, except the 3 that are already bad for me.  Pushed to git.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97701
        address@hidden  Tel:+1(541)382-8588


Begin forwarded message:

Date: Wed, 07 Aug 2013 18:09:34 -0400
From: Andy Walls <address@hidden>
To: address@hidden
Cc: address@hidden
Subject: [PATCH] gpsd: Don't gratuitously switch drivers, if we already
have a driver that matches the packet type


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");





RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97701
        address@hidden  Tel:+1(541)382-8588

Attachment: signature.asc
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]