Skip to content

Commit

Permalink
Bluetooth: Fix discovery state machine
Browse files Browse the repository at this point in the history
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>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
Andre Guedes authored and Johan Hedberg committed Feb 15, 2012
1 parent e70bb2e commit 203159d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/bluetooth/mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -3096,6 +3096,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;
Expand Down

0 comments on commit 203159d

Please sign in to comment.