-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth: CAP: Add support for doing just disable for unicast stop #74187
Bluetooth: CAP: Add support for doing just disable for unicast stop #74187
Conversation
20bfc6f
to
13ff2c6
Compare
13ff2c6
to
bcbb88d
Compare
bcbb88d
to
6b14334
Compare
11939f8
to
01b5556
Compare
01b5556
to
4904b5c
Compare
} | ||
} | ||
|
||
if (!can_disable && !can_stop && !can_release) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does -EALREADY make sense here?
The GNU spec. states it as:
'EALREADY
The socket socket is non-blocking and already has a pending connection in progress (see EINPROGRESS above).'
And while its true that we "already has a pending connection in progress", I think the intent of the wording is when we try to connect a new one.
Could EBUSY make more sense here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The case is here is that all streams are already stopped, and thus -EBUSY
doesn't make any sense.
The alternative is that we return 0
, but then it's hard for an application to determine whether a request was successfully sent, or if nothing was done.
We need a way to tell the caller that no request was sent because it would not result in any state changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this make sense. In regardless, I certainly think 0
would be wrong here :D
4904b5c
to
ca8f521
Compare
ca8f521
to
83a839f
Compare
The unicast_stop function is changed to primarily do a BAP disable instead of a release, with optional support for releasing the streams once they have been disabled. This also adds unittests for the procedure which also allow us to remove the invalid param testing from the BSIM tests. Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
83a839f
to
5448837
Compare
|
||
bt_cap_common_start_proc(BT_CAP_COMMON_PROC_TYPE_STOP, param->count); | ||
if (!can_disable && can_disable_stream(bap_stream)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Somehow missing the link to my original comment. Anyway good point that this is in a loop.
It still could be rewritten as
can_disable = can_disable || can_disable_stream(bap_stream);
which still would do the short circuiting, but I am not sure if that's more readable than what you have now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I think the current version is more explicit. Not sure if there's any performance changes between the two, but I think can_disable = can_disable || can_disable_stream(bap_stream)
might be worth as it always does 1 assign and 1 compare, whereas the current version always do 1 comparison and optionally an assign.
Investigating a possible issue |
There is indeed an issue, but it's not caused by this PR nor easily fixable by this PR, and will be fixed in #79014 |
The unicast_stop function is changed to primarily do a
BAP disable instead of a release, with optional
support for releasing the streams once they have been disabled.
fixes #70818