Message ID | 20210916204020.118310-1-luiz.dentz@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Luiz Von Dentz |
Headers | show |
Series | [v2,1/2] service: Add btd_service_is_initiator | expand |
Context | Check | Description |
---|---|---|
tedd_an/checkpatch | success | Checkpatch PASS |
tedd_an/gitlint | success | Gitlint PASS |
tedd_an/setupell | success | Setup ELL PASS |
tedd_an/buildprep | success | Build Prep PASS |
tedd_an/build | success | Build Configuration PASS |
tedd_an/makecheck | success | Make Check PASS |
tedd_an/makedistcheck | success | Make Distcheck PASS |
tedd_an/build_extell | success | Build External ELL PASS |
tedd_an/build_extell_make | success | Build Make with External ELL PASS |
This is automated email and please do not reply to this email! Dear submitter, Thank you for submitting the patches to the linux bluetooth mailing list. This is a CI test results with your patch series: PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=548445 ---Test result--- Test Summary: CheckPatch PASS 2.81 seconds GitLint PASS 1.91 seconds Prep - Setup ELL PASS 50.54 seconds Build - Prep PASS 0.54 seconds Build - Configure PASS 9.26 seconds Build - Make PASS 222.81 seconds Make Check PASS 9.35 seconds Make Distcheck PASS 254.55 seconds Build w/ext ELL - Configure PASS 8.89 seconds Build w/ext ELL - Make PASS 206.22 seconds --- Regards, Linux Bluetooth
diff --git a/src/service.c b/src/service.c index 84fbb208a..14a4c292b 100644 --- a/src/service.c +++ b/src/service.c @@ -42,6 +42,7 @@ struct btd_service { btd_service_state_t state; int err; bool is_allowed; + bool initiator; }; struct service_state_callback { @@ -96,6 +97,9 @@ static void change_state(struct btd_service *service, btd_service_state_t state, cb->cb(service, old, state, cb->user_data); } + + if (state == BTD_SERVICE_STATE_DISCONNECTED) + service->initiator = false; } struct btd_service *btd_service_ref(struct btd_service *service) @@ -261,6 +265,7 @@ int btd_service_connect(struct btd_service *service) err = profile->connect(service); if (err == 0) { + service->initiator = true; change_state(service, BTD_SERVICE_STATE_CONNECTING, 0); return 0; } @@ -343,6 +348,11 @@ int btd_service_get_error(const struct btd_service *service) return service->err; } +bool btd_service_is_initiator(const struct btd_service *service) +{ + return service->initiator; +} + unsigned int btd_service_add_state_cb(btd_service_state_cb cb, void *user_data) { struct service_state_callback *state_cb; diff --git a/src/service.h b/src/service.h index 5a2a02447..fa930f985 100644 --- a/src/service.h +++ b/src/service.h @@ -47,6 +47,7 @@ struct btd_device *btd_service_get_device(const struct btd_service *service); struct btd_profile *btd_service_get_profile(const struct btd_service *service); btd_service_state_t btd_service_get_state(const struct btd_service *service); int btd_service_get_error(const struct btd_service *service); +bool btd_service_is_initiator(const struct btd_service *service); unsigned int btd_service_add_state_cb(btd_service_state_cb cb, void *user_data);
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com> Since BTD_SERVICE_STATE_CONNECTING is being used for both initiator and responder case it is no longer possible to use the state distint when the service connection was initiated locally or not, so to fix this a new flag is introduce to track when btd_service_connect has been called. --- src/service.c | 10 ++++++++++ src/service.h | 1 + 2 files changed, 11 insertions(+)