Hi Hemant, On Thu, Apr 05, 2012, Hemant Gupta wrote: > I found this issue because I found the following situation that LE > Scan failed to start (in my case because of Limited resources). At > that time, the discovery state was DISCOVERY_STARTING. In that case, > user space, had already started the discovery session, which is freed > only on receiving the event in MGMT_EV_DISCOVERING, with state set to > FALSE. If you look at the code of mgmt_start_discovery_failed () > below, which will be called when LE Scan failed to start, no > MGMT_EV_DISCOVERING is sent to user space, so user space would never > free the discovery session that it has created while calling > start_discovery. In short Inquiry never finishes. That's a bug in user space and it should be fixed there. I.e. user space should be fixed to handle the command status/complete for start_discovery properly. > > So who sends the appropriate command complete event to start_discovery > > now? I don't see any other place that would do it. > > It is being sent from the mgmt_discovering(hdev, 0); called because of > call to hci_discovery_set_state, which will set state to > DISCOVERY_STOPPED, since the current state would in this case be > DISCOVERY_STARTING. If the "discovering" parameter passed to mgmt_discovering is 0 then mgmt_discovering will only look for a pending MGMT_OP_STOP_DISCOVERY and not MGMT_OP_START_DISCOVERY. So it still looks to me like there'd be a missing command complete. Anyway, like I said this looks more like something we need to fix in user space before making the next release. Johan -- To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html