summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tools/Makefile.am2
-rw-r--r--tools/bccmd.c42
-rw-r--r--tools/csr.h10
-rw-r--r--tools/csr_bcsp.c60
-rw-r--r--tools/csr_h4.c60
5 files changed, 161 insertions, 13 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 9d7065b2..a038582a 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -52,7 +52,7 @@ ciptool_LDADD = @BLUEZ_LIBS@
ppporc_LDADD = @BLUEZ_LIBS@
if BCCMD
-bccmd_SOURCES = bccmd.c csr.h csr.c csr_hci.c csr_usb.c
+bccmd_SOURCES = bccmd.c csr.h csr.c csr_hci.c csr_usb.c csr_bcsp.c csr_h4.c
bccmd_LDADD = @USB_LIBS@ @BLUEZ_LIBS@
endif
diff --git a/tools/bccmd.c b/tools/bccmd.c
index f39686eb..3bdf702a 100644
--- a/tools/bccmd.c
+++ b/tools/bccmd.c
@@ -66,24 +66,16 @@ static inline int transport_open(int transport, char *device)
return csr_open_hci(device);
case CSR_TRANSPORT_USB:
return csr_open_usb(device);
+ case CSR_TRANSPORT_BCSP:
+ return csr_open_bcsp(device);
+ case CSR_TRANSPORT_H4:
+ return csr_open_h4(device);
default:
fprintf(stderr, "Unsupported transport\n");
return -1;
}
}
-static inline void transport_close(int transport)
-{
- switch (transport) {
- case CSR_TRANSPORT_HCI:
- csr_close_hci();
- break;
- case CSR_TRANSPORT_USB:
- csr_close_usb();
- break;
- }
-}
-
static inline int transport_read(int transport, uint16_t varid, uint8_t *value, uint16_t length)
{
switch (transport) {
@@ -91,6 +83,10 @@ static inline int transport_read(int transport, uint16_t varid, uint8_t *value,
return csr_read_hci(varid, value, length);
case CSR_TRANSPORT_USB:
return csr_read_usb(varid, value, length);
+ case CSR_TRANSPORT_BCSP:
+ return csr_read_bcsp(varid, value, length);
+ case CSR_TRANSPORT_H4:
+ return csr_read_h4(varid, value, length);
default:
errno = EOPNOTSUPP;
return -1;
@@ -104,12 +100,34 @@ static inline int transport_write(int transport, uint16_t varid, uint8_t *value,
return csr_write_hci(varid, value, length);
case CSR_TRANSPORT_USB:
return csr_write_usb(varid, value, length);
+ case CSR_TRANSPORT_BCSP:
+ return csr_write_bcsp(varid, value, length);
+ case CSR_TRANSPORT_H4:
+ return csr_write_h4(varid, value, length);
default:
errno = EOPNOTSUPP;
return -1;
}
}
+static inline void transport_close(int transport)
+{
+ switch (transport) {
+ case CSR_TRANSPORT_HCI:
+ csr_close_hci();
+ break;
+ case CSR_TRANSPORT_USB:
+ csr_close_usb();
+ break;
+ case CSR_TRANSPORT_BCSP:
+ csr_close_bcsp();
+ break;
+ case CSR_TRANSPORT_H4:
+ csr_close_h4();
+ break;
+ }
+}
+
static struct {
uint16_t pskey;
int type;
diff --git a/tools/csr.h b/tools/csr.h
index ec066b81..01e4d803 100644
--- a/tools/csr.h
+++ b/tools/csr.h
@@ -512,6 +512,16 @@ int csr_read_usb(uint16_t varid, uint8_t *value, uint16_t length);
int csr_write_usb(uint16_t varid, uint8_t *value, uint16_t length);
void csr_close_usb(void);
+int csr_open_bcsp(char *device);
+int csr_read_bcsp(uint16_t varid, uint8_t *value, uint16_t length);
+int csr_write_bcsp(uint16_t varid, uint8_t *value, uint16_t length);
+void csr_close_bcsp(void);
+
+int csr_open_h4(char *device);
+int csr_read_h4(uint16_t varid, uint8_t *value, uint16_t length);
+int csr_write_h4(uint16_t varid, uint8_t *value, uint16_t length);
+void csr_close_h4(void);
+
int csr_write_varid_valueless(int dd, uint16_t seqnum, uint16_t varid);
int csr_write_varid_complex(int dd, uint16_t seqnum, uint16_t varid, uint8_t *value, uint16_t length);
int csr_read_varid_complex(int dd, uint16_t seqnum, uint16_t varid, uint8_t *value, uint16_t length);
diff --git a/tools/csr_bcsp.c b/tools/csr_bcsp.c
new file mode 100644
index 00000000..8847fec5
--- /dev/null
+++ b/tools/csr_bcsp.c
@@ -0,0 +1,60 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2004-2005 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdint.h>
+
+static uint16_t seqnum = 0x0000;
+
+int csr_open_bcsp(char *device)
+{
+ fprintf(stderr, "Transport not implemented\n");
+
+ return -1;
+}
+
+static int do_command(uint16_t command, uint16_t seqnum, uint16_t varid, uint8_t *value, uint16_t length)
+{
+ errno = EIO;
+
+ return -1;
+}
+
+int csr_read_bcsp(uint16_t varid, uint8_t *value, uint16_t length)
+{
+ return do_command(0x0000, seqnum++, varid, value, length);
+}
+
+int csr_write_bcsp(uint16_t varid, uint8_t *value, uint16_t length)
+{
+ return do_command(0x0002, seqnum++, varid, value, length);
+}
+
+void csr_close_bcsp(void)
+{
+}
diff --git a/tools/csr_h4.c b/tools/csr_h4.c
new file mode 100644
index 00000000..9140d30d
--- /dev/null
+++ b/tools/csr_h4.c
@@ -0,0 +1,60 @@
+/*
+ *
+ * BlueZ - Bluetooth protocol stack for Linux
+ *
+ * Copyright (C) 2004-2005 Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <errno.h>
+#include <stdint.h>
+
+static uint16_t seqnum = 0x0000;
+
+int csr_open_h4(char *device)
+{
+ fprintf(stderr, "Transport not implemented\n");
+
+ return -1;
+}
+
+static int do_command(uint16_t command, uint16_t seqnum, uint16_t varid, uint8_t *value, uint16_t length)
+{
+ errno = EIO;
+
+ return -1;
+}
+
+int csr_read_h4(uint16_t varid, uint8_t *value, uint16_t length)
+{
+ return do_command(0x0000, seqnum++, varid, value, length);
+}
+
+int csr_write_h4(uint16_t varid, uint8_t *value, uint16_t length)
+{
+ return do_command(0x0002, seqnum++, varid, value, length);
+}
+
+void csr_close_h4(void)
+{
+}