Hi Johan, On Tue, Oct 1, 2013 at 11:22 AM, <johan.hedberg@xxxxxxxxx> wrote: > + if (!lmp_bredr_capable(hdev) || !lmp_le_capable(hdev)) > + return cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING, > + MGMT_STATUS_REJECTED); > + > + if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) > + return cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING, > + MGMT_STATUS_REJECTED); > + > + if (cp->val != 0x00 && cp->val != 0x01) > + return cmd_status(sk, hdev->id, MGMT_OP_SET_ADVERTISING, > + MGMT_STATUS_INVALID_PARAMS); Looks like the above 3 cmd_status() should use MGMT_OP_SET_BREDR. > + > + hci_dev_lock(hdev); > + > + val = !!cp->val; > + enabled = test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags); > + > + if (!hdev_is_powered(hdev) || val == enabled) { > + bool changed = false; > + > + if (val != test_bit(HCI_BREDR_ENABLED, &hdev->dev_flags)) { > + change_bit(HCI_BREDR_ENABLED, &hdev->dev_flags); > + changed = true; > + } IMHO the trick used in another patch from Marcel (sent a while ago for enabling/disabling HS) is easier to follow, something like (may require adaptation if the logic is not the same than MGMT_OP_SET_HS): if (cp->val) changed = !test_and_set_bit(HCI_BREDR_ENABLED, &hdev->dev_flags); else changed = test_and_clear_bit(HCI_BREDR_ENABLED, &hdev->dev_flags); > + > + err = send_settings_rsp(sk, MGMT_OP_SET_BREDR, hdev); > + if (err < 0) > + goto unlock; > + > + if (changed) > + err = new_settings(hdev, sk); > + > + goto unlock; > + } Best Regards, -- Anderson Lizardo Instituto Nokia de Tecnologia - INdT Manaus - Brazil -- 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