summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2003-03-22 08:00:36 +0000
committerMarcel Holtmann <marcel@holtmann.org>2003-03-22 08:00:36 +0000
commit1c9576607a611e033e0bac0f56d91146c120a16d (patch)
treebf1f45ee6e5aed3e94fb4a6b154b98efda4614ca /src
parentbfcbbde6d7baebca27c6e93f02f6279e5f36c866 (diff)
Support for reading the clock offset
Diffstat (limited to 'src')
-rw-r--r--src/hci.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/hci.c b/src/hci.c
index 5c58b129..9a5c7dfe 100644
--- a/src/hci.c
+++ b/src/hci.c
@@ -905,6 +905,36 @@ int hci_read_remote_version(int dd, uint16_t handle, struct hci_version *ver, in
return 0;
}
+int hci_read_clock_offset(int dd, uint16_t handle, uint16_t *clkoffset, int to)
+{
+ evt_read_clock_offset_complete rp;
+ read_clock_offset_cp cp;
+ struct hci_request rq;
+
+ memset(&cp, 0, sizeof(cp));
+ cp.handle = handle;
+
+ memset(&rq, 0, sizeof(rq));
+ rq.ogf = OGF_LINK_CTL;
+ rq.ocf = OCF_READ_CLOCK_OFFSET;
+ rq.event = EVT_READ_CLOCK_OFFSET_COMPLETE;
+ rq.cparam = &cp;
+ rq.clen = READ_CLOCK_OFFSET_CP_SIZE;
+ rq.rparam = &rp;
+ rq.rlen = EVT_READ_CLOCK_OFFSET_COMPLETE_SIZE;
+
+ if (hci_send_req(dd, &rq, to) < 0)
+ return -1;
+
+ if (rp.status) {
+ errno = EIO;
+ return -1;
+ }
+
+ *clkoffset = rp.clock_offset;
+ return 0;
+}
+
int hci_read_local_version(int dd, struct hci_version *ver, int to)
{
read_local_version_rp rp;