Version 1.9.4

- Add missing includes for string.h. This caused compile errors on
    certain android platforms.
- Add support for seperate data and command channels over a single
    char device.
diff --git a/src/common/inc/ant_version.h b/src/common/inc/ant_version.h
index 1a84247..02b2a0a 100644
--- a/src/common/inc/ant_version.h
+++ b/src/common/inc/ant_version.h
@@ -21,7 +21,7 @@
 

 #define LIBANT_STACK_MAJOR "1"

 #define LIBANT_STACK_MINOR "9"

-#define LIBANT_STACK_INCRE "3"

+#define LIBANT_STACK_INCRE "4"

 

 #endif // __ANT_VERSION_H

 

diff --git a/src/vfs/ant_native_chardev.c b/src/vfs/ant_native_chardev.c
index 2b49a8c..982fdf5 100644
--- a/src/vfs/ant_native_chardev.c
+++ b/src/vfs/ant_native_chardev.c
@@ -33,6 +33,7 @@
 #include <stdint.h> /* for uint64_t */
 #include <sys/eventfd.h> /* For eventfd() */
 #include <unistd.h> /* for read(), write(), and close() */
+#include <string.h>
 
 #include "ant_types.h"
 #include "ant_native.h"
@@ -43,6 +44,10 @@
 #include "ant_hci_defines.h"
 #include "ant_log.h"
 
+#if (ANT_HCI_CHANNEL_SIZE > 0) || !defined(ANT_DEVICE_NAME)
+#define MULTIPATH_TX
+#endif
+
 #if ANT_HCI_SIZE_SIZE > 1
 #include "ant_utils.h"  // Put HCI Size value across multiple bytes
 #endif
@@ -722,6 +727,11 @@
 ////////////////////////////////////////////////////////////////////
 ANTStatus ant_tx_message(ANT_U8 ucLen, ANT_U8 *pucMesg)
 {
+#if defined(MULTIPATH_TX)
+   ANT_BOOL bIsData;
+#endif
+   ant_channel_type eTxChannel;
+   ant_channel_type eFlowChannel;
    ANTStatus status = ANT_STATUS_FAILED;
    // TODO ANT_HCI_MAX_MSG_SIZE is transport (driver) dependent.
    ANT_U8 txBuffer[ANT_HCI_MAX_MSG_SIZE];
@@ -735,12 +745,37 @@
       goto out;
    }
 
+#if defined(MULTIPATH_TX)
+switch (pucMesg[ANT_MSG_ID_OFFSET]) {
+   case MESG_BROADCAST_DATA_ID:
+   case MESG_ACKNOWLEDGED_DATA_ID:
+   case MESG_BURST_DATA_ID:
+   case MESG_EXT_BROADCAST_DATA_ID:
+   case MESG_EXT_ACKNOWLEDGED_DATA_ID:
+   case MESG_EXT_BURST_DATA_ID:
+   case MESG_ADV_BURST_DATA_ID:
+      bIsData = ANT_TRUE;
+      break;
+   default:
+      bIsData = ANT_FALSE;
+      break;
+   }
+
+   ANT_DEBUG_V("tx message: bIsData=%d", bIsData);
+#endif
+
 #if ANT_HCI_OPCODE_SIZE == 1
    txBuffer[ANT_HCI_OPCODE_OFFSET] = ANT_HCI_OPCODE_TX;
 #elif ANT_HCI_OPCODE_SIZE > 1
 #error "Specified ANT_HCI_OPCODE_SIZE not currently supported"
 #endif
 
+#if ANT_HCI_CHANNEL_SIZE == 1
+   txBuffer[ANT_HCI_CHANNEL_OFFSET] = bIsData ? ANT_HCI_DATA_CHANNEL : ANT_HCI_COMMAND_CHANNEL;
+#elif ANT_HCI_OPCODE_SIZE > 1
+#error "Specified ANT_HCI_CHANNEL_SIZE not currently supported"
+#endif
+
 #if ANT_HCI_SIZE_SIZE == 1
    txBuffer[ANT_HCI_SIZE_OFFSET] = ucLen;
 #elif ANT_HCI_SIZE_SIZE == 2
@@ -753,21 +788,24 @@
 
    ANT_SERIAL(txBuffer, txMessageLength, 'T');
 
-#ifdef ANT_DEVICE_NAME // Single transport path
-   status = ant_tx_message_flowcontrol_wait(SINGLE_CHANNEL, SINGLE_CHANNEL, txMessageLength, txBuffer);
+#ifdef ANT_DEVICE_NAME
+   eTxChannel = SINGLE_CHANNEL;
+   eFlowChannel = SINGLE_CHANNEL;
+#else
+   eTxChannel = bIsData ? DATA_CHANNEL : COMMAND_CHANNEL;
+   eFlowChannel = COMMAND_CHANNEL;
+#endif
+
+#if !defined(MULTIPATH_TX) // Single transport path
+   status = ant_tx_message_flowcontrol_wait(eTxChannel, eFlowChannel, txMessageLength, txBuffer);
 #else // Separate data/command paths
-   switch (txBuffer[ANT_HCI_DATA_OFFSET + ANT_MSG_ID_OFFSET]) {
-   case MESG_BROADCAST_DATA_ID:
-   case MESG_ACKNOWLEDGED_DATA_ID:
-   case MESG_BURST_DATA_ID:
-   case MESG_EXT_BROADCAST_DATA_ID:
-   case MESG_EXT_ACKNOWLEDGED_DATA_ID:
-   case MESG_EXT_BURST_DATA_ID:
-   case MESG_ADV_BURST_DATA_ID:
-      status = ant_tx_message_flowcontrol_wait(DATA_CHANNEL, COMMAND_CHANNEL, txMessageLength, txBuffer);
-      break;
-   default:
-      status = ant_tx_message_flowcontrol_none(COMMAND_CHANNEL, txMessageLength, txBuffer);
+   if (bIsData)
+   {
+      status = ant_tx_message_flowcontrol_wait(eTxChannel, eFlowChannel, txMessageLength, txBuffer);
+   }
+   else
+   {
+      status = ant_tx_message_flowcontrol_none(eTxChannel, txMessageLength, txBuffer);
    }
 #endif // Separate data/command paths
 
diff --git a/src/vfs/ant_rx_chardev.c b/src/vfs/ant_rx_chardev.c
index 94c09b1..3f2718c 100644
--- a/src/vfs/ant_rx_chardev.c
+++ b/src/vfs/ant_rx_chardev.c
@@ -30,6 +30,7 @@
 #include <poll.h>
 #include <pthread.h>
 #include <stdint.h> /* for uint64_t */
+#include <string.h>
 
 #include "ant_types.h"
 #include "antradio_power.h"
diff --git a/src/vfs/inc/ant_hci_defines.h b/src/vfs/inc/ant_hci_defines.h
index 3ffe672..b51eb8a 100644
--- a/src/vfs/inc/ant_hci_defines.h
+++ b/src/vfs/inc/ant_hci_defines.h
@@ -40,11 +40,12 @@
 
 #include "ant_driver_defines.h"
 
-#define ANT_HCI_HEADER_SIZE                  ((ANT_HCI_OPCODE_SIZE) + (ANT_HCI_SIZE_SIZE) + (ANT_HCI_SYNC_SIZE))
+#define ANT_HCI_HEADER_SIZE                  ((ANT_HCI_OPCODE_SIZE) + (ANT_HCI_CHANNEL_SIZE) + (ANT_HCI_SIZE_SIZE) + (ANT_HCI_SYNC_SIZE))
 #define ANT_HCI_FOOTER_SIZE                  (ANT_HCI_CHECKSUM_SIZE)
 
 #define ANT_HCI_OPCODE_OFFSET                0
-#define ANT_HCI_SIZE_OFFSET                  ((ANT_HCI_OPCODE_OFFSET) + (ANT_HCI_OPCODE_SIZE))
+#define ANT_HCI_CHANNEL_OFFSET               ((ANT_HCI_OPCODE_OFFSET) + (ANT_HCI_OPCODE_SIZE))
+#define ANT_HCI_SIZE_OFFSET                  ((ANT_HCI_CHANNEL_OFFSET) + (ANT_HCI_CHANNEL_SIZE))
 #define ANT_HCI_SYNC_OFFSET                  ((ANT_HCI_SIZE_OFFSET) + (ANT_HCI_SIZE_SIZE))
 #define ANT_HCI_DATA_OFFSET                  (ANT_HCI_HEADER_SIZE)
 
diff --git a/src/vfs/prerelease/ant_driver_defines.h b/src/vfs/prerelease/ant_driver_defines.h
index c30c6e4..3eb5c31 100644
--- a/src/vfs/prerelease/ant_driver_defines.h
+++ b/src/vfs/prerelease/ant_driver_defines.h
@@ -34,7 +34,7 @@
 // |----------------------|-----------------|

 // |Optional| Data | Opt. | ...  | Optional |

 // | Opcode | Size | Sync |      | Checksum |

-	

+

 // Data may include any number of ANT packets, with no sync byte or checksum.

 // A read from the driver may return any number of ANT HCI packets.

 

@@ -46,25 +46,27 @@
 

 // Set the file name the driver creates for the ANT device:

 //   If chip uses separate command and data paths:

-#define ANT_COMMANDS_DEVICE_NAME             "/dev/smd5"

-#define ANT_DATA_DEVICE_NAME                 "/dev/smd6"

+// #define ANT_COMMANDS_DEVICE_NAME             "/dev/smd5"

+// #define ANT_DATA_DEVICE_NAME                 "/dev/smd6"

 // OR

 //   If chip uses one path:

-// #define ANT_DEVICE_NAME                      "/dev/Z"

+#define ANT_DEVICE_NAME                      "/dev/ant"

 

-	

 // Set to the number of bytes of header is for Opcode:

 #define ANT_HCI_OPCODE_SIZE                  0

- 	

+

+// Set to the number of bytes of header for channel ID

+#define ANT_HCI_CHANNEL_SIZE                 1

+

 // Set to the number of bytes of header is for Data Size:

 #define ANT_HCI_SIZE_SIZE                    1

- 	

+

 // Set to the number of bytes of header is for Sync:

 #define ANT_HCI_SYNC_SIZE                    0

- 	

+

 // Set to the number of bytes of footer is for Checksum:

 #define ANT_HCI_CHECKSUM_SIZE                0

- 	

+

 // ---------------------- OPTIONAL

 

 // If hard reset is supported, define ANT_IOCTL_RESET

@@ -78,8 +80,12 @@
 //   define the message content:

 //     That signals Flow Go:

 #define ANT_FLOW_GO                          ((ANT_U8)0x00)

- 	

+

 //     That signals Flow Stop:

 #define ANT_FLOW_STOP                        ((ANT_U8)0x80)

 

+// If using a channel ID byte, define the ids.

+#define ANT_HCI_COMMAND_CHANNEL              ((ANT_U8)0x0C)

+#define ANT_HCI_DATA_CHANNEL                 ((ANT_U8)0x0E)

+

 #endif /* ifndef __VFS_PRERELEASE_H */

diff --git a/src/vfs/qualcomm/smd/ant_driver_defines.h b/src/vfs/qualcomm/smd/ant_driver_defines.h
index 273286d..948c524 100644
--- a/src/vfs/qualcomm/smd/ant_driver_defines.h
+++ b/src/vfs/qualcomm/smd/ant_driver_defines.h
@@ -34,7 +34,7 @@
 // |----------------------|-----------------|
 // |Optional| Data | Opt. | ...  | Optional |
 // | Opcode | Size | Sync |      | Checksum |
-	
+
 // Data may include any number of ANT packets, with no sync byte or checksum.
 // A read from the driver may return any number of ANT HCI packets.
 
@@ -52,19 +52,21 @@
 //   If chip uses one path:
 // #define ANT_DEVICE_NAME                      "/dev/Z"
 
-	
 // Set to the number of bytes of header is for Opcode:
 #define ANT_HCI_OPCODE_SIZE                  0
- 	
+
+// Set to the number of bytes of header for channel ID
+#define ANT_HCI_CHANNEL_SIZE                 0
+
 // Set to the number of bytes of header is for Data Size:
 #define ANT_HCI_SIZE_SIZE                    1
- 	
+
 // Set to the number of bytes of header is for Sync:
 #define ANT_HCI_SYNC_SIZE                    0
- 	
+
 // Set to the number of bytes of footer is for Checksum:
 #define ANT_HCI_CHECKSUM_SIZE                0
- 	
+
 // ---------------------- OPTIONAL
 
 // If hard reset is supported, define ANT_IOCTL_RESET
@@ -78,7 +80,7 @@
 //   define the message content:
 //     That signals Flow Go:
 #define ANT_FLOW_GO                          ((ANT_U8)0x00)
- 	
+
 //     That signals Flow Stop:
 #define ANT_FLOW_STOP                        ((ANT_U8)0x80)
 
diff --git a/src/vfs/ste/cg29xx/ant_driver_defines.h b/src/vfs/ste/cg29xx/ant_driver_defines.h
index c47415d..b72439f 100644
--- a/src/vfs/ste/cg29xx/ant_driver_defines.h
+++ b/src/vfs/ste/cg29xx/ant_driver_defines.h
@@ -54,6 +54,8 @@
 
 // Set to the number of bytes of header is for Opcode:
 #define ANT_HCI_OPCODE_SIZE                  0
+// Set to the number of bytes of header for channel ID
+#define ANT_HCI_CHANNEL_SIZE                 0
 // Set to the number of bytes of header is for Data Size:
 #define ANT_HCI_SIZE_SIZE                    1