summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2004-10-25 07:36:45 +0000
committerMarcel Holtmann <marcel@holtmann.org>2004-10-25 07:36:45 +0000
commit1a04074615c182634202f03fd74a73f62107b93c (patch)
treeeed297e59b0c6fca8b945b4f14050b6ef82b2703
parentcc0deab6cac822b062e1c6ab7322d1e1d75d463e (diff)
Add functions for reading and writing the inquiry mode
-rw-r--r--include/hci_lib.h2
-rw-r--r--src/hci.c51
2 files changed, 53 insertions, 0 deletions
diff --git a/include/hci_lib.h b/include/hci_lib.h
index 8c321d90..e40a1afd 100644
--- a/include/hci_lib.h
+++ b/include/hci_lib.h
@@ -88,6 +88,8 @@ int hci_encrypt_link(int dd, uint16_t handle, uint8_t encrypt, int to);
int hci_switch_role(int dd, bdaddr_t *bdaddr, uint8_t role, int to);
int hci_park_mode(int dd, uint16_t handle, uint16_t max_interval, uint16_t min_interval, int to);
int hci_exit_park_mode(int dd, uint16_t handle, int to);
+int hci_read_inquiry_mode(int dd, uint8_t *mode, int to);
+int hci_write_inquiry_mode(int dd, uint8_t mode, int to);
int hci_for_each_dev(int flag, int(*func)(int s, int dev_id, long arg), long arg);
int hci_get_route(bdaddr_t *bdaddr);
diff --git a/src/hci.c b/src/hci.c
index ffa453f3..3ab433f0 100644
--- a/src/hci.c
+++ b/src/hci.c
@@ -1305,3 +1305,54 @@ int hci_exit_park_mode(int dd, uint16_t handle, int to)
return 0;
}
+
+int hci_read_inquiry_mode(int dd, uint8_t *mode, int to)
+{
+ read_inquiry_mode_rp rp;
+ struct hci_request rq;
+
+ memset(&rq, 0, sizeof(rq));
+ rq.ogf = OGF_HOST_CTL;
+ rq.ocf = OCF_READ_INQUIRY_MODE;
+ rq.rparam = &rp;
+ rq.rlen = READ_INQUIRY_MODE_RP_SIZE;
+
+ if (hci_send_req(dd, &rq, to) < 0)
+ return -1;
+
+ if (rp.status) {
+ errno = EIO;
+ return -1;
+ }
+
+ *mode = rp.mode;
+ return 0;
+}
+
+int hci_write_inquiry_mode(int dd, uint8_t mode, int to)
+{
+ write_inquiry_mode_cp cp;
+ write_inquiry_mode_rp rp;
+ struct hci_request rq;
+
+ memset(&cp, 0, sizeof(cp));
+ cp.mode = mode;
+
+ memset(&rq, 0, sizeof(rq));
+ rq.ogf = OGF_HOST_CTL;
+ rq.ocf = OCF_WRITE_INQUIRY_MODE;
+ rq.cparam = &cp;
+ rq.clen = WRITE_INQUIRY_MODE_CP_SIZE;
+ rq.rparam = &rp;
+ rq.rlen = WRITE_INQUIRY_MODE_RP_SIZE;
+
+ if (hci_send_req(dd, &rq, to) < 0)
+ return -1;
+
+ if (rp.status) {
+ errno = EIO;
+ return -1;
+ }
+
+ return 0;
+}