summaryrefslogtreecommitdiffstats
path: root/tools/hciattach_st.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2007-01-17 12:31:42 +0000
committerMarcel Holtmann <marcel@holtmann.org>2007-01-17 12:31:42 +0000
commitc3da6a497333f7e21007a3f23312e74464a408bf (patch)
tree81a8272d840f104fa496266ba1b832a407c081c6 /tools/hciattach_st.c
parent0b50b92a4bc920e567b74c312a7c1dcbd789c4c9 (diff)
Add support for Philips BGB2xx modules
Diffstat (limited to 'tools/hciattach_st.c')
-rw-r--r--tools/hciattach_st.c38
1 files changed, 31 insertions, 7 deletions
diff --git a/tools/hciattach_st.c b/tools/hciattach_st.c
index 736597cb..47df4fe1 100644
--- a/tools/hciattach_st.c
+++ b/tools/hciattach_st.c
@@ -35,6 +35,8 @@
#include <dirent.h>
#include <sys/param.h>
+#include <bluetooth/bluetooth.h>
+
static int debug = 0;
static int do_command(int fd, uint8_t ogf, uint16_t ocf,
@@ -186,7 +188,7 @@ static int load_file(int dd, uint16_t version, const char *suffix)
return 0;
}
-int stlc2500_init(int dd)
+int stlc2500_init(int dd, bdaddr_t *bdaddr)
{
unsigned char cmd[16];
unsigned char buf[254];
@@ -221,12 +223,34 @@ int stlc2500_init(int dd)
cmd[0] = 0xfe;
cmd[1] = 0x06;
- cmd[2] = 0xba;
- cmd[3] = 0xab;
- cmd[4] = 0x00;
- cmd[5] = 0xe1;
- cmd[6] = 0x80;
- cmd[7] = 0x00;
+ bacpy((bdaddr_t *) (cmd + 2), bdaddr);
+
+ len = do_command(dd, 0xff, 0x0022, cmd, 8, buf, sizeof(buf));
+ if (len < 0)
+ return -1;
+
+ len = do_command(dd, 0x03, 0x0003, NULL, 0, buf, sizeof(buf));
+ if (len < 0)
+ return -1;
+
+ return 0;
+}
+
+int bgb2xx_init(int dd, bdaddr_t *bdaddr)
+{
+ unsigned char cmd[16];
+ unsigned char buf[254];
+ int len;
+
+ len = do_command(dd, 0xff, 0x000f, NULL, 0, buf, sizeof(buf));
+ if (len < 0)
+ return -1;
+
+ printf("%s\n", buf);
+
+ cmd[0] = 0xfe;
+ cmd[1] = 0x06;
+ bacpy((bdaddr_t *) (cmd + 2), bdaddr);
len = do_command(dd, 0xff, 0x0022, cmd, 8, buf, sizeof(buf));
if (len < 0)