diff options
-rw-r--r-- | tools/Makefile.am | 1 | ||||
-rw-r--r-- | tools/hciattach.c | 25 | ||||
-rw-r--r-- | tools/hciattach_st.c | 38 |
3 files changed, 55 insertions, 9 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index 3b21f72b..21b2c3a2 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -38,6 +38,7 @@ bin_PROGRAMS = hcitool l2ping sdptool ciptool $(dfutool_programs) noinst_PROGRAMS = hcisecfilter ppporc hciattach_SOURCES = hciattach.c hciattach_st.c +hciattach_LDADD = @BLUEZ_LIBS@ hciconfig_SOURCES = hciconfig.c csr.h csr.c hciconfig_LDADD = @BLUEZ_LIBS@ $(top_builddir)/common/libhelper.a diff --git a/tools/hciattach.c b/tools/hciattach.c index ab8a0f25..45ce4d7b 100644 --- a/tools/hciattach.c +++ b/tools/hciattach.c @@ -825,11 +825,26 @@ static int st(int fd, struct uart_t *u, struct termios *ti) return 0; } -extern int stlc2500_init(int fd); +extern int stlc2500_init(int fd, bdaddr_t *bdaddr); static int stlc2500(int fd, struct uart_t *u, struct termios *ti) { - return stlc2500_init(fd); + bdaddr_t bdaddr; + + str2ba("00:80:E1:00:AB:BA", &bdaddr); + + return stlc2500_init(fd, &bdaddr); +} + +extern int bgb2xx_init(int fd, bdaddr_t *bdaddr); + +static int bgb2xx(int fd, struct uart_t *u, struct termios *ti) +{ + bdaddr_t bdaddr; + + str2ba("BD:B2:10:00:AB:BA", &bdaddr); + + return bgb2xx_init(fd, &bdaddr); } /* @@ -976,6 +991,12 @@ struct uart_t uart[] = { /* ST Microelectronics minikits based on STLC2500 */ { "stlc2500", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, stlc2500 }, + /* Philips generic Ericsson IP core based */ + { "philips", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, NULL }, + + /* Philips BGB2xx Module */ + { "bgb2xx", 0x0000, 0x0000, HCI_UART_H4, 115200, 115200, FLOW_CTL, bgb2xx }, + /* Sphinx Electronics PICO Card */ { "picocard", 0x025e, 0x1000, HCI_UART_H4, 115200, 115200, FLOW_CTL, NULL }, 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) |