summaryrefslogtreecommitdiffstats
path: root/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch
diff options
context:
space:
mode:
Diffstat (limited to 'external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch')
-rw-r--r--external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch
new file mode 100644
index 00000000..de0522bf
--- /dev/null
+++ b/external/meta-iot-cloud/recipes-ibm/ibm-iotf-embeddedc/files/Add-additional-options-to-sample-apps.patch
@@ -0,0 +1,77 @@
+From 796c934b3294871cb8ccb566ff6a9ae78d3ea4df Mon Sep 17 00:00:00 2001
+From: Vivek Chandra <vivek.chandrax.amancha@intel.com>
+Date: Wed, 21 Mar 2018 19:45:48 +0530
+Subject: [PATCH] Add additional options to sample apps
+
+---
+ samples/sampleDevice.c | 15 +++++++++------
+ samples/sampleGateway.c | 14 ++++++++++----
+ 2 files changed, 19 insertions(+), 10 deletions(-)
+
+diff --git a/samples/sampleDevice.c b/samples/sampleDevice.c
+index e1d78ea..5af14a2 100644
+--- a/samples/sampleDevice.c
++++ b/samples/sampleDevice.c
+@@ -40,7 +40,6 @@ int main(int argc, char const *argv[])
+ int rc = -1;
+
+ iotfclient client;
+-
+ //catch interrupt signal
+ signal(SIGINT, sigHandler);
+ signal(SIGTERM, sigHandler);
+@@ -48,16 +47,20 @@ int main(int argc, char const *argv[])
+ char* configFilePath;
+
+ if(isEMBDCHomeDefined()){
+-
+ getSamplesPath(&configFilePath);
+ configFilePath = realloc(configFilePath,strlen(configFilePath)+15);
+ strcat(configFilePath,"device.cfg");
+ }
+- else{
+- printf("IOT_EMBDC_HOME is not defined\n");
+- printf("Define IOT_EMBDC_HOME to client library path to execute samples\n");
++ //to handle if EMBDCHome not defined
++ else if(argc > 1) {
++ configFilePath = (char*)malloc(sizeof(char)*(strlen(argv[1])+3));
++ strcpy(configFilePath,argv[1]);
++ }
++ else {
++ printf("Pass the absolute path of the config file as command line argument ex: ./sampleDevice <path-to-config>/<config-file-name> or ");
++ printf("Please define IOT_EMBDC_HOME\n");
+ return -1;
+- }
++ }
+
+ rc = initialize_configfile(&client, configFilePath,0);
+ free(configFilePath);
+diff --git a/samples/sampleGateway.c b/samples/sampleGateway.c
+index 0d98f53..202ad45 100644
+--- a/samples/sampleGateway.c
++++ b/samples/sampleGateway.c
+@@ -55,11 +55,17 @@ int main(int argc, char const *argv[])
+ configFilePath = realloc(configFilePath,strlen(configFilePath)+15);
+ strcat(configFilePath,"gateway.cfg");
+ }
+- else{
+- printf("IOT_EMBDC_HOME is not defined\n");
+- printf("Define IOT_EMBDC_HOME to client library path to execute samples\n");
++ //to handle if EMBDCHome not defined
++ else if(argc > 1) {
++ configFilePath = (char*)malloc(sizeof(char)*(strlen(argv[1])+3));
++ strcpy(configFilePath,argv[1]);
++ }
++ else {
++ printf("Pass the absolute path of the config file as command line argument ex: ./sampleGateway <path-to-config>/<config-file-name> or ");
++ printf("Define IOT_EMBDC_HOME to client library path to execute samples\n");
+ return -1;
+- }
++ }
++
+
+ rc = initialize_configfile(&client, configFilePath,1);
+ free(configFilePath);
+--
+2.7.4
+