From 213febe584cdd8c7b5fd2defc2d56f0c84677e51 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 9 Nov 2004 22:29:55 +0000 Subject: Add hci_read_afh_map() function --- include/hci_lib.h | 1 + src/hci.c | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/include/hci_lib.h b/include/hci_lib.h index 356e4edd..095a0b80 100644 --- a/include/hci_lib.h +++ b/include/hci_lib.h @@ -93,6 +93,7 @@ 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_read_afh_mode(int dd, uint8_t *mode, int to); int hci_write_afh_mode(int dd, uint8_t mode, int to); +int hci_read_afh_map(int dd, uint16_t handle, uint8_t *mode, uint8_t *map, 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 9ebd5a23..ee8dce2f 100644 --- a/src/hci.c +++ b/src/hci.c @@ -1438,3 +1438,29 @@ int hci_write_afh_mode(int dd, uint8_t mode, int to) return 0; } + +int hci_read_afh_map(int dd, uint16_t handle, uint8_t *mode, uint8_t *map, int to) +{ + read_afh_map_rp rp; + struct hci_request rq; + + memset(&rq, 0, sizeof(rq)); + rq.ogf = OGF_STATUS_PARAM; + rq.ocf = OCF_READ_AFH_MAP; + rq.cparam = &handle; + rq.clen = 2; + rq.rparam = &rp; + rq.rlen = READ_AFH_MAP_RP_SIZE; + + if (hci_send_req(dd, &rq, to) < 0) + return -1; + + if (rp.status) { + errno = EIO; + return -1; + } + + *mode = rp.mode; + memcpy(map, rp.map, 10); + return 0; +} -- cgit