OSDN Git Service

android/handsfree: Delay SCO connection after codec negotiation
authorSzymon Janc <szymon.janc@tieto.com>
Tue, 28 Oct 2014 11:27:48 +0000 (12:27 +0100)
committerSzymon Janc <szymon.janc@tieto.com>
Fri, 31 Oct 2014 19:10:58 +0000 (20:10 +0100)
commit87902848315869552facbb1d77c9ce171a784c2c
tree65320bd7fd5640f831c2949d29e04bb0e694c711
parent1e5a31d5c20e4fa1c6509a6376f33ed36c52c6a0
android/handsfree: Delay SCO connection after codec negotiation

If SCO connection is created in same interation as OK response to
AT+BCC it may happen that SCO will connect before OK is send. Some
headset units don't handle this and reject SCO connection.

To fix that we delay SCO connection into next mainloop iteration.

Issue found on UPF49.

> ACL Data RX: Handle 2 flags 0x02 dlen 15                   [hci0] 2572.477715
      Channel: 66 len 11 [PSM 23 mode 0] {chan 2}
        19 ef 0f 41 54 2b 42 43 43 0d 55                 ...AT+BCC.U
< HCI Command: Setup Synchronous Co.. (0x01|0x0028) plen 17  [hci0] 2572.482384
        Handle: 2
        Transmit bandwidth: 8000
        Receive bandwidth: 8000
        Max latency: 13
        Setting: 0x0003
          Input Coding: Linear
          Input Data Format: 1's complement
          Input Sample Size: 8-bit
          # of bits padding at MSB: 0
          Air Coding Format: Transparent Data
        Retransmission effort: Optimize for link quality (0x02)
        Packet type: 0x0380
          3-EV3 may not be used
          2-EV5 may not be used
          3-EV5 may not be used
> HCI Event: Command Status (0x0f) plen 4                    [hci0] 2572.482903
      Setup Synchronous Connection (0x01|0x0028) ncmd 1
        Status: Success (0x00)
< ACL Data TX: Handle 2 flags 0x00 dlen 14                   [hci0] 2572.490198
      Channel: 6978 len 10 [PSM 3 mode 0] {chan 9}
        1b ef 0d 0d 0a 4f 4b 0d 0a 8f                    .....OK...
> HCI Event: Number of Completed Packets (0x13) plen 5       [hci0] 2572.493311
        Num handles: 1
        Handle: 2
        Count: 1
> HCI Event: Synchronous Connect Complete (0x2c) plen 17     [hci0] 2572.494013
        Status: Connection Rejected due to Unacceptable BD_ADDR (0x0f)
        Handle: 4
        Address: 20:68:9D:30:7B:9F (Liteon Technology Corporation)
        Link type: eSCO (0x02)
        Transmission interval: 0x00
        Retransmission window: 0x00
        RX packet length: 0
        TX packet length: 0
        Air mode: CVSD (0x02)
android/handsfree.c