diff options
author | Satish kumar sugasi <ssugas@codeaurora.org> | 2013-04-15 16:39:31 -0700 |
---|---|---|
committer | Satish kumar sugasi <ssugas@codeaurora.org> | 2013-04-15 16:55:16 -0700 |
commit | eb25a64cdd50d36a21ea840ddd84f8e1549dfc2a (patch) | |
tree | 8292e908fb5f9b837e3d20d50fc3cf73280c1f54 | |
parent | 2a83e3cd525ff615d2831fcee967c43ae5a3412f (diff) | |
parent | f8b491fa13e2649a0a499cc799cc827c23357799 (diff) | |
download | android_external_ant-wireless_ant_native-eb25a64cdd50d36a21ea840ddd84f8e1549dfc2a.tar.gz android_external_ant-wireless_ant_native-eb25a64cdd50d36a21ea840ddd84f8e1549dfc2a.tar.bz2 android_external_ant-wireless_ant_native-eb25a64cdd50d36a21ea840ddd84f8e1549dfc2a.zip |
Merge remote-tracking branch 'remotes/quic/caf/github/master' into tip
Change-Id: I1d417019d52605e104214e0f7f3d4cdccbf18d2c
-rw-r--r-- | src/vfs/ant_rx_chardev.c | 45 |
1 files changed, 31 insertions, 14 deletions
diff --git a/src/vfs/ant_rx_chardev.c b/src/vfs/ant_rx_chardev.c index 5a4a255..2af65a4 100644 --- a/src/vfs/ant_rx_chardev.c +++ b/src/vfs/ant_rx_chardev.c @@ -234,6 +234,8 @@ int readChannelMsg(ant_channel_type eChannel, ant_channel_info_t *pstChnlInfo) int iRet = -1; ANT_U8 aucRxBuffer[ANT_HCI_MAX_MSG_SIZE]; int iRxLenRead; + int iCurrentHciPacketOffset; + int iHciPacketSize; ANT_FUNC_START(); // Keep trying to read while there is an error, and that error is EAGAIN @@ -284,23 +286,38 @@ int readChannelMsg(ant_channel_type eChannel, ant_channel_info_t *pstChnlInfo) #endif // ANT_HCI_OPCODE_SIZE == 1 { // Received an ANT packet + iCurrentHciPacketOffset = 0; + + while(iCurrentHciPacketOffset < iRxLenRead) { + + iHciPacketSize = aucRxBuffer[iCurrentHciPacketOffset + ANT_HCI_SIZE_OFFSET]; + #ifdef ANT_MESG_FLOW_CONTROL - if (aucRxBuffer[ANT_HCI_DATA_OFFSET + ANT_MSG_ID_OFFSET] == ANT_MESG_FLOW_CONTROL) { - // This is a flow control packet, not a standard ANT message - if(setFlowControl(pstChnlInfo, aucRxBuffer[ANT_HCI_DATA_OFFSET + ANT_MSG_DATA_OFFSET])) { - goto out; - } - } else + if (aucRxBuffer[iCurrentHciPacketOffset + ANT_HCI_DATA_OFFSET + ANT_MSG_ID_OFFSET] == + ANT_MESG_FLOW_CONTROL) { + // This is a flow control packet, not a standard ANT message + if(setFlowControl(pstChnlInfo, \ + aucRxBuffer[iCurrentHciPacketOffset + ANT_HCI_DATA_OFFSET + ANT_MSG_DATA_OFFSET])) { + goto out; + } + } else #endif // ANT_MESG_FLOW_CONTROL - { - if (pstChnlInfo->fnRxCallback != NULL) { - // TODO Allow HCI Size value to be larger than 1 byte - // This currently works as no size value is greater than 255, and little endian - pstChnlInfo->fnRxCallback(aucRxBuffer[ANT_HCI_SIZE_OFFSET], &aucRxBuffer[ANT_HCI_DATA_OFFSET]); - } else { - ANT_WARN("%s rx callback is null", pstChnlInfo->pcDevicePath); + { + if (pstChnlInfo->fnRxCallback != NULL) { + // TODO Allow HCI Packet Size value to be larger than 1 byte + // This currently works as no size value is greater than 255, and little endian + + + // Loop through read data until all HCI packets are written to callback + pstChnlInfo->fnRxCallback(iHciPacketSize, \ + &aucRxBuffer[iCurrentHciPacketOffset + ANT_HCI_DATA_OFFSET]); + } else { + ANT_WARN("%s rx callback is null", pstChnlInfo->pcDevicePath); + } } - } + + iCurrentHciPacketOffset = iCurrentHciPacketOffset + ANT_HCI_HEADER_SIZE + iHciPacketSize; + } } iRet = 0; |