Loading system/bta/dm/bta_dm_int.h +9 −10 Original line number Diff line number Diff line Loading @@ -161,16 +161,15 @@ typedef union { #define BTA_DM_UNPAIRING 2 typedef uint8_t tBTA_DM_CONN_STATE; #define BTA_DM_DI_NONE 0x00 /* nothing special */ #define BTA_DM_DI_USE_SSR \ 0x10 /* set this bit if ssr is supported for this link */ #define BTA_DM_DI_AV_ACTIVE \ 0x20 /* set this bit if AV is active for this link */ #define BTA_DM_DI_SET_SNIFF \ 0x01 /* set this bit if call BTM_SetPowerMode(sniff) */ #define BTA_DM_DI_INT_SNIFF \ 0x02 /* set this bit if call BTM_SetPowerMode(sniff) & enter sniff mode */ #define BTA_DM_DI_ACP_SNIFF 0x04 /* set this bit if peer init sniff */ typedef enum : uint8_t { BTA_DM_DI_NONE = 0x00, /* nothing special */ BTA_DM_DI_SET_SNIFF = 0x01, /* set this bit if call BTM_SetPowerMode(sniff) */ BTA_DM_DI_INT_SNIFF = 0x02, /* set this bit if call BTM_SetPowerMode(sniff) & enter sniff mode */ BTA_DM_DI_ACP_SNIFF = 0x04, /* set this bit if peer init sniff */ BTA_DM_DI_USE_SSR = 0x10, /* set this bit if ssr is supported for this link */ BTA_DM_DI_AV_ACTIVE = 0x20, /* set this bit if AV is active for this link */ } tBTA_DM_DEV_INFO_BITMASK; typedef uint8_t tBTA_DM_DEV_INFO; /* set power mode request type */ Loading system/bta/dm/bta_dm_pm.cc +35 −13 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ #include "bta_sys.h" #include "btm_api.h" #include "device/include/controller.h" #include "main/shim/dumpsys.h" #include "osi/include/log.h" #include "stack/include/acl_api.h" #include "stack/include/btu.h" Loading Loading @@ -667,11 +668,18 @@ static bool bta_dm_pm_park(const RawAddress& peer_addr) { tBTM_PM_MODE mode = BTM_PM_STS_ACTIVE; /* if not in park mode, switch to park */ BTM_ReadPowerMode(peer_addr, &mode); if (!BTM_ReadPowerMode(peer_addr, &mode)) { LOG_WARN("Unable to read power mode for peer:%s", PRIVATE_ADDRESS(peer_addr)); } if (mode != BTM_PM_MD_PARK) { BTM_SetPowerMode(bta_dm_cb.pm_id, peer_addr, tBTM_STATUS status = BTM_SetPowerMode(bta_dm_cb.pm_id, peer_addr, &p_bta_dm_pm_md[BTA_DM_PM_PARK_IDX]); if (status == BTM_CMD_STORED || status == BTM_CMD_STARTED) { return true; } LOG_WARN("Unable to set park power mode"); } return true; } Loading @@ -691,7 +699,11 @@ static void bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE* p_peer_dev, uint8_t index) { tBTM_PM_PWR_MD pwr_md; tBTM_STATUS status; BTM_ReadPowerMode(p_peer_dev->peer_bdaddr, &mode); if (!BTM_ReadPowerMode(p_peer_dev->peer_bdaddr, &mode)) { LOG_WARN("Unable to read power mode for peer:%s", PRIVATE_ADDRESS(p_peer_dev->peer_bdaddr)); } uint8_t* p_rem_feat = BTM_ReadRemoteFeatures(p_peer_dev->peer_bdaddr); APPL_TRACE_DEBUG("bta_dm_pm_sniff cur:%d, idx:%d, info:x%x", mode, index, p_peer_dev->info); Loading Loading @@ -758,8 +770,9 @@ static void bta_dm_pm_ssr(const RawAddress& peer_addr, int ssr) { current_ssr_index = p_bta_dm_pm_spec[config.spec_idx].ssr; if ((config.id == service.id) && ((config.app_id == BTA_ALL_APP_ID) || (config.app_id == service.app_id))) { APPL_TRACE_WARNING("%s: conn_srvc id:%d, app_id:%d", __func__, service.id, service.app_id); LOG_INFO("Found connected service:%s app_id:%d peer:%s", BtaIdSysText(service.id).c_str(), service.app_id, PRIVATE_ADDRESS(peer_addr)); break; } } Loading @@ -782,21 +795,28 @@ static void bta_dm_pm_ssr(const RawAddress& peer_addr, int ssr) { } } APPL_TRACE_WARNING("%s ssr:%d, lat:%d", __func__, ssr_index, p_spec->max_lat); if (p_spec->max_lat) { LOG_DEBUG( "Max latency is non zero max_lat:0x%04x min_loc_to:0x%04x " "min_rmt_to:0x%04x", p_spec->max_lat, p_spec->min_loc_to, p_spec->min_rmt_to); /* Avoid SSR reset on device which has SCO connected */ if (bta_dm_pm_is_sco_active()) { int idx = bta_dm_get_sco_index(); if (idx != -1) { if (bta_dm_conn_srvcs.conn_srvc[idx].peer_bdaddr == peer_addr) { APPL_TRACE_WARNING("%s SCO is active on device, ignore SSR", __func__); LOG_WARN("SCO is active on device, ignore SSR"); return; } } } LOG_DEBUG( "Setting sniff subrating for device:%s max_lat:0x%04x " "min_loc_to:0x%04x min_rmt_to:0x%04x", PRIVATE_ADDRESS(peer_addr), p_spec->max_lat, p_spec->min_loc_to, p_spec->min_rmt_to); /* set the SSR parameters. */ BTM_SetSsrParams(peer_addr, p_spec->max_lat, p_spec->min_rmt_to, p_spec->min_loc_to); Loading @@ -819,7 +839,11 @@ void bta_dm_pm_active(const RawAddress& peer_addr) { /* switch to active mode */ pm.mode = BTM_PM_MD_ACTIVE; BTM_SetPowerMode(bta_dm_cb.pm_id, peer_addr, &pm); tBTM_STATUS status = BTM_SetPowerMode(bta_dm_cb.pm_id, peer_addr, &pm); if (status != BTM_CMD_STORED && status != BTM_CMD_STARTED) { LOG_WARN("Unable to set active mode for device:%s", PRIVATE_ADDRESS(peer_addr)); } } /** BTM power manager callback */ Loading Loading @@ -1000,8 +1024,6 @@ static bool bta_dm_pm_is_sco_active() { break; } } APPL_TRACE_DEBUG("bta_dm_is_sco_active: SCO active: %d", bScoActive); return bScoActive; } Loading system/bta/sys/bta_sys_conn.cc +5 −2 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ #include "bta/include/utl.h" #include "bta/sys/bta_sys.h" #include "bta/sys/bta_sys_int.h" #include "main/shim/dumpsys.h" #include "osi/include/log.h" #include "osi/include/osi.h" /******************************************************************************* Loading Loading @@ -85,8 +87,9 @@ void bta_sys_ssr_cfg_register(tBTA_SYS_SSR_CFG_CBACK* p_cback) { ******************************************************************************/ void bta_sys_notify_role_chg(const RawAddress& peer_addr, uint8_t new_role, uint8_t hci_status) { APPL_TRACE_DEBUG("%s: peer %s new_role:%d hci_status:0x%x", __func__, peer_addr.ToString().c_str(), new_role, hci_status); LOG_DEBUG("Role changed peer:%s new_role:%s hci_status:%s", PRIVATE_ADDRESS(peer_addr), RoleText(new_role).c_str(), hci_error_code_text(hci_status).c_str()); if (bta_sys_cb.p_role_cb) { bta_sys_cb.p_role_cb(BTA_SYS_ROLE_CHANGE, new_role, hci_status, peer_addr); } Loading system/main/shim/acl.cc +3 −1 Original line number Diff line number Diff line Loading @@ -238,7 +238,9 @@ class ClassicShimAclConnection } void OnModeChange(hci::Mode current_mode, uint16_t interval) override { LOG_INFO("UNIMPLEMENTED"); TRY_POSTING_ON_MAIN(interface_.on_mode_change, ToLegacyHciErrorCode(hci::ErrorCode::SUCCESS), handle_, ToLegacyHciMode(current_mode), interval); } void OnQosSetupComplete(hci::ServiceType service_type, uint32_t token_rate, Loading system/main/shim/acl_legacy_interface.cc +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ const acl_interface_t GetAclInterface() { .link.classic.on_flow_specification_complete = nullptr, .link.classic.on_flush_occurred = nullptr, .link.classic.on_central_link_key_complete = nullptr, .link.classic.on_mode_change = nullptr, .link.classic.on_mode_change = btm_pm_on_mode_change, .link.classic.on_packet_type_changed = nullptr, .link.classic.on_qos_setup_complete = nullptr, .link.classic.on_read_afh_channel_map_complete = nullptr, Loading Loading
system/bta/dm/bta_dm_int.h +9 −10 Original line number Diff line number Diff line Loading @@ -161,16 +161,15 @@ typedef union { #define BTA_DM_UNPAIRING 2 typedef uint8_t tBTA_DM_CONN_STATE; #define BTA_DM_DI_NONE 0x00 /* nothing special */ #define BTA_DM_DI_USE_SSR \ 0x10 /* set this bit if ssr is supported for this link */ #define BTA_DM_DI_AV_ACTIVE \ 0x20 /* set this bit if AV is active for this link */ #define BTA_DM_DI_SET_SNIFF \ 0x01 /* set this bit if call BTM_SetPowerMode(sniff) */ #define BTA_DM_DI_INT_SNIFF \ 0x02 /* set this bit if call BTM_SetPowerMode(sniff) & enter sniff mode */ #define BTA_DM_DI_ACP_SNIFF 0x04 /* set this bit if peer init sniff */ typedef enum : uint8_t { BTA_DM_DI_NONE = 0x00, /* nothing special */ BTA_DM_DI_SET_SNIFF = 0x01, /* set this bit if call BTM_SetPowerMode(sniff) */ BTA_DM_DI_INT_SNIFF = 0x02, /* set this bit if call BTM_SetPowerMode(sniff) & enter sniff mode */ BTA_DM_DI_ACP_SNIFF = 0x04, /* set this bit if peer init sniff */ BTA_DM_DI_USE_SSR = 0x10, /* set this bit if ssr is supported for this link */ BTA_DM_DI_AV_ACTIVE = 0x20, /* set this bit if AV is active for this link */ } tBTA_DM_DEV_INFO_BITMASK; typedef uint8_t tBTA_DM_DEV_INFO; /* set power mode request type */ Loading
system/bta/dm/bta_dm_pm.cc +35 −13 Original line number Diff line number Diff line Loading @@ -36,6 +36,7 @@ #include "bta_sys.h" #include "btm_api.h" #include "device/include/controller.h" #include "main/shim/dumpsys.h" #include "osi/include/log.h" #include "stack/include/acl_api.h" #include "stack/include/btu.h" Loading Loading @@ -667,11 +668,18 @@ static bool bta_dm_pm_park(const RawAddress& peer_addr) { tBTM_PM_MODE mode = BTM_PM_STS_ACTIVE; /* if not in park mode, switch to park */ BTM_ReadPowerMode(peer_addr, &mode); if (!BTM_ReadPowerMode(peer_addr, &mode)) { LOG_WARN("Unable to read power mode for peer:%s", PRIVATE_ADDRESS(peer_addr)); } if (mode != BTM_PM_MD_PARK) { BTM_SetPowerMode(bta_dm_cb.pm_id, peer_addr, tBTM_STATUS status = BTM_SetPowerMode(bta_dm_cb.pm_id, peer_addr, &p_bta_dm_pm_md[BTA_DM_PM_PARK_IDX]); if (status == BTM_CMD_STORED || status == BTM_CMD_STARTED) { return true; } LOG_WARN("Unable to set park power mode"); } return true; } Loading @@ -691,7 +699,11 @@ static void bta_dm_pm_sniff(tBTA_DM_PEER_DEVICE* p_peer_dev, uint8_t index) { tBTM_PM_PWR_MD pwr_md; tBTM_STATUS status; BTM_ReadPowerMode(p_peer_dev->peer_bdaddr, &mode); if (!BTM_ReadPowerMode(p_peer_dev->peer_bdaddr, &mode)) { LOG_WARN("Unable to read power mode for peer:%s", PRIVATE_ADDRESS(p_peer_dev->peer_bdaddr)); } uint8_t* p_rem_feat = BTM_ReadRemoteFeatures(p_peer_dev->peer_bdaddr); APPL_TRACE_DEBUG("bta_dm_pm_sniff cur:%d, idx:%d, info:x%x", mode, index, p_peer_dev->info); Loading Loading @@ -758,8 +770,9 @@ static void bta_dm_pm_ssr(const RawAddress& peer_addr, int ssr) { current_ssr_index = p_bta_dm_pm_spec[config.spec_idx].ssr; if ((config.id == service.id) && ((config.app_id == BTA_ALL_APP_ID) || (config.app_id == service.app_id))) { APPL_TRACE_WARNING("%s: conn_srvc id:%d, app_id:%d", __func__, service.id, service.app_id); LOG_INFO("Found connected service:%s app_id:%d peer:%s", BtaIdSysText(service.id).c_str(), service.app_id, PRIVATE_ADDRESS(peer_addr)); break; } } Loading @@ -782,21 +795,28 @@ static void bta_dm_pm_ssr(const RawAddress& peer_addr, int ssr) { } } APPL_TRACE_WARNING("%s ssr:%d, lat:%d", __func__, ssr_index, p_spec->max_lat); if (p_spec->max_lat) { LOG_DEBUG( "Max latency is non zero max_lat:0x%04x min_loc_to:0x%04x " "min_rmt_to:0x%04x", p_spec->max_lat, p_spec->min_loc_to, p_spec->min_rmt_to); /* Avoid SSR reset on device which has SCO connected */ if (bta_dm_pm_is_sco_active()) { int idx = bta_dm_get_sco_index(); if (idx != -1) { if (bta_dm_conn_srvcs.conn_srvc[idx].peer_bdaddr == peer_addr) { APPL_TRACE_WARNING("%s SCO is active on device, ignore SSR", __func__); LOG_WARN("SCO is active on device, ignore SSR"); return; } } } LOG_DEBUG( "Setting sniff subrating for device:%s max_lat:0x%04x " "min_loc_to:0x%04x min_rmt_to:0x%04x", PRIVATE_ADDRESS(peer_addr), p_spec->max_lat, p_spec->min_loc_to, p_spec->min_rmt_to); /* set the SSR parameters. */ BTM_SetSsrParams(peer_addr, p_spec->max_lat, p_spec->min_rmt_to, p_spec->min_loc_to); Loading @@ -819,7 +839,11 @@ void bta_dm_pm_active(const RawAddress& peer_addr) { /* switch to active mode */ pm.mode = BTM_PM_MD_ACTIVE; BTM_SetPowerMode(bta_dm_cb.pm_id, peer_addr, &pm); tBTM_STATUS status = BTM_SetPowerMode(bta_dm_cb.pm_id, peer_addr, &pm); if (status != BTM_CMD_STORED && status != BTM_CMD_STARTED) { LOG_WARN("Unable to set active mode for device:%s", PRIVATE_ADDRESS(peer_addr)); } } /** BTM power manager callback */ Loading Loading @@ -1000,8 +1024,6 @@ static bool bta_dm_pm_is_sco_active() { break; } } APPL_TRACE_DEBUG("bta_dm_is_sco_active: SCO active: %d", bScoActive); return bScoActive; } Loading
system/bta/sys/bta_sys_conn.cc +5 −2 Original line number Diff line number Diff line Loading @@ -29,6 +29,8 @@ #include "bta/include/utl.h" #include "bta/sys/bta_sys.h" #include "bta/sys/bta_sys_int.h" #include "main/shim/dumpsys.h" #include "osi/include/log.h" #include "osi/include/osi.h" /******************************************************************************* Loading Loading @@ -85,8 +87,9 @@ void bta_sys_ssr_cfg_register(tBTA_SYS_SSR_CFG_CBACK* p_cback) { ******************************************************************************/ void bta_sys_notify_role_chg(const RawAddress& peer_addr, uint8_t new_role, uint8_t hci_status) { APPL_TRACE_DEBUG("%s: peer %s new_role:%d hci_status:0x%x", __func__, peer_addr.ToString().c_str(), new_role, hci_status); LOG_DEBUG("Role changed peer:%s new_role:%s hci_status:%s", PRIVATE_ADDRESS(peer_addr), RoleText(new_role).c_str(), hci_error_code_text(hci_status).c_str()); if (bta_sys_cb.p_role_cb) { bta_sys_cb.p_role_cb(BTA_SYS_ROLE_CHANGE, new_role, hci_status, peer_addr); } Loading
system/main/shim/acl.cc +3 −1 Original line number Diff line number Diff line Loading @@ -238,7 +238,9 @@ class ClassicShimAclConnection } void OnModeChange(hci::Mode current_mode, uint16_t interval) override { LOG_INFO("UNIMPLEMENTED"); TRY_POSTING_ON_MAIN(interface_.on_mode_change, ToLegacyHciErrorCode(hci::ErrorCode::SUCCESS), handle_, ToLegacyHciMode(current_mode), interval); } void OnQosSetupComplete(hci::ServiceType service_type, uint32_t token_rate, Loading
system/main/shim/acl_legacy_interface.cc +1 −1 Original line number Diff line number Diff line Loading @@ -43,7 +43,7 @@ const acl_interface_t GetAclInterface() { .link.classic.on_flow_specification_complete = nullptr, .link.classic.on_flush_occurred = nullptr, .link.classic.on_central_link_key_complete = nullptr, .link.classic.on_mode_change = nullptr, .link.classic.on_mode_change = btm_pm_on_mode_change, .link.classic.on_packet_type_changed = nullptr, .link.classic.on_qos_setup_complete = nullptr, .link.classic.on_read_afh_channel_map_complete = nullptr, Loading