From 0792c0b319112503dd5129f05536f3c6ae4c746c Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 9 Nov 2004 22:52:40 +0000 Subject: Add hci_set_afh_classification() function --- include/hci.h | 10 ++++++++++ include/hci_lib.h | 1 + src/hci.c | 28 ++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+) diff --git a/include/hci.h b/include/hci.h index 5e874e07..683c988f 100644 --- a/include/hci.h +++ b/include/hci.h @@ -694,6 +694,16 @@ typedef struct { } __attribute__ ((packed)) write_current_iac_lap_cp; #define WRITE_CURRENT_IAC_LAP_CP_SIZE 1+3*MAX_IAC_LAP +#define OCF_SET_AFH_CLASSIFICATION 0x003F +typedef struct { + uint8_t map[10]; +} __attribute__ ((packed)) set_afh_classification_cp; +#define SET_AFH_CLASSIFICATION_CP_SIZE 10 +typedef struct { + uint8_t status; +} __attribute__ ((packed)) set_afh_classification_rp; +#define SET_AFH_CLASSIFICATION_RP_SIZE 1 + #define OCF_READ_INQUIRY_MODE 0x0044 typedef struct { uint8_t status; diff --git a/include/hci_lib.h b/include/hci_lib.h index 095a0b80..b8dbd432 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_set_afh_classification(int dd, uint8_t *map, 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); diff --git a/src/hci.c b/src/hci.c index ee8dce2f..19ee3c4c 100644 --- a/src/hci.c +++ b/src/hci.c @@ -1439,6 +1439,34 @@ int hci_write_afh_mode(int dd, uint8_t mode, int to) return 0; } +int hci_set_afh_classification(int dd, uint8_t *map, int to) +{ + set_afh_classification_cp cp; + set_afh_classification_rp rp; + struct hci_request rq; + + memset(&cp, 0, sizeof(cp)); + memcpy(cp.map, map, 10); + + memset(&rq, 0, sizeof(rq)); + rq.ogf = OGF_HOST_CTL; + rq.ocf = OCF_SET_AFH_CLASSIFICATION; + rq.cparam = &cp; + rq.clen = SET_AFH_CLASSIFICATION_CP_SIZE; + rq.rparam = &rp; + rq.rlen = SET_AFH_CLASSIFICATION_RP_SIZE; + + if (hci_send_req(dd, &rq, to) < 0) + return -1; + + if (rp.status) { + errno = EIO; + return -1; + } + + 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; -- cgit