summaryrefslogtreecommitdiffstats
path: root/src/hci.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-01-13 22:57:36 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-01-13 22:57:36 +0000
commit84cc44acd712f84ff544b7e1b96d1410c732dc8c (patch)
treedd64865287fa04178333d9e71566d92019e0f1ae /src/hci.c
parent864124c296636015f90e26512143cf2c297ed6d2 (diff)
Add function for reading the transmit power level
Diffstat (limited to 'src/hci.c')
-rw-r--r--src/hci.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/hci.c b/src/hci.c
index ca53105e..8e0b7938 100644
--- a/src/hci.c
+++ b/src/hci.c
@@ -1432,6 +1432,36 @@ int hci_write_afh_mode(int dd, uint8_t mode, int to)
return 0;
}
+int hci_read_transmit_power_level(int dd, uint16_t handle, uint8_t type, uint8_t *level, int to)
+{
+ read_transmit_power_level_cp cp;
+ read_transmit_power_level_rp rp;
+ struct hci_request rq;
+
+ memset(&cp, 0, sizeof(cp));
+ cp.handle = handle;
+ cp.type = type;
+
+ memset(&rq, 0, sizeof(rq));
+ rq.ogf = OGF_HOST_CTL;
+ rq.ocf = OCF_READ_TRANSMIT_POWER_LEVEL;
+ rq.cparam = &cp;
+ rq.clen = READ_TRANSMIT_POWER_LEVEL_CP_SIZE;
+ rq.rparam = &rp;
+ rq.rlen = READ_TRANSMIT_POWER_LEVEL_RP_SIZE;
+
+ if (hci_send_req(dd, &rq, to) < 0)
+ return -1;
+
+ if (rp.status) {
+ errno = EIO;
+ return -1;
+ }
+
+ *level = rp.level;
+ return 0;
+}
+
int hci_read_link_supervision_timeout(int dd, uint16_t handle, uint16_t *timeout, int to)
{
read_link_supervision_timeout_rp rp;