summaryrefslogtreecommitdiffstats
path: root/tools/csr.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-07-03 10:09:51 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-07-03 10:09:51 +0000
commit2dd0e662aaec1ec73b7783a625c1645020dc29d7 (patch)
tree47edac2be27f6ad0b2d41fc9750982bfb5772ae4 /tools/csr.c
parenta32c06bc2990f56420782e8966aa5de08b61d505 (diff)
Add support for reading uint32 values
Diffstat (limited to 'tools/csr.c')
-rw-r--r--tools/csr.c40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/csr.c b/tools/csr.c
index fd547ad3..4648d9fa 100644
--- a/tools/csr.c
+++ b/tools/csr.c
@@ -504,6 +504,46 @@ int csr_read_varid_uint16(int dd, uint16_t seqnum, uint16_t varid, uint16_t *val
return 0;
}
+int csr_read_varid_uint32(int dd, uint16_t seqnum, uint16_t varid, uint32_t *value)
+{
+ unsigned char cmd[] = { 0x00, 0x00, 0x09, 0x00,
+ seqnum & 0xff, seqnum >> 8, varid & 0xff, varid >> 8, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+ unsigned char cp[254], rp[254];
+ struct hci_request rq;
+
+ memset(&cp, 0, sizeof(cp));
+ cp[0] = 0xc2;
+ memcpy(cp + 1, cmd, sizeof(cmd));
+
+ memset(&rq, 0, sizeof(rq));
+ rq.ogf = OGF_VENDOR_CMD;
+ rq.ocf = 0x00;
+ rq.event = EVT_VENDOR;
+ rq.cparam = cp;
+ rq.clen = sizeof(cmd) + 1;
+ rq.rparam = rp;
+ rq.rlen = sizeof(rp);
+
+ if (hci_send_req(dd, &rq, 2000) < 0)
+ return -1;
+
+ if (rp[0] != 0xc2) {
+ errno = EIO;
+ return -1;
+ }
+
+ if ((rp[9] + (rp[10] << 8)) != 0) {
+ errno = ENXIO;
+ return -1;
+ }
+
+ *value = ((rp[11] + (rp[12] << 8)) << 16) + (rp[13] + (rp[14] << 8));
+
+ return 0;
+}
+
int csr_read_pskey_complex(int dd, uint16_t seqnum, uint16_t pskey, uint8_t *value, uint16_t length)
{
unsigned char cmd[] = { 0x00, 0x00, ((length / 2) + 8) & 0xff, ((length / 2) + 8) >> 8,