diff options
author | Mathieu J. Poirier <mathieu.poirier@linaro.org> | 2011-12-02 14:22:03 -0700 |
---|---|---|
committer | Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org> | 2012-03-29 10:07:40 +0200 |
commit | da9b4dc1194b4d7eccd60302a5d957c2d30391a8 (patch) | |
tree | c0a2442ba6396047cb53bd09750d5b4a547e7cb9 | |
parent | 7941d48bc8e5b3cf5c19ca590fb31f7767f0b0c4 (diff) | |
download | bluez-da9b4dc1194b4d7eccd60302a5d957c2d30391a8.tar.gz |
snowball: android: Adding cg2900 target and line discipline
This patch modifies 'hciattah' to introduce a new 'cg2900' target
and a cmd line configurable value for the line discipline. This is
required to start the BT driver and the clock required by the wifi
driver.
These modifications can be found here:
git://igloocommunity.org/git/bsp/bluez.git
under tag "packaging-4.91-0ubuntu1snowball1"
Change-Id: Iac60696fb31a01e080aedc6ff15f9920efac1766
Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
-rw-r--r-- | tools/hciattach.c | 21 | ||||
-rw-r--r-- | tools/hciattach.h | 1 |
2 files changed, 15 insertions, 7 deletions
diff --git a/tools/hciattach.c b/tools/hciattach.c index f1d5e28e..88586165 100644 --- a/tools/hciattach.c +++ b/tools/hciattach.c @@ -1070,6 +1070,10 @@ struct uart_t uart[] = { { "texasalt", 0x0000, 0x0000, HCI_UART_LL, 115200, 115200, FLOW_CTL, DISABLE_PM, NULL, texasalt, NULL }, + /* ST-Ericsson CG2900 GPS FM Bluetooth combo controller */ + { "cg2900", 0x0000, 0x0000, HCI_UART_STE, 115200, 115200, + FLOW_CTL, DISABLE_PM, NULL, NULL }, + /* ST Microelectronics minikits based on STLC2410/STLC2415 */ { "st", 0x0000, 0x0000, HCI_UART_H4, 57600, 115200, FLOW_CTL, DISABLE_PM, NULL, st }, @@ -1161,10 +1165,10 @@ static struct uart_t * get_by_type(char *type) } /* Initialize UART driver */ -static int init_uart(char *dev, struct uart_t *u, int send_break, int raw) +static int init_uart(char *dev, struct uart_t *u, int send_break, int raw, int line_disc) { struct termios ti; - int fd, i; + int fd; unsigned long flags = 0; if (raw) @@ -1221,8 +1225,7 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw) } /* Set TTY to N_HCI line discipline */ - i = N_HCI; - if (ioctl(fd, TIOCSETD, &i) < 0) { + if (ioctl(fd, TIOCSETD, &line_disc) < 0) { perror("Can't set line discipline"); return -1; } @@ -1247,7 +1250,7 @@ static void usage(void) { printf("hciattach - HCI UART driver initialization utility\n"); printf("Usage:\n"); - printf("\thciattach [-n] [-p] [-b] [-r] [-t timeout] [-s initial_speed] <tty> <type | id> [speed] [flow|noflow] [bdaddr]\n"); + printf("\thciattach [-n] [-p] [-a line_disc_nr] [-b] [-r] [-t timeout] [-s initial_speed] <tty> <type | id> [speed] [flow|noflow] [bdaddr]\n"); printf("\thciattach -l\n"); } @@ -1256,6 +1259,7 @@ int main(int argc, char *argv[]) struct uart_t *u = NULL; int detach, printpid, raw, opt, i, n, ld, err; int to = 10; + int line_disc = N_HCI; int init_speed = 0; int send_break = 0; pid_t pid; @@ -1268,8 +1272,11 @@ int main(int argc, char *argv[]) printpid = 0; raw = 0; - while ((opt=getopt(argc, argv, "bnpt:s:lr")) != EOF) { + while ((opt=getopt(argc, argv, "bnpt:s:lra")) != EOF) { switch(opt) { + case 'a': + line_disc = atoi(optarg); + break; case 'b': send_break = 1; break; @@ -1385,7 +1392,7 @@ int main(int argc, char *argv[]) alarm(to); bcsp_max_retries = to; - n = init_uart(dev, u, send_break, raw); + n = init_uart(dev, u, send_break, raw, line_disc); if (n < 0) { perror("Can't initialize device"); exit(1); diff --git a/tools/hciattach.h b/tools/hciattach.h index fed0d114..09b534de 100644 --- a/tools/hciattach.h +++ b/tools/hciattach.h @@ -39,6 +39,7 @@ #define HCI_UART_H4DS 3 #define HCI_UART_LL 4 #define HCI_UART_ATH3K 5 +#define HCI_UART_STE 6 #define HCI_UART_RAW_DEVICE 0 |