Message ID | 20230329210932.537019-2-luiz.dentz@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [BlueZ,1/2] bap: Mark devices to auto-connect | expand |
Context | Check | Description |
---|---|---|
tedd_an/pre-ci_am | success | Success |
tedd_an/CheckPatch | fail | ERROR:TRAILING_STATEMENTS: trailing statements should be on next line (or did you mean 'else if'?) #111: FILE: src/device.c:324: + } if (dev->bredr_state.connected) /github/workspace/src/src/13193225.patch total: 1 errors, 0 warnings, 18 lines checked NOTE: For some of the reported defects, checkpatch may be able to mechanically convert to the typical style using --fix or --fix-inplace. /github/workspace/src/src/13193225.patch has style problems, please review. NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO NOTE: If any of the errors are false positives, please report them to the maintainer, see CHECKPATCH in MAINTAINERS. |
tedd_an/GitLint | success | Gitlint PASS |
tedd_an/IncrementalBuild | success | Incremental Build PASS |
diff --git a/src/device.c b/src/device.c index f31f2a097e07..c538742b683f 100644 --- a/src/device.c +++ b/src/device.c @@ -312,9 +312,16 @@ static struct bearer_state *get_state(struct btd_device *dev, bool btd_device_is_initiator(struct btd_device *dev) { - if (dev->le_state.connected) + if (dev->le_state.connected) { + /* Mark as initiator if not set yet and auto-connect flag is + * set and LTK key is for a peripheral. + */ + if (!dev->le_state.initiator && dev->auto_connect && + dev->ltk && !dev->ltk->central) + dev->le_state.initiator = true; + return dev->le_state.initiator; - if (dev->bredr_state.connected) + } if (dev->bredr_state.connected) return dev->bredr_state.initiator; return dev->att_io ? true : false;
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> If the device is marked as auto-connect the kernel may initiate the connection spontaneously causing new connections to not have set the state->initiator flag properly. --- src/device.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)