summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-12-07 09:04:58 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-12-07 09:04:58 +0000
commit27454e3869df7f30ba170fefc17018fa07b5d194 (patch)
tree79e680513435069afac0b7ecfd6de963d81e0306
parent57580b1b9cd64d823f3843c556cabd9856b8f86f (diff)
Update the Silicon Wave init routine
-rw-r--r--tools/hciattach.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/tools/hciattach.c b/tools/hciattach.c
index bcdad95b..d0e03cce 100644
--- a/tools/hciattach.c
+++ b/tools/hciattach.c
@@ -648,7 +648,7 @@ static int csr(int fd, struct uart_t *u, struct termios *ti)
*/
static int swave(int fd, struct uart_t *u, struct termios *ti)
{
- struct timespec tm = {0, 500000};
+ struct timespec tm = { 0, 500000 };
char cmd[10], rsp[100];
int r;
@@ -688,7 +688,7 @@ static int swave(int fd, struct uart_t *u, struct termios *ti)
}
/* Send initialization command */
- if (write(fd, cmd, 9) != 9) {
+ if (write(fd, cmd, 10) != 10) {
perror("Failed to write init command");
return -1;
}
@@ -720,15 +720,16 @@ static int swave(int fd, struct uart_t *u, struct termios *ti)
return -1;
}
- // we probably got the reply. Now we must send the "soft reset":
+ // we probably got the reply. Now we must send the "soft reset"
+ // which is standard HCI RESET.
+
cmd[0] = HCI_COMMAND_PKT; // it's a command packet
- cmd[1] = 0x0B; // OCF 0x0B = param access set
- cmd[2] = 0xfc; // OGF bx111111 = vendor specific
- cmd[3] = 0x01; // 1 byte of data following
- cmd[4] = 0x03; // HCI Reset Subcommand
-
- // Send initialization command
- if (write(fd, cmd, 5) != 5) {
+ cmd[1] = 0x03;
+ cmd[2] = 0x0c;
+ cmd[3] = 0x00;
+
+ /* Send reset command */
+ if (write(fd, cmd, 4) != 4) {
perror("Can't write Silicon Wave reset cmd.");
return -1;
}