summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/Makefile.am4
-rw-r--r--test/lmptest.c (renamed from test/sttest.c)44
2 files changed, 41 insertions, 7 deletions
diff --git a/test/Makefile.am b/test/Makefile.am
index 93ad39b9..18989ba5 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -12,7 +12,7 @@ sbin_PROGRAMS = hciemu
bin_PROGRAMS = l2test rctest
-noinst_PROGRAMS = sdptest scotest attest hstest bdaddr sttest
+noinst_PROGRAMS = sdptest scotest attest hstest bdaddr lmptest
hciemu_LDADD = $(glib_ldadd) @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a
@@ -32,7 +32,7 @@ bdaddr_SOURCES = bdaddr.c
bdaddr_LDADD = @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a
-sttest_LDADD = @BLUEZ_LIBS@
+lmptest_LDADD = @BLUEZ_LIBS@
noinst_MANS = bdaddr.8
diff --git a/test/sttest.c b/test/lmptest.c
index 8f714489..39a906a2 100644
--- a/test/sttest.c
+++ b/test/lmptest.c
@@ -36,6 +36,40 @@
#include <bluetooth/hci.h>
#include <bluetooth/hci_lib.h>
+#if 0
+#define OCF_ERICSSON_SEND_LMP 0x0021
+typedef struct {
+ uint16_t handle;
+ uint8_t length;
+ uint8_t data[17];
+} __attribute__ ((packed)) ericsson_send_lmp_cp;
+#define ERICSSON_SEND_LMP_CP_SIZE 20
+
+static int ericsson_send_lmp(int dd, uint16_t handle, uint8_t length, uint8_t *data)
+{
+ struct hci_request rq;
+ ericsson_send_lmp_cp cp;
+
+ memset(&cp, 0, sizeof(cp));
+ cp.handle = htobs(handle);
+ cp.length = length;
+ memcpy(cp.data, data, length);
+
+ memset(&rq, 0, sizeof(rq));
+ rq.ogf = OGF_VENDOR_CMD;
+ rq.ocf = OCF_ERICSSON_SEND_LMP;
+ rq.cparam = &cp;
+ rq.clen = ERICSSON_SEND_LMP_CP_SIZE;
+ rq.rparam = NULL;
+ rq.rlen = 0;
+
+ if (hci_send_req(dd, &rq, 1000) < 0)
+ return -1;
+
+ return 0;
+}
+#endif
+
#define OCF_ERICSSON_WRITE_EVENTS 0x0043
typedef struct {
uint8_t mask;
@@ -44,13 +78,13 @@ typedef struct {
} __attribute__ ((packed)) ericsson_write_events_cp;
#define ERICSSON_WRITE_EVENTS_CP_SIZE 3
-static int ericsson_write_events(int dd)
+static int ericsson_write_events(int dd, uint8_t mask)
{
struct hci_request rq;
ericsson_write_events_cp cp;
memset(&cp, 0, sizeof(cp));
- cp.mask = 0x03;
+ cp.mask = mask;
cp.opcode = 0x00;
cp.opcode_ext = 0x00;
@@ -70,9 +104,9 @@ static int ericsson_write_events(int dd)
static void usage(void)
{
- printf("sttest - Utility for ST Microelectronics chips\n\n");
+ printf("lmptest - Utility for testing special LMP functions\n\n");
printf("Usage:\n"
- "\tsttest [-i <dev>]\n");
+ "\tlmptest [-i <dev>]\n");
}
static struct option main_options[] = {
@@ -128,7 +162,7 @@ int main(int argc, char *argv[])
exit(1);
}
- if (ericsson_write_events(dd) < 0) {
+ if (ericsson_write_events(dd, 0x03) < 0) {
fprintf(stderr, "Can't activate events for hci%d: %s (%d)\n",
dev, strerror(errno), errno);
hci_close_dev(dd);