From ebc48fedda3e9220862c53e2d9afe8b50f14c1a3 Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Tue, 9 Oct 2007 16:51:17 +0000 Subject: Change init sequence and add comments --- tools/hciattach_st.c | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) (limited to 'tools') diff --git a/tools/hciattach_st.c b/tools/hciattach_st.c index 47df4fe1..f2be66f5 100644 --- a/tools/hciattach_st.c +++ b/tools/hciattach_st.c @@ -195,40 +195,36 @@ int stlc2500_init(int dd, bdaddr_t *bdaddr) uint16_t version; int len; - len = do_command(dd, 0x04, 0x0001, NULL, 0, buf, sizeof(buf)); + /* Hci_Cmd_Ericsson_Read_Revision_Information */ + len = do_command(dd, 0xff, 0x000f, NULL, 0, buf, sizeof(buf)); if (len < 0) return -1; - version = buf[2] << 8 | buf[1]; - - if (load_file(dd, version, ".ptc") < 0) - return -1; + printf("%s\n", buf); - len = do_command(dd, 0x03, 0x0003, NULL, 0, buf, sizeof(buf)); + /* HCI_Read_Local_Version_Information */ + len = do_command(dd, 0x04, 0x0001, NULL, 0, buf, sizeof(buf)); if (len < 0) return -1; - if (load_file(dd, buf[2] << 8 | buf[1], ".ssf") < 0) - return -1; + version = buf[2] << 8 | buf[1]; - len = do_command(dd, 0x03, 0x0003, NULL, 0, buf, sizeof(buf)); - if (len < 0) + if (load_file(dd, version, ".ptc") < 0) return -1; - len = do_command(dd, 0xff, 0x000f, NULL, 0, buf, sizeof(buf)); - if (len < 0) + if (load_file(dd, buf[2] << 8 | buf[1], ".ssf") < 0) return -1; - printf("%s\n", buf); - cmd[0] = 0xfe; cmd[1] = 0x06; bacpy((bdaddr_t *) (cmd + 2), bdaddr); + /* Hci_Cmd_ST_Store_In_NVDS */ len = do_command(dd, 0xff, 0x0022, cmd, 8, buf, sizeof(buf)); if (len < 0) return -1; + /* HCI_Reset : applies parameters*/ len = do_command(dd, 0x03, 0x0003, NULL, 0, buf, sizeof(buf)); if (len < 0) return -1; -- cgit