* [PATCH 1/2] Bluetooth: Fix discovery state machine
@ 2012-02-13 18:41 Andre Guedes
2012-02-13 18:41 ` [PATCH 2/2] Bluetooth: DISCOVERY_STOPPED state Andre Guedes
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Andre Guedes @ 2012-02-13 18:41 UTC (permalink / raw)
To: linux-bluetooth
In case of Start Discovery command failure, we should set the
discovery state to DISCOVERY_STOPPED. Otherwise, we stuck at
DISCOVERY_STARTING state and subsequent Start Discovery commands
will simply fail.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
---
net/bluetooth/mgmt.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index a2c2e12..a01d0af 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2997,6 +2997,8 @@ int mgmt_start_discovery_failed(struct hci_dev *hdev, u8 status)
struct pending_cmd *cmd;
int err;
+ hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
+
cmd = mgmt_pending_find(MGMT_OP_START_DISCOVERY, hdev);
if (!cmd)
return -ENOENT;
--
1.7.9
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] Bluetooth: DISCOVERY_STOPPED state
2012-02-13 18:41 [PATCH 1/2] Bluetooth: Fix discovery state machine Andre Guedes
@ 2012-02-13 18:41 ` Andre Guedes
2012-02-15 12:31 ` Marcel Holtmann
2012-02-15 12:30 ` [PATCH 1/2] Bluetooth: Fix discovery state machine Marcel Holtmann
2012-02-15 13:25 ` Johan Hedberg
2 siblings, 1 reply; 5+ messages in thread
From: Andre Guedes @ 2012-02-13 18:41 UTC (permalink / raw)
To: linux-bluetooth
We are not supposed to send mgmt_discovering events if we are
transiting from DISCOVERY_STARTING to DISCOVERY_STOPPED state.
It doesn't make sense to send mgmt_discovering event once
discovery procedure has not been even started.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
---
net/bluetooth/hci_core.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 9ada164..dc31e7d 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -380,7 +380,8 @@ void hci_discovery_set_state(struct hci_dev *hdev, int state)
switch (state) {
case DISCOVERY_STOPPED:
- mgmt_discovering(hdev, 0);
+ if (hdev->discovery.state != DISCOVERY_STARTING)
+ mgmt_discovering(hdev, 0);
break;
case DISCOVERY_STARTING:
break;
--
1.7.9
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Bluetooth: Fix discovery state machine
2012-02-13 18:41 [PATCH 1/2] Bluetooth: Fix discovery state machine Andre Guedes
2012-02-13 18:41 ` [PATCH 2/2] Bluetooth: DISCOVERY_STOPPED state Andre Guedes
@ 2012-02-15 12:30 ` Marcel Holtmann
2012-02-15 13:25 ` Johan Hedberg
2 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2012-02-15 12:30 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
Hi Andre,
> In case of Start Discovery command failure, we should set the
> discovery state to DISCOVERY_STOPPED. Otherwise, we stuck at
> DISCOVERY_STARTING state and subsequent Start Discovery commands
> will simply fail.
>
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
> net/bluetooth/mgmt.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Bluetooth: DISCOVERY_STOPPED state
2012-02-13 18:41 ` [PATCH 2/2] Bluetooth: DISCOVERY_STOPPED state Andre Guedes
@ 2012-02-15 12:31 ` Marcel Holtmann
0 siblings, 0 replies; 5+ messages in thread
From: Marcel Holtmann @ 2012-02-15 12:31 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
Hi Andre,
> We are not supposed to send mgmt_discovering events if we are
> transiting from DISCOVERY_STARTING to DISCOVERY_STOPPED state.
> It doesn't make sense to send mgmt_discovering event once
> discovery procedure has not been even started.
>
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
> net/bluetooth/hci_core.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Regards
Marcel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Bluetooth: Fix discovery state machine
2012-02-13 18:41 [PATCH 1/2] Bluetooth: Fix discovery state machine Andre Guedes
2012-02-13 18:41 ` [PATCH 2/2] Bluetooth: DISCOVERY_STOPPED state Andre Guedes
2012-02-15 12:30 ` [PATCH 1/2] Bluetooth: Fix discovery state machine Marcel Holtmann
@ 2012-02-15 13:25 ` Johan Hedberg
2 siblings, 0 replies; 5+ messages in thread
From: Johan Hedberg @ 2012-02-15 13:25 UTC (permalink / raw)
To: Andre Guedes; +Cc: linux-bluetooth
Hi Andre,
On Mon, Feb 13, 2012, Andre Guedes wrote:
> In case of Start Discovery command failure, we should set the
> discovery state to DISCOVERY_STOPPED. Otherwise, we stuck at
> DISCOVERY_STARTING state and subsequent Start Discovery commands
> will simply fail.
>
> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> ---
> net/bluetooth/mgmt.c | 2 ++
> 1 files changed, 2 insertions(+), 0 deletions(-)
Both patches have been applied to my bluetooth-next tree. I also fixed
the summary line of the second patch to be a bit more descriptive.
Thanks.
Johan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-02-15 13:25 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-13 18:41 [PATCH 1/2] Bluetooth: Fix discovery state machine Andre Guedes
2012-02-13 18:41 ` [PATCH 2/2] Bluetooth: DISCOVERY_STOPPED state Andre Guedes
2012-02-15 12:31 ` Marcel Holtmann
2012-02-15 12:30 ` [PATCH 1/2] Bluetooth: Fix discovery state machine Marcel Holtmann
2012-02-15 13:25 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox