OSDN Git Service

Add RTL8723BS Bluetooth tool
[android-x86/external-bluetooth-bluez.git] / tools / hciattach.c
index fad176c..21a5a05 100644 (file)
@@ -146,6 +146,7 @@ int read_hci_event(int fd, unsigned char* buf, int size)
        return count;
 }
 
+#if 0
 /*
  * Ericsson specific initialization
  */
@@ -989,11 +990,28 @@ static int bcm2035(int fd, struct uart_t *u, struct termios *ti)
 
        return 0;
 }
+#endif
+
+int rtk_init(int fd, int proto, int speed, struct termios *ti);
+int rtk_post(int fd, int proto, struct termios *ti);
+
+static int realtek_init(int fd, struct uart_t *u, struct termios *ti)
+{
+       fprintf(stderr, "Realtek Bluetooth init uart with init speed:%d, final_speed:%d, type:HCI UART %s\n", u->init_speed, u->speed, (u->proto == HCI_UART_H4)? "H4":"H5" );
+       return rtk_init(fd, u->proto, u->speed, ti);
+}
+
+static int realtek_post(int fd, struct uart_t *u, struct termios *ti)
+{
+       fprintf(stderr, "Realtek Bluetooth post process\n");
+       return rtk_post(fd, u->proto, ti);
+}
 
 struct uart_t uart[] = {
        { "any",        0x0000, 0x0000, HCI_UART_H4,   115200, 115200,
                                FLOW_CTL, DISABLE_PM, NULL, NULL     },
 
+#if 0
        { "ericsson",   0x0000, 0x0000, HCI_UART_H4,   57600,  115200,
                                FLOW_CTL, DISABLE_PM, NULL, ericsson },
 
@@ -1109,6 +1127,18 @@ struct uart_t uart[] = {
        { "amp",        0x0000, 0x0000, HCI_UART_H4, 115200, 115200,
                        AMP_DEV, DISABLE_PM, NULL, NULL, NULL },
 
+#endif
+
+       /* Realtek Bluetooth H4*/
+       /* H4 will set 115200 baudrate and flow control enable by default*/
+       { "rtk_h4",     0x0000, 0x0000, HCI_UART_H4, 115200, 115200,
+                       0, DISABLE_PM, NULL, realtek_init, realtek_post },
+
+       /* Realtek Bluetooth H5*/
+       /* H5 will set 115200 baudrate and flow control disable by default */
+       { "rtk_h5",     0x0000, 0x0000, HCI_UART_3WIRE, 115200, 115200,
+                       0, DISABLE_PM, NULL, realtek_init, realtek_post },
+
        { NULL, 0 }
 };
 
@@ -1370,7 +1400,9 @@ int main(int argc, char *argv[])
 
        /* 10 seconds should be enough for initialization */
        alarm(to);
+#if 0
        bcsp_max_retries = to;
+#endif
 
        n = init_uart(dev, u, send_break, raw);
        if (n < 0) {