From 9aa01920bf2e6f3b9b23b44d7c5e48dadc2f8da8 Mon Sep 17 00:00:00 2001 From: Stephen Crane Date: Thu, 22 Aug 2002 09:19:29 +0000 Subject: implement hci_{read, write}_class_of_dev() --- src/hci.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/hci.c') diff --git a/src/hci.c b/src/hci.c index 40a19fb2..6b60477a 100644 --- a/src/hci.c +++ b/src/hci.c @@ -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; -- cgit