diff options
author | Brant Thomsen <brant.thomsen@harman.com> | 2017-07-19 17:13:24 -0600 |
---|---|---|
committer | Brant Thomsen <brant.thomsen@harman.com> | 2017-07-19 17:13:24 -0600 |
commit | 8721f5174965ca319954d0cc64e6887eb8173d71 (patch) | |
tree | 1c85d959299135ee8f8b09afbb44170fa492b7b2 | |
parent | 238bda5ea30853fed984841d6e4ba9b75db91993 (diff) | |
download | Open-AVB-8721f5174965ca319954d0cc64e6887eb8173d71.tar.gz |
AVDECC Acquisition Fixes
Changed the acquisition logic to correctly acquire the entity if it is
unacquired.
Fix so that if the entity is not acquired or locked, commands to set entity
values are allowed.
-rw-r--r-- | lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c b/lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c index 75e6e7b3..d48c7cdb 100644 --- a/lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c +++ b/lib/avtp_pipeline/aecp/openavb_aecp_sm_entity_model_entity.c @@ -147,6 +147,7 @@ void acquireEntity() AEM_LOCK();
if (pCommand->entityModelPdu.command_data.acquireEntityCmd.flags & OPENAVB_AEM_ACQUIRE_ENTITY_COMMAND_FLAG_RELEASE) {
// AVDECC_TODO - need to add mutex for the entity model
+ AVB_LOG_DEBUG("Entity Released");
pAem->entityAcquired = FALSE;
}
else {
@@ -158,11 +159,16 @@ void acquireEntity() memcpy(pCommand->entityModelPdu.command_data.acquireEntityRsp.owner_id, pAem->acquiredControllerId, sizeof(pCommand->commonPdu.controller_entity_id));
}
else {
- pAem->entityAcquired = TRUE;
- memcpy(pAem->acquiredControllerId, pCommand->commonPdu.controller_entity_id, sizeof(pAem->acquiredControllerId));
- memcpy(pCommand->entityModelPdu.command_data.acquireEntityRsp.owner_id, pCommand->commonPdu.controller_entity_id, sizeof(pCommand->commonPdu.controller_entity_id));
+ // Entity was already acquired by this controller, so indicate a successful acquisition.
+ pCommand->headers.status = OPENAVB_AEM_COMMAND_STATUS_SUCCESS;
}
}
+ else {
+ pAem->entityAcquired = TRUE;
+ memcpy(pAem->acquiredControllerId, pCommand->commonPdu.controller_entity_id, sizeof(pAem->acquiredControllerId));
+ memcpy(pCommand->entityModelPdu.command_data.acquireEntityRsp.owner_id, pCommand->commonPdu.controller_entity_id, sizeof(pCommand->commonPdu.controller_entity_id));
+ AVB_LOGF_DEBUG("Entity Acquired by " ENTITYID_FORMAT, pCommand->entityModelPdu.command_data.acquireEntityRsp.owner_id);
+ }
}
AEM_UNLOCK();
}
@@ -193,7 +199,7 @@ void lockEntity() bool processCommandCheckRestriction_CorrectController()
{
AVB_TRACE_ENTRY(AVB_TRACE_AECP);
- bool bResult = FALSE;
+ bool bResult = TRUE;
openavb_aecp_AEMCommandResponse_t *pCommand = openavbAecpSMEntityModelEntityVars.rcvdCommand;
if (!pCommand) {
@@ -209,11 +215,19 @@ bool processCommandCheckRestriction_CorrectController() if (memcmp(pAem->acquiredControllerId, pCommand->commonPdu.controller_entity_id, sizeof(pAem->acquiredControllerId)) == 0) {
bResult = TRUE;
}
+ else {
+ AVB_LOGF_DEBUG("Access denied to " ENTITYID_FORMAT " as " ENTITYID_FORMAT " already acquired it", pCommand->commonPdu.controller_entity_id, pAem->acquiredControllerId);
+ bResult = FALSE;
+ }
}
else if (pAem->entityLocked) {
- if (memcmp(pAem->lockedControllerId, pCommand->commonPdu.controller_entity_id, sizeof(pAem->acquiredControllerId)) == 0) {
+ if (memcmp(pAem->lockedControllerId, pCommand->commonPdu.controller_entity_id, sizeof(pAem->lockedControllerId)) == 0) {
bResult = TRUE;
}
+ else {
+ AVB_LOGF_DEBUG("Access denied to " ENTITYID_FORMAT " as " ENTITYID_FORMAT " already locked it", pCommand->commonPdu.controller_entity_id, pAem->lockedControllerId);
+ bResult = FALSE;
+ }
}
AEM_UNLOCK();
}
|