patch-2.4.11-dontuse linux/net/irda/irlmp.c
Next file: linux/net/irda/irnet/irnet_irda.c
Previous file: linux/net/irda/irlap_event.c
Back to the patch index
Back to the overall index
- Lines: 61
- Date:
Thu Oct 4 18:41:09 2001
- Orig file:
v2.4.10/linux/net/irda/irlmp.c
- Orig date:
Sun Sep 23 11:41:02 2001
diff -u --recursive --new-file v2.4.10/linux/net/irda/irlmp.c linux/net/irda/irlmp.c
@@ -781,10 +781,6 @@
*/
void irlmp_discovery_request(int nslots)
{
- /* Check if user wants to override the default */
- if (nslots == DISCOVERY_DEFAULT_SLOTS)
- nslots = sysctl_discovery_slots;
-
/* Return current cached discovery log */
irlmp_discovery_confirm(irlmp->cachelog);
@@ -792,21 +788,43 @@
* Start a single discovery operation if discovery is not already
* running
*/
- if (!sysctl_discovery)
+ if (!sysctl_discovery) {
+ /* Check if user wants to override the default */
+ if (nslots == DISCOVERY_DEFAULT_SLOTS)
+ nslots = sysctl_discovery_slots;
+
irlmp_do_discovery(nslots);
- /* Note : we never do expiry here. Expiry will run on the
- * discovery timer regardless of the state of sysctl_discovery
- * Jean II */
+ /* Note : we never do expiry here. Expiry will run on the
+ * discovery timer regardless of the state of sysctl_discovery
+ * Jean II */
+ }
}
/*
- * Function irlmp_get_discoveries (pn, mask)
+ * Function irlmp_get_discoveries (pn, mask, slots)
*
* Return the current discovery log
*
*/
-struct irda_device_info *irlmp_get_discoveries(int *pn, __u16 mask)
+struct irda_device_info *irlmp_get_discoveries(int *pn, __u16 mask, int nslots)
{
+ /* If discovery is not enabled, it's likely that the discovery log
+ * will be empty. So, we trigger a single discovery, so that next
+ * time the user call us there might be some results in the log.
+ * Jean II
+ */
+ if (!sysctl_discovery) {
+ /* Check if user wants to override the default */
+ if (nslots == DISCOVERY_DEFAULT_SLOTS)
+ nslots = sysctl_discovery_slots;
+
+ /* Start discovery - will complete sometime later */
+ irlmp_do_discovery(nslots);
+ /* Note : we never do expiry here. Expiry will run on the
+ * discovery timer regardless of the state of sysctl_discovery
+ * Jean II */
+ }
+
/* Return current cached discovery log */
return(irlmp_copy_discoveries(irlmp->cachelog, pn, mask));
}
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)