OSDN Git Service

resolve merge conflicts of 405ec18 to nyc-dev
authorSharvil Nanavati <sharvil@google.com>
Thu, 28 Apr 2016 21:54:35 +0000 (14:54 -0700)
committerSharvil Nanavati <sharvil@google.com>
Fri, 29 Apr 2016 02:03:23 +0000 (19:03 -0700)
Change-Id: I94b431287ae831d64dc734f8cd3f071e49a9d6eb

1  2 
device/include/interop.h
device/include/interop_database.h
device/src/interop.c
stack/avdt/avdt_l2c.c

@@@ -44,17 -39,14 +44,26 @@@ typedef enum 
    // or general lack of controlability.
    INTEROP_DISABLE_ABSOLUTE_VOLUME,
  
-   INTEROP_KEYBOARD_REQUIRES_FIXED_PIN
 +  // Disable automatic pairing with headsets/car-kits
 +  // Some car kits do not react kindly to a failed pairing attempt and
 +  // do not allow immediate re-pairing. Blacklist these so that the initial
 +  // pairing attempt makes it to the user instead.
 +  INTEROP_DISABLE_AUTO_PAIRING,
 +
 +  // Use a fixed pin for specific keyboards
 +  // Keyboards should use a variable pin at all times. However, some keyboards
 +  // require a fixed pin of all 0000. This workaround enables auto pairing for
 +  // those keyboards.
++  INTEROP_KEYBOARD_REQUIRES_FIXED_PIN,
++
+   // Some headsets have audio jitter issues because of increased re-transmissions as the
+   // 3 Mbps packets have a lower link margin, and are more prone to interference. We can
+   // disable 3DH packets (use only 2DH packets) for the ACL link to improve sensitivity
+   // when streaming A2DP audio to the headset. Air sniffer logs show reduced
+   // re-transmissions after switching to 2DH packets.
+   //
+   // Disable 3Mbps packets and use only 2Mbps packets for ACL links when streaming audio.
+   INTEROP_2MBPS_LINK_ONLY
  } interop_feature_t;
  
  // Check if a given |addr| matches a known interoperability workaround as identified
  
  typedef struct {
    bt_bdaddr_t addr;
 -  uint8_t len;
 +  size_t length;
    interop_feature_t feature;
 -} interop_entry_t;
 +} interop_addr_entry_t;
  
 -static const interop_entry_t interop_database[] = {
 +static const interop_addr_entry_t interop_addr_database[] = {
    // Nexus Remote (Spike)
    // Note: May affect other Asus brand devices
 -  {{0x08, 0x62, 0x66,       0,0,0}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 -  {{0x38, 0x2c, 0x4a, 0xc9,   0,0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 -  {{0x38, 0x2c, 0x4a, 0xe6,   0,0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 -  {{0x54, 0xa0, 0x50, 0xd9,   0,0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 -  {{0xac, 0x9e, 0x17,       0,0,0}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 -  {{0xf0, 0x79, 0x59,       0,0,0}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 +  {{{0x08, 0x62, 0x66,      0,0,0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 +  {{{0x38, 0x2c, 0x4a, 0xc9,  0,0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 +  {{{0x38, 0x2c, 0x4a, 0xe6,  0,0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 +  {{{0x54, 0xa0, 0x50, 0xd9,  0,0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 +  {{{0xac, 0x9e, 0x17,      0,0,0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 +  {{{0xf0, 0x79, 0x59,      0,0,0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
  
    // Motorola Key Link
 -  {{0x1c, 0x96, 0x5a,       0,0,0}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 +  {{{0x1c, 0x96, 0x5a,      0,0,0}}, 3, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
  
    // Flic smart button
 -  {{0x80, 0xe4, 0xda, 0x70,   0,0}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
 +  {{{0x80, 0xe4, 0xda, 0x70,  0,0}}, 4, INTEROP_DISABLE_LE_SECURE_CONNECTIONS},
  
    // BMW car kits (Harman/Becker)
 -  {{0x9c, 0xdf, 0x03,       0,0,0}, 3, INTEROP_AUTO_RETRY_PAIRING},
 +  {{{0x9c, 0xdf, 0x03,      0,0,0}}, 3, INTEROP_AUTO_RETRY_PAIRING},
 +
 +  // Ausdom M05 - unacceptably loud volume
 +  {{{0xa0, 0xe9, 0xdb,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 +
 +  // iKross IKBT83B HS - unacceptably loud volume
 +  {{{0x00, 0x14, 0x02,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 +
 +  // Jabra EXTREAM2 - unacceptably loud volume
 +  {{{0x1c, 0x48, 0xf9,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
  
    // JayBird BlueBuds X - low granularity on volume control
 -  {{0x44, 0x5e, 0xf3,       0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 +  {{{0x44, 0x5e, 0xf3,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 +  {{{0xd4, 0x9c, 0x28,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
  
    // LG Tone HBS-730 - unacceptably loud volume
 -  {{0x00, 0x18, 0x6b,       0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 -  {{0xb8, 0xad, 0x3e,       0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 +  {{{0x00, 0x18, 0x6b,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 +  {{{0xb8, 0xad, 0x3e,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
  
    // LG Tone HV-800 - unacceptably loud volume
 -  {{0xa0, 0xe9, 0xdb,       0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 +  {{{0xa0, 0xe9, 0xdb,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 +
 +  // Mpow Cheetah - unacceptably loud volume
 +  {{{0x00, 0x11, 0xb1,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
  
    // SOL REPUBLIC Tracks Air - unable to adjust volume back off from max
 -  {{0xa4, 0x15, 0x66,       0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 +  {{{0xa4, 0x15, 0x66,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 +
 +  // Swage Rokitboost HS - unacceptably loud volume
 +  {{{0x00, 0x14, 0xf1,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
  
    // VW Car Kit - not enough granularity with volume
 -  {{0x00, 0x26, 0x7e,       0,0,0}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 +  {{{0x00, 0x26, 0x7e,      0,0,0}}, 3, INTEROP_DISABLE_ABSOLUTE_VOLUME},
 +
 +  // Subaru car kits (ALPS) - auto-pairing fails and rejects next pairing
 +  {{{0xe0, 0x75, 0x0a,      0,0,0}}, 3, INTEROP_DISABLE_AUTO_PAIRING},
 +
 +  // Unknown keyboard (carried over from auto_pair_devlist.conf)
-   {{{0x00, 0x0F, 0xF6,      0,0,0}}, 3, INTEROP_KEYBOARD_REQUIRES_FIXED_PIN}
++  {{{0x00, 0x0F, 0xF6,      0,0,0}}, 3, INTEROP_KEYBOARD_REQUIRES_FIXED_PIN},
+   // Jaybird Family
 -  {{0x00, 0x18, 0x91,       0,0,0}, 3, INTEROP_2MBPS_LINK_ONLY}
++  {{{0x00, 0x18, 0x91,       0,0,0}}, 3, INTEROP_2MBPS_LINK_ONLY},
  };
 +
 +typedef struct {
 +  char name[20];
 +  size_t length;
 +  interop_feature_t feature;
 +} interop_name_entry_t;
 +
 +static const interop_name_entry_t interop_name_database[] = {
 +  // Carried over from auto_pair_devlist.conf migration
 +  {"BMW",     3, INTEROP_DISABLE_AUTO_PAIRING},
 +  {"Audi",    4, INTEROP_DISABLE_AUTO_PAIRING},
 +  {"Parrot",  6, INTEROP_DISABLE_AUTO_PAIRING},
 +  {"Car",     3, INTEROP_DISABLE_AUTO_PAIRING}
 +};
 +
@@@ -112,8 -32,6 +112,9 @@@ static const char* interop_feature_stri
      CASE_RETURN_STR(INTEROP_DISABLE_LE_SECURE_CONNECTIONS)
      CASE_RETURN_STR(INTEROP_AUTO_RETRY_PAIRING)
      CASE_RETURN_STR(INTEROP_DISABLE_ABSOLUTE_VOLUME)
 +    CASE_RETURN_STR(INTEROP_DISABLE_AUTO_PAIRING)
 +    CASE_RETURN_STR(INTEROP_KEYBOARD_REQUIRES_FIXED_PIN)
++    CASE_RETURN_STR(INTEROP_2MBPS_LINK_ONLY)
    }
  
    return "UNKNOWN";
@@@ -202,6 -203,15 +203,15 @@@ void avdt_l2c_connect_ind_cback(BD_ADD
              p_tbl->state = AVDT_AD_ST_SEC_ACP;
              p_tbl->cfg_flags = AVDT_L2C_CFG_CONN_ACP;
  
 -            if (interop_match(INTEROP_2MBPS_LINK_ONLY, (const bt_bdaddr_t *)&bd_addr)) {
++            if (interop_match_addr(INTEROP_2MBPS_LINK_ONLY, (const bt_bdaddr_t *)&bd_addr)) {
+                 // Disable 3DH packets for AVDT ACL to improve sensitivity on HS
+                 tACL_CONN *p_acl_cb = btm_bda_to_acl(bd_addr, BT_TRANSPORT_BR_EDR);
+                 btm_set_packet_types(p_acl_cb, (btm_cb.btm_acl_pkt_types_supported |
+                                                 HCI_PKT_TYPES_MASK_NO_3_DH1 |
+                                                 HCI_PKT_TYPES_MASK_NO_3_DH3 |
+                                                 HCI_PKT_TYPES_MASK_NO_3_DH5));
+             }
              /* Check the security */
              rc = btm_sec_mx_access_request (bd_addr, AVDT_PSM,
                  FALSE, BTM_SEC_PROTO_AVDT,
@@@ -321,6 -331,15 +331,15 @@@ void avdt_l2c_connect_cfm_cback(UINT16 
                          p_tbl->lcid = lcid;
                          p_tbl->cfg_flags = AVDT_L2C_CFG_CONN_INT;
  
 -                        if (interop_match(INTEROP_2MBPS_LINK_ONLY, (const bt_bdaddr_t *) &p_ccb->peer_addr)) {
++                        if (interop_match_addr(INTEROP_2MBPS_LINK_ONLY, (const bt_bdaddr_t *) &p_ccb->peer_addr)) {
+                             // Disable 3DH packets for AVDT ACL to improve sensitivity on HS
+                             tACL_CONN *p_acl_cb = btm_bda_to_acl(p_ccb->peer_addr, BT_TRANSPORT_BR_EDR);
+                             btm_set_packet_types(p_acl_cb, (btm_cb.btm_acl_pkt_types_supported |
+                                                             HCI_PKT_TYPES_MASK_NO_3_DH1 |
+                                                             HCI_PKT_TYPES_MASK_NO_3_DH3 |
+                                                             HCI_PKT_TYPES_MASK_NO_3_DH5));
+                         }
                          /* Check the security */
                          btm_sec_mx_access_request (p_ccb->peer_addr, AVDT_PSM,
                              TRUE, BTM_SEC_PROTO_AVDT,