diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2004-10-25 07:36:45 +0000 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2004-10-25 07:36:45 +0000 |
commit | 1a04074615c182634202f03fd74a73f62107b93c (patch) | |
tree | eed297e59b0c6fca8b945b4f14050b6ef82b2703 /src/hci.c | |
parent | cc0deab6cac822b062e1c6ab7322d1e1d75d463e (diff) |
Add functions for reading and writing the inquiry mode
Diffstat (limited to 'src/hci.c')
-rw-r--r-- | src/hci.c | 51 |
1 files changed, 51 insertions, 0 deletions
@@ -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; +} |