1 From ac7992081abba87627c9e91735b3309584b48585 Mon Sep 17 00:00:00 2001
2 From: Gregory Hermant <gregory.hermant@calao-systems.com>
3 Date: Wed, 14 Nov 2012 14:27:02 +0100
4 Subject: [PATCH] add support for the ST-Ericsson CG2900 GPS FM Bluetooth
8 Signed-off-by: Gregory Hermant <gregory.hermant@calao-systems.com>
10 tools/hciattach.c | 22 +++++++++++++++-------
11 tools/hciattach.h | 1 +
12 2 files changed, 16 insertions(+), 7 deletions(-)
14 diff --git a/tools/hciattach.c b/tools/hciattach.c
15 index e4d5aa1..7f08243 100644
16 --- a/tools/hciattach.c
17 +++ b/tools/hciattach.c
18 @@ -1066,6 +1066,11 @@ struct uart_t uart[] = {
19 { "texasalt", 0x0000, 0x0000, HCI_UART_LL, 115200, 115200,
20 FLOW_CTL, DISABLE_PM, NULL, texasalt, NULL },
22 + /* ST-Ericsson CG2900 GPS FM Bluetooth combo controller */
23 + { "cg2900", 0x0000, 0x0000, HCI_UART_STE, 115200, 115200,
24 + FLOW_CTL, DISABLE_PM, NULL, NULL },
27 /* ST Microelectronics minikits based on STLC2410/STLC2415 */
28 { "st", 0x0000, 0x0000, HCI_UART_H4, 57600, 115200,
29 FLOW_CTL, DISABLE_PM, NULL, st },
30 @@ -1157,10 +1162,10 @@ static struct uart_t * get_by_type(char *type)
33 /* Initialize UART driver */
34 -static int init_uart(char *dev, struct uart_t *u, int send_break, int raw)
35 +static int init_uart(char *dev, struct uart_t *u, int send_break, int raw, int line_disc)
40 unsigned long flags = 0;
43 @@ -1217,8 +1222,7 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw)
46 /* Set TTY to N_HCI line discipline */
48 - if (ioctl(fd, TIOCSETD, &i) < 0) {
49 + if (ioctl(fd, TIOCSETD, &line_disc) < 0) {
50 perror("Can't set line discipline");
53 @@ -1243,7 +1247,7 @@ static void usage(void)
55 printf("hciattach - HCI UART driver initialization utility\n");
57 - printf("\thciattach [-n] [-p] [-b] [-r] [-t timeout] [-s initial_speed] <tty> <type | id> [speed] [flow|noflow] [bdaddr]\n");
58 + printf("\thciattach [-n] [-p] [-a line_disc_nr] [-b] [-r] [-t timeout] [-s initial_speed] <tty> <type | id> [speed] [flow|noflow] [bdaddr]\n");
59 printf("\thciattach -l\n");
62 @@ -1252,6 +1256,7 @@ int main(int argc, char *argv[])
63 struct uart_t *u = NULL;
64 int detach, printpid, raw, opt, i, n, ld, err;
66 + int line_disc = N_HCI;
70 @@ -1264,8 +1269,11 @@ int main(int argc, char *argv[])
74 - while ((opt=getopt(argc, argv, "bnpt:s:lr")) != EOF) {
75 + while ((opt=getopt(argc, argv, "bnpt:s:lra:")) != EOF) {
78 + line_disc = atoi(optarg);
83 @@ -1381,7 +1389,7 @@ int main(int argc, char *argv[])
85 bcsp_max_retries = to;
87 - n = init_uart(dev, u, send_break, raw);
88 + n = init_uart(dev, u, send_break, raw, line_disc);
90 perror("Can't initialize device");
92 diff --git a/tools/hciattach.h b/tools/hciattach.h
93 index fed0d11..09b534d 100644
94 --- a/tools/hciattach.h
95 +++ b/tools/hciattach.h
97 #define HCI_UART_H4DS 3
99 #define HCI_UART_ATH3K 5
100 +#define HCI_UART_STE 6
102 #define HCI_UART_RAW_DEVICE 0