diff options
Diffstat (limited to 'www/writing-a-driver.xml')
-rw-r--r-- | www/writing-a-driver.xml | 16 |
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 |