summaryrefslogtreecommitdiff
path: root/www/writing-a-driver.xml
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-09-13 09:03:35 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-09-13 09:03:35 +0000
commitcd419e26ba8bfda8ba3fa8193a792bf2b4f35e44 (patch)
tree124e2d17cbaa9c1d0cdeb6a5b04f056bf34610fc /www/writing-a-driver.xml
parent00cd07ffcaa670709bc492e01d5c97be0262580b (diff)
downloadgpsd-cd419e26ba8bfda8ba3fa8193a792bf2b4f35e44.tar.gz
The configurator member becomes event_hook.
Code that referenced the sequence number argument now looks at session->packet_counter directly. This was almost a pure refactoring step. I added one obviously missing session->packet.counter == 0 test in the oncore driver. Despite temptation, I didn't try to fix when the packet.counter gets zeroed; I'm going to try to confine the behavior changes to one concise patch, which hasn't happened yet. Codebase splints clean. All regression tests pass.
Diffstat (limited to 'www/writing-a-driver.xml')
-rw-r--r--www/writing-a-driver.xml16
1 files changed, 10 insertions, 6 deletions
diff --git a/www/writing-a-driver.xml b/www/writing-a-driver.xml
index bbeef663..69ea7454 100644
--- a/www/writing-a-driver.xml
+++ b/www/writing-a-driver.xml
@@ -605,10 +605,10 @@ document I discuss my work to implement this function.</para>
that wakes up the device when the main auto-baud hunt loop in
the daemon offers a new speed to probe at.</para>
-<para><structfield>.configurator</structfield> points to a block of
+<para><structfield>.event_hook</structfield> points to a block of
code that will be executed on and after various events, distinguished by a
second argument that specifies the event type. It also gets a scond
-argument which may be a packet sequence number. The configurator hook
+argument which may be a packet sequence number. The event_hook hook
is called in the following circumstances:</para>
<itemizedlist>
@@ -620,7 +620,7 @@ device's driver to a different type, with event type
<listitem><para>
Whenever gpsd_switch_driver() is called, with event
-type 'configurator' and sequence number zero, <emphasis>even if no driver
+type 'event_configur', <emphasis>even if no driver
change occurs</emphasis>. (Thus, when rhe driver type changes, the
configurator hook is called twice with two different event types. _
</para></listitem>
@@ -636,9 +636,7 @@ number is set to zero and passed to both these calls.
</para></listitem>
<listitem><para>
-Whenever a full packet is received, with event type 'event_probe_subtype'
-and the second argument being the sequence number of the packet since
-the last driver switch (1 or greater).
+Whenever a full packet is received, with event type 'event_probe_subtype'.
</para></listitem>
</itemizedlist>
@@ -654,6 +652,12 @@ of the driver data structure <userinput>struct gps_device_t
the correct set of sentences to supply the parser with the data needed
by <filename>gpsd</filename>.</para>
+<para>When writing hook code, it is iuseful to brer in mind that the
+<structfield>.packet.counter</structfield> member of the session
+structure is available; it is often useful to take action only
+when this counter is zero. It is zeroed when the device is activated
+or someting triggers a device change.</para>
+
<para><structfield>.get_packet</structfield> points to a block of code
that actually gets the packets from the serial stream. You will
almost certainly use the generic routine