* Make sure that state is XMIT_P/XMIT_S when calling this function
* (and that nobody messed up with the state). - Jean II
*/
-void irlap_start_poll_timer(struct irlap_cb *self, int timeout)
+static void irlap_start_poll_timer(struct irlap_cb *self, int timeout)
{
ASSERT(self != NULL, return;);
ASSERT(self->magic == LAP_MAGIC, return;);
self->frame_sent = FALSE;
/*
- * Remember to multiply the query timeout value with
- * the number of slots used
+ * Go to reply state until end of discovery to
+ * inhibit our own transmissions. Set the timer
+ * to not stay forever there... Jean II
*/
- irlap_start_query_timer(self, QUERY_TIMEOUT*info->S);
+ irlap_start_query_timer(self, info->S, info->s);
irlap_next_state(self, LAP_REPLY);
} else {
/* This is the final slot. How is it possible ?
* Not much. It's too late to answer those discovery frames,
* so we just pass the info to IrLMP who will put it in the
* log (and post an event).
+ * Another cause would be devices that do discovery much
+ * slower than us, however the latest fixes should minimise
+ * those cases...
* Jean II
*/
IRDA_DEBUG(1, "%s(), Receiving final discovery request, missed the discovery slots :-(\n", __FUNCTION__);
switch (event) {
case QUERY_TIMER_EXPIRED:
- IRDA_DEBUG(2, "%s(), QUERY_TIMER_EXPIRED <%ld>\n",
+ IRDA_DEBUG(0, "%s(), QUERY_TIMER_EXPIRED <%ld>\n",
__FUNCTION__, jiffies);
irlap_next_state(self, LAP_NDM);
break;
irlap_next_state(self, LAP_NDM);
irlap_discovery_indication(self, info->discovery);
- } else if ((info->s >= self->slot) && (!self->frame_sent)) {
- discovery_rsp = irlmp_get_discovery_response();
- discovery_rsp->data.daddr = info->daddr;
+ } else {
+ /* If it's our slot, send our reply */
+ if ((info->s >= self->slot) && (!self->frame_sent)) {
+ discovery_rsp = irlmp_get_discovery_response();
+ discovery_rsp->data.daddr = info->daddr;
- irlap_send_discovery_xid_frame(self, info->S,
- self->slot, FALSE,
- discovery_rsp);
+ irlap_send_discovery_xid_frame(self, info->S,
+ self->slot,
+ FALSE,
+ discovery_rsp);
- self->frame_sent = TRUE;
- irlap_next_state(self, LAP_REPLY);
+ self->frame_sent = TRUE;
+ }
+ /* Readjust our timer to accomodate devices
+ * doing faster or slower discovery than us...
+ * Jean II */
+ irlap_start_query_timer(self, info->S, info->s);
+
+ /* Keep state */
+ //irlap_next_state(self, LAP_REPLY);
}
break;
default: