linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] lib: Add HCI write SSP debug mode library function
@ 2012-03-28 10:43 james.steele
  2012-03-28 11:25 ` Johan Hedberg
  0 siblings, 1 reply; 2+ messages in thread
From: james.steele @ 2012-03-28 10:43 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: james.steele

Adds a hci_write_simple_pairing_debug_mode function.
Also corrects the Testing OGF value to match the specification.
---
 lib/hci.c     |   28 ++++++++++++++++++++++++++++
 lib/hci.h     |    2 +-
 lib/hci_lib.h |    2 ++
 3 files changed, 31 insertions(+), 1 deletions(-)

diff --git a/lib/hci.c b/lib/hci.c
index 269c021..52f9b33 100644
--- a/lib/hci.c
+++ b/lib/hci.c
@@ -2735,6 +2735,34 @@ int hci_read_clock(int dd, uint16_t handle, uint8_t which, uint32_t *clock,
        return 0;
 }

+int hci_write_simple_pairing_debug_mode(int dd, uint8_t mode, int to)
+{
+       write_simple_pairing_debug_mode_cp cp;
+       write_simple_pairing_debug_mode_rp rp;
+       struct hci_request rq;
+
+       memset(&cp, 0, sizeof(cp));
+       cp.mode = mode;
+
+       memset(&rq, 0, sizeof(rq));
+       rq.ogf    = OGF_TESTING_CMD;
+       rq.ocf    = OCF_WRITE_SIMPLE_PAIRING_DEBUG_MODE;
+       rq.cparam = &cp;
+       rq.clen   = WRITE_SIMPLE_PAIRING_DEBUG_MODE_CP_SIZE;
+       rq.rparam = &rp;
+       rq.rlen   = WRITE_SIMPLE_PAIRING_DEBUG_MODE_RP_SIZE;
+
+       if (hci_send_req(dd, &rq, to) < 0)
+               return -1;
+
+       if (rp.status) {
+               errno = EIO;
+               return -1;
+       }
+
+       return 0;
+}
+
 int hci_le_set_scan_enable(int dd, uint8_t enable, uint8_t filter_dup, int to)
 {
        struct hci_request rq;
diff --git a/lib/hci.h b/lib/hci.h
index 887a860..5fab92d 100644
--- a/lib/hci.h
+++ b/lib/hci.h
@@ -1428,7 +1428,7 @@ typedef struct {
 #define WRITE_REMOTE_AMP_ASSOC_RP_SIZE 2

 /* Testing commands */
-#define OGF_TESTING_CMD                0x3e
+#define OGF_TESTING_CMD                0x06

 #define OCF_READ_LOOPBACK_MODE                 0x0001

diff --git a/lib/hci_lib.h b/lib/hci_lib.h
index 725eb05..9555b5f 100644
--- a/lib/hci_lib.h
+++ b/lib/hci_lib.h
@@ -115,6 +115,8 @@ int hci_read_rssi(int dd, uint16_t handle, int8_t *rssi, int to);
 int hci_read_afh_map(int dd, uint16_t handle, uint8_t *mode, uint8_t *map, int to);
 int hci_read_clock(int dd, uint16_t handle, uint8_t which, uint32_t *clock, uint16_t *accuracy, int to);

+int hci_write_simple_pairing_debug_mode(int dd, uint8_t mode, int to);
+
 int hci_le_set_scan_enable(int dev_id, uint8_t enable, uint8_t filter_dup, int to);
 int hci_le_set_scan_parameters(int dev_id, uint8_t type, uint16_t interval,
                                        uint16_t window, uint8_t own_type,
--
1.7.0.4


________________________________
Subject to local law, communications with Accenture and its affiliates including telephone calls and emails (including content), may be monitored by our systems for the purposes of security and the assessment of internal compliance with Accenture policy.
______________________________________________________________________________________

www.accenture.com


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-28 11:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-28 10:43 [PATCH v2 1/2] lib: Add HCI write SSP debug mode library function james.steele
2012-03-28 11:25 ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).