The cirros image was rebuilt against the 3.13.0-83 kernel, drivers e1000e, igbvf...
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / bluez_utils / 0001-enable_cg2900_on_upstream_4.91.patch
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
5  combo controller
6
7
8 Signed-off-by: Gregory Hermant <gregory.hermant@calao-systems.com>
9 ---
10  tools/hciattach.c |   22 +++++++++++++++-------
11  tools/hciattach.h |    1 +
12  2 files changed, 16 insertions(+), 7 deletions(-)
13
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   },
21  
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     },
25 +
26 +
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)
31  }
32  
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)
36  {
37         struct termios ti;
38 -       int fd, i;
39 +       int fd;
40         unsigned long flags = 0;
41  
42         if (raw)
43 @@ -1217,8 +1222,7 @@ static int init_uart(char *dev, struct uart_t *u, int send_break, int raw)
44         }
45  
46         /* Set TTY to N_HCI line discipline */
47 -       i = N_HCI;
48 -       if (ioctl(fd, TIOCSETD, &i) < 0) {
49 +       if (ioctl(fd, TIOCSETD, &line_disc) < 0) {
50                 perror("Can't set line discipline");
51                 return -1;
52         }
53 @@ -1243,7 +1247,7 @@ static void usage(void)
54  {
55         printf("hciattach - HCI UART driver initialization utility\n");
56         printf("Usage:\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");
60  }
61  
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;
65         int to = 10;
66 +       int line_disc = N_HCI;
67         int init_speed = 0;
68         int send_break = 0;
69         pid_t pid;
70 @@ -1264,8 +1269,11 @@ int main(int argc, char *argv[])
71         printpid = 0;
72         raw = 0;
73  
74 -       while ((opt=getopt(argc, argv, "bnpt:s:lr")) != EOF) {
75 +       while ((opt=getopt(argc, argv, "bnpt:s:lra:")) != EOF) {
76                 switch(opt) {
77 +               case 'a':
78 +                        line_disc = atoi(optarg);
79 +                        break;
80                 case 'b':
81                         send_break = 1;
82                         break;
83 @@ -1381,7 +1389,7 @@ int main(int argc, char *argv[])
84         alarm(to);
85         bcsp_max_retries = to;
86  
87 -       n = init_uart(dev, u, send_break, raw);
88 +       n = init_uart(dev, u, send_break, raw, line_disc);
89         if (n < 0) {
90                 perror("Can't initialize device");
91                 exit(1);
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
96 @@ -39,6 +39,7 @@
97  #define HCI_UART_H4DS  3
98  #define HCI_UART_LL    4
99  #define HCI_UART_ATH3K  5
100 +#define HCI_UART_STE   6
101  
102  #define HCI_UART_RAW_DEVICE    0
103  
104 -- 
105 1.7.9.5
106