aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2013-04-15 22:33:01 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2013-04-15 22:33:01 -0700
commit34f88462b0c47f097a710a425b71489e7710b047 (patch)
tree8292e908fb5f9b837e3d20d50fc3cf73280c1f54
parent2a83e3cd525ff615d2831fcee967c43ae5a3412f (diff)
parenteb25a64cdd50d36a21ea840ddd84f8e1549dfc2a (diff)
downloadandroid_external_ant-wireless_ant_native-34f88462b0c47f097a710a425b71489e7710b047.tar.gz
android_external_ant-wireless_ant_native-34f88462b0c47f097a710a425b71489e7710b047.tar.bz2
android_external_ant-wireless_ant_native-34f88462b0c47f097a710a425b71489e7710b047.zip
Merge "Merge remote-tracking branch 'remotes/quic/caf/github/master' into tip"
-rw-r--r--src/vfs/ant_rx_chardev.c45
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;