File tree Expand file tree Collapse file tree 1 file changed +11
-19
lines changed
subsys/bluetooth/host/classic Expand file tree Collapse file tree 1 file changed +11
-19
lines changed Original file line number Diff line number Diff line change @@ -4037,35 +4037,27 @@ static void hfp_hf_sco_disconnected(struct bt_sco_chan *chan, uint8_t reason)
4037
4037
static int bt_hfp_hf_sco_accept (const struct bt_sco_accept_info * info ,
4038
4038
struct bt_sco_chan * * chan )
4039
4039
{
4040
- int i ;
4041
4040
static struct bt_sco_chan_ops ops = {
4042
4041
.connected = hfp_hf_sco_connected ,
4043
4042
.disconnected = hfp_hf_sco_disconnected ,
4044
4043
};
4044
+ size_t index ;
4045
+ struct bt_hfp_hf * hf ;
4045
4046
4046
4047
LOG_DBG ("conn %p" , info -> acl );
4047
4048
4048
- for (i = 0 ; i < ARRAY_SIZE (bt_hfp_hf_pool ); i ++ ) {
4049
- struct bt_hfp_hf * hf = & bt_hfp_hf_pool [i ];
4050
-
4051
- if (NULL == hf -> rfcomm_dlc .session ) {
4052
- continue ;
4053
- }
4054
-
4055
- if (info -> acl != hf -> rfcomm_dlc .session -> br_chan .chan .conn ) {
4056
- continue ;
4057
- }
4058
-
4059
- hf -> chan .ops = & ops ;
4060
-
4061
- * chan = & hf -> chan ;
4062
-
4063
- return 0 ;
4049
+ index = (size_t )bt_conn_index (info -> acl );
4050
+ hf = & bt_hfp_hf_pool [index ];
4051
+ if (hf -> acl != info -> acl ) {
4052
+ LOG_ERR ("ACL %p of HF is unaligned with SCO's %p" , hf -> acl , info -> acl );
4053
+ return - EINVAL ;
4064
4054
}
4065
4055
4066
- LOG_ERR ( "Unable to establish HF connection (%p)" , info -> acl ) ;
4056
+ hf -> chan . ops = & ops ;
4067
4057
4068
- return - ENOMEM ;
4058
+ * chan = & hf -> chan ;
4059
+
4060
+ return 0 ;
4069
4061
}
4070
4062
4071
4063
static void hfp_hf_init (void )
You can’t perform that action at this time.
0 commit comments