Re: [PATCH v2] Bluetooth: btintel: Add manufacturing enter/exit helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Loic,

> Older Intel controllers need to enter manufacturing mode to perform
> some vendor specific operations (patching, configuration...).
> Add enter/exit manufaturing methods and refactor existing
> manufacturing code.
> 
> Signed-off-by: Loic Poulain <loic.poulain@xxxxxxxxx>
> ---
> v2: add static definition if !CONFIG_BT_INTEL
> 
> drivers/bluetooth/btintel.c | 109 ++++++++++++++++++++++----------------------
> drivers/bluetooth/btintel.h |  12 +++++
> drivers/bluetooth/btusb.c   |  54 ++++++----------------
> 3 files changed, 81 insertions(+), 94 deletions(-)
> 
> diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
> index 1f13e61..e9f26eb 100644
> --- a/drivers/bluetooth/btintel.c
> +++ b/drivers/bluetooth/btintel.c
> @@ -73,6 +73,43 @@ int btintel_check_bdaddr(struct hci_dev *hdev)
> }
> EXPORT_SYMBOL_GPL(btintel_check_bdaddr);
> 
> +int btintel_enter_mfg(struct hci_dev *hdev)
> +{
> +	const u8 param[] = { 0x01, 0x00 };
> +	struct sk_buff *skb;
> +
> +	skb = __hci_cmd_sync(hdev, 0xfc11, 2, param, HCI_CMD_TIMEOUT);
> +	if (IS_ERR(skb)) {
> +		bt_dev_err(hdev, "Entering manufacturer mode failed (%ld)",
> +			   PTR_ERR(skb));
> +		return PTR_ERR(skb);
> +	}
> +	kfree_skb(skb);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(btintel_enter_mfg);
> +
> +int btintel_exit_mfg(struct hci_dev *hdev, bool reset, bool patched)
> +{
> +	u8 param[] = { 0x00, 0x00 };
> +	struct sk_buff *skb;
> +

please add a comment above this that talks about activating / deactivating patches. From the original code this was obvious since it was in the command buffer name.

The 0x02 means reset and activate patches while 0x01 means reset and deactivate patches. So a comment spelling this out in plain English would help here to understand what the patched parameter means.

And of course reset == false means that we just disable manufacturer mode. So mentioning that would be useful as well.

> +	if (reset)
> +		param[1] |= patched ? 0x02 : 0x01;
> +
> +	skb = __hci_cmd_sync(hdev, 0xfc11, 2, param, HCI_CMD_TIMEOUT);
> +	if (IS_ERR(skb)) {
> +		bt_dev_err(hdev, "Exiting manufacturer mode failed (%ld)",
> +			   PTR_ERR(skb));
> +		return PTR_ERR(skb);
> +	}
> +	kfree_skb(skb);
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL_GPL(btintel_exit_mfg);

Regards

Marcel

--
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



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux