diff options
-rw-r--r-- | include/hci_lib.h | 3 | ||||
-rw-r--r-- | src/hci.c | 20 |
2 files changed, 20 insertions, 3 deletions
diff --git a/include/hci_lib.h b/include/hci_lib.h index afa2fb51..ba33be73 100644 --- a/include/hci_lib.h +++ b/include/hci_lib.h @@ -69,7 +69,8 @@ int hci_remote_name(int dd, bdaddr_t *ba, int len, char *name, int to); int hci_read_remote_features(int dd, uint16_t handle, uint8_t *features, int to); int hci_read_remote_version(int dd, uint16_t handle, struct hci_version *ver, int to); int hci_read_local_version(int dd, struct hci_version *ver, int to); -int hci_class_of_dev(int dd, uint8_t *class, int to); +int hci_read_class_of_dev(int dd, uint8_t *cls, int to); +int hci_write_class_of_dev(int dd, uint32_t cls, int to); int hci_read_current_iac_lap(int dd, uint8_t *num_iac, uint8_t *lap, int to); int hci_write_current_iac_lap(int dd, uint8_t num_iac, uint8_t *lap, int to); @@ -900,7 +900,7 @@ int hci_read_local_version(int dd, struct hci_version *ver, int to) return 0; } -int hci_class_of_dev(int dd, uint8_t *class, int to) +int hci_read_class_of_dev(int dd, uint8_t *cls, int to) { read_class_of_dev_rp rp; struct hci_request rq; @@ -919,10 +919,26 @@ int hci_class_of_dev(int dd, uint8_t *class, int to) return -1; } - memcpy(class, rp.dev_class, 3); + memcpy(cls, rp.dev_class, 3); return 0; } +int hci_write_class_of_dev(int dd, uint32_t cls, int to) +{ + write_class_of_dev_cp cp; + struct hci_request rq; + + memset(&rq, 0, sizeof(rq)); + cp.dev_class[0] = cls & 0xff; + cp.dev_class[1] = (cls >> 8) & 0xff; + cp.dev_class[2] = (cls >> 16) & 0xff; + rq.ogf = OGF_HOST_CTL; + rq.ocf = OCF_WRITE_CLASS_OF_DEV; + rq.cparam = &cp; + rq.clen = WRITE_CLASS_OF_DEV_CP_SIZE; + return hci_send_req(dd, &rq, 1000); +} + int hci_read_current_iac_lap(int dd, uint8_t *num_iac, uint8_t *lap, int to) { read_current_iac_lap_rp rp; |