diff options
author | Anthony Stange <stange@google.com> | 2022-04-18 20:02:59 +0000 |
---|---|---|
committer | Anthony Stange <stange@google.com> | 2022-04-19 17:57:00 +0000 |
commit | 474803cf6b97d360016357b7babeb554e006fdc3 (patch) | |
tree | 325fc940130a03074f46643c13b4187c8b4b8274 | |
parent | 575382c4daf2f7a809cb16409bd5c3797e68a190 (diff) | |
download | chre-474803cf6b97d360016357b7babeb554e006fdc3.tar.gz |
Fix ranging async CHPP service impl
The current implementation will always send a NAN ranging notification
even though that's not used by CHPP today. This CL fixes the
implementation to use the request ranging async command for the
notification which will be properly piped to CHRE.
Bug: 229629371
Test: validate firmware with change
Change-Id: I04b61bd1ee6e414480315ddafd11289f136e60a5
-rw-r--r-- | chpp/services/wifi.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/chpp/services/wifi.c b/chpp/services/wifi.c index c1ef5265..2ff4e5a8 100644 --- a/chpp/services/wifi.c +++ b/chpp/services/wifi.c @@ -798,18 +798,13 @@ static void chppWifiServiceRangingEventCallback( } if (notification != NULL) { + uint16_t command = CHPP_WIFI_REQUEST_RANGING_ASYNC; + // Per CHRE's API contract, only one kind of ranging request can be pending - // at a time - look into the global wifi request-response state to - // determine what context this callback is being invoked for. - uint8_t rangingRequestState = - gWifiServiceContext.requestRangingAsync.requestState; - uint16_t command = (rangingRequestState == CHPP_REQUEST_STATE_REQUEST_SENT) - ? CHPP_WIFI_REQUEST_RANGING_ASYNC - : CHPP_WIFI_REQUEST_NAN_RANGING_ASYNC; + // at a time - use the higher of the two for the notification. uint8_t transaction = - (command == CHPP_WIFI_REQUEST_RANGING_ASYNC) - ? gWifiServiceContext.requestRangingAsync.transaction - : gWifiServiceContext.requestNanRangingAsync.transaction; + MAX(gWifiServiceContext.requestRangingAsync.transaction, + gWifiServiceContext.requestNanRangingAsync.transaction); notification->header.handle = gWifiServiceContext.service.handle; notification->header.type = CHPP_MESSAGE_TYPE_SERVICE_NOTIFICATION; notification->header.transaction = transaction; |