Return-Path: MIME-Version: 1.0 In-Reply-To: <20130322112031.GA11536@x220.ger.corp.intel.com> References: <1363788708-28355-1-git-send-email-andre.guedes@openbossa.org> <20130322112031.GA11536@x220.ger.corp.intel.com> Date: Tue, 26 Mar 2013 09:59:36 -0300 Message-ID: Subject: Re: [PATCH 0/2] Fix Inquiry command support in HCI request framework From: Andre Guedes To: linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-bluetooth-owner@vger.kernel.org List-ID: Hi Johan, On Fri, Mar 22, 2013 at 8:20 AM, Johan Hedberg wrote: > Hi Andre, > > On Wed, Mar 20, 2013, Andre Guedes wrote: >> HCI Inquiry command causes the controller to enter in inquiry mode. A >> successful Command Status Event for this command means the the >> controller is running the inquiry procedure therefore the HCI Inquiry >> command has completed. The Inquiry Complete Event, on the other hand, >> means the inquiry _procedure_ (not the HCI command) has completed. > > It would be good if you could show exact quotes from the core > specification instead of making stuff up. Here's an exact quote from the > core spec (page 706) regarding events generated by the Inquiry command: > > "No Command Complete event will be sent by the BR/EDR Controller to > indicate that this command has been completed. Instead, the Inquiry > Complete event will indicate that this command has been completed." > > That's quite the opposite of what you're claiming, with no references to > the procedure completion but only the command completion. This makes me > feel like you're trying to persuade us to a particular technical outcome > that suits your needs with the help of misleading/inaccurate > information. > > It might well be in our best interest to keep processing our > request/command queue based on command status events (essentially > treating the commands as completed) but let's at least be honest about > what the exact wording in the core specification is. Here go the quotes about the inquiry procedure you requested (they are on the same page you cited, 706): "A Command Status event shall be sent from the BR/EDR Controller to the Host when the BR/EDR Controller has started the Inquiry process." [...] "An Inquiry Complete event shall be generated when the Inquiry process has completed." Also, on Command Status Event description, on page 979, we have: "The Command Status event is used to indicate that the command described by the Command_Opcode parameter has been received, and that the Controller is currently performing the task for this command. This event is needed to provide mechanisms for asynchronous operation, which makes it possible to prevent the Host from waiting for a command to finish." So, based on those statements of the Core specification, it makes sense to me the HCI request framework should consider the HCI Inquiry command has completed once the Command Status Event is received. Besides that, calling the complete callback in Inquiry Complete Event seems broken. This only works if the HCI request has only the Inquiry command. If we have a HCI request with two HCI commands (inquiry and any other command), the second HCI command will be sent to the controller even if the first command has not completed yet. Additionally, when the second command completes, the complete callback will be called, but the first command has not completed yet. This later issue can lead us to situations where the complete callback is called with success status (the second command returns success), but the Inquiry Complete Event returns error later. Regards, Andre