From: Brian Gix <brian.gix@intel.com>
To: linux-bluetooth@vger.kernel.org, hj.tedd.an@gmail.com,
brian.gix@intel.com
Cc: Tedd Ho-Jeong An <tedd.an@intel.com>
Subject: [PATCH BlueZ v2 1/3] emulator/btdev: Add support HCI_READ_CLOCK command
Date: Fri, 16 Jul 2021 12:39:30 -0700 [thread overview]
Message-ID: <20210716193932.2939264-1-brian.gix@intel.com> (raw)
From: Tedd Ho-Jeong An <tedd.an@intel.com>
This patch adds support HCI_READ_CLOCK command in btdev.
---
emulator/btdev.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/emulator/btdev.c b/emulator/btdev.c
index 90b3d9f31..0a5645c5c 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -2296,6 +2296,22 @@ static int cmd_read_rssi(struct btdev *dev, const void *data,
return 0;
}
+static int cmd_read_clock(struct btdev *dev, const void *data,
+ uint8_t len)
+{
+ const struct bt_hci_cmd_read_clock *cmd = data;
+ struct bt_hci_rsp_read_clock rsp;
+
+ memset(&rsp, 0, sizeof(rsp));
+ rsp.status = BT_HCI_ERR_SUCCESS;
+ rsp.handle = le16_to_cpu(cmd->handle);
+ rsp.clock = 0x11223344;
+ rsp.accuracy = 0x5566;
+ cmd_complete(dev, BT_HCI_CMD_READ_CLOCK, &rsp, sizeof(rsp));
+
+ return 0;
+}
+
static int cmd_enable_dut_mode(struct btdev *dev, const void *data,
uint8_t len)
{
@@ -2389,6 +2405,7 @@ static int cmd_enable_dut_mode(struct btdev *dev, const void *data,
NULL), \
CMD(BT_HCI_CMD_READ_COUNTRY_CODE, cmd_read_country_code, NULL), \
CMD(BT_HCI_CMD_READ_RSSI, cmd_read_rssi, NULL), \
+ CMD(BT_HCI_CMD_READ_CLOCK, cmd_read_clock, NULL), \
CMD(BT_HCI_CMD_ENABLE_DUT_MODE, cmd_enable_dut_mode, NULL)
static void set_common_commands_bredr20(struct btdev *btdev)
@@ -2448,6 +2465,7 @@ static void set_common_commands_bredr20(struct btdev *btdev)
btdev->commands[14] |= 0x40; /* Read Local Extended Features */
btdev->commands[15] |= 0x01; /* Read Country Code */
btdev->commands[15] |= 0x20; /* Read RSSI */
+ btdev->commands[15] |= 0x80; /* Read Clock */
btdev->commands[16] |= 0x04; /* Enable Device Under Test Mode */
}
--
2.31.1
next reply other threads:[~2021-07-16 19:39 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-16 19:39 Brian Gix [this message]
2021-07-16 19:39 ` [PATCH BlueZ v2 2/3] tool/mgmt-tester: Add test cases for Read Clock Information API Brian Gix
2021-07-16 19:39 ` [PATCH BlueZ v2 3/3] tool/mgmt-tester: Add fail_tolerant exception Brian Gix
2021-07-16 20:37 ` [BlueZ,v2,1/3] emulator/btdev: Add support HCI_READ_CLOCK command bluez.test.bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210716193932.2939264-1-brian.gix@intel.com \
--to=brian.gix@intel.com \
--cc=hj.tedd.an@gmail.com \
--cc=linux-bluetooth@vger.kernel.org \
--cc=tedd.an@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).