Currently if bluetoothd crashes, or when a non-bluetoothd program enables periodic or standard inquiry, bluetoothd will be unable to start discovery. This causes problems with bluetoothd's internal state, since it maintains a list of devices it has discovered and that list never gets cleared for new discovery sessions. Also, bluetoothd becomes unable to *stop* discovery other than by disabling an adapter entirely. An unfortunately common case is that of bluetoothd crashing while in discovery mode, which can leave the system in a state that cannot be recovered from by simply restarting bluetoothd. This patch is broken into two parts: one deals with the case of standard inquiry, and the other with periodic inquiry. Standard inquiry is a simple case because we can simply check the adapter's status bits at startup, and issue a command to stop inquiry if standard inquiry is active. Periodic inquiry is a different problem, because (as far as I know) there's no easy status bit to check. A few patches are proposed for the latter problem: one simply issues a command to stop periodic inquiry at startup, without prior status testing or error checking. Another attempts to disable periodic discovery when a device result is received when the list of discovery sessions on the btd_adapter structure is empty. Zygo Blaxell (2): Handle case where inquiry is active when bluetoothd starts up Cancel periodic inquiry if an unexpected discovery result is received Cancel periodic inquiry at startup -- 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