summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-01-25 21:36:28 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-01-25 21:36:28 +0000
commit1e2dec5679c175fc52d2e19ebe06b9e1a7b05461 (patch)
tree8a895d580e2356761afdd43a5646eb797b4ccea5 /src
parent654f832d98530b05dc7ffaefff5950a32de76b3c (diff)
Add hci_read_clock() function
Diffstat (limited to 'src')
-rw-r--r--src/hci.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/hci.c b/src/hci.c
index 87f4874b..387560aa 100644
--- a/src/hci.c
+++ b/src/hci.c
@@ -1620,6 +1620,37 @@ int hci_read_afh_map(int dd, uint16_t handle, uint8_t *mode, uint8_t *map, int t
return 0;
}
+int hci_read_clock(int dd, uint16_t handle, uint8_t which, uint32_t *clock, uint16_t *accuracy, int to)
+{
+ read_clock_cp cp;
+ read_clock_rp rp;
+ struct hci_request rq;
+
+ memset(&cp, 0, sizeof(cp));
+ cp.handle = handle;
+ cp.which_clock = which;
+
+ memset(&rq, 0, sizeof(rq));
+ rq.ogf = OGF_STATUS_PARAM;
+ rq.ocf = OCF_READ_CLOCK;
+ rq.cparam = &cp;
+ rq.clen = READ_CLOCK_CP_SIZE;
+ rq.rparam = &rp;
+ rq.rlen = READ_CLOCK_RP_SIZE;
+
+ if (hci_send_req(dd, &rq, to) < 0)
+ return -1;
+
+ if (rp.status) {
+ errno = EIO;
+ return -1;
+ }
+
+ *clock = rp.clock;
+ *accuracy = rp.accuracy;
+ return 0;
+}
+
int hci_local_name(int dd, int len, char *name, int to)
{
return hci_read_local_name(dd, len, name, to);